TestOperateView.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace EMIS.ViewModel
  6. {
  7. public class TestOperateView
  8. {
  9. public Guid? OperateID { get; set; }
  10. public Guid? UserID { get; set; }
  11. public string UserName { get; set; }
  12. public DateTime? StartTime { get; set; }
  13. public string StartTimeStr {
  14. get {
  15. return StartTime == null ? "" : StartTime.Value.ToLongDateString() + " " + StartTime.Value.ToLongTimeString();
  16. }
  17. }
  18. public DateTime? EndTime { get; set; }
  19. public string EndTimeStr
  20. {
  21. get
  22. {
  23. return EndTime == null ? "" : EndTime.Value.ToLongDateString() + " " + EndTime.Value.ToLongTimeString();
  24. }
  25. }
  26. public string WorkTimeStr {
  27. get {
  28. string workTime = "";
  29. if (StartTime != null && EndTime != null)
  30. {
  31. TimeSpan ts1 = new TimeSpan(StartTime.Value.Ticks);
  32. TimeSpan ts2 = new TimeSpan(EndTime.Value.Ticks);
  33. TimeSpan ts3 = ts1.Subtract(ts2).Duration();
  34. //你想转的格式
  35. workTime = ts3.ToString("c").Substring(0, 8);
  36. }
  37. return workTime;
  38. }
  39. }
  40. public Guid? CreateUserID { get; set; }
  41. public DateTime? CreateTime { get; set; }
  42. public Guid? ModifyUserID { get; set; }
  43. public DateTime? ModifyTime { get; set; }
  44. }
  45. }