cmuser-view-model.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. (function () {
  2. BemsWebApplication.CmUserViewModel = function (data) {
  3. this.SiteId = ko.observable();
  4. this.UserId = ko.observable();
  5. this.CompanyId = ko.observable();
  6. this.DepartmentId = ko.observable();
  7. this.PositionId = ko.observable();
  8. this.BusinessFieldId = ko.observable();
  9. this.UserGroupId = ko.observable();
  10. this.Name = ko.observable();
  11. this.Passwd = ko.observable();
  12. this.Birthday = ko.observable();
  13. this.Lunar = ko.observable();
  14. this.StateId = ko.observable();
  15. this.EmploymentType = ko.observable();
  16. this.EmploymentStatus = ko.observable();
  17. this.OfficePhoneNo = ko.observable();
  18. this.HomePhoneNo = ko.observable();
  19. this.MobilePhoneNo = ko.observable();
  20. this.HomeZip1 = ko.observable();
  21. this.HomeZip2 = ko.observable();
  22. this.HomeAddress1 = ko.observable();
  23. this.HomeAdderss2 = ko.observable();
  24. this.Email = ko.observable();
  25. this.EnterDate = ko.observable();
  26. this.RetireDate = ko.observable();
  27. this.Comment = ko.observable();
  28. this.Rfcsn = ko.observable();
  29. this.PasswordUpdatedDate = ko.observable();
  30. //this.PhotoFileId = ko.observable();
  31. this.IsBems = ko.observable();
  32. this.IsUse = ko.observable();
  33. this.Certificated = ko.observable();
  34. this.IsScheduleUser = ko.observable();
  35. this.IsSI = ko.observable();
  36. this.IsMobile = ko.observable();
  37. if (data)
  38. this.fromJS(data);
  39. };
  40. $.extend(BemsWebApplication.CmUserViewModel.prototype, {
  41. toJS: function () {
  42. return {
  43. SiteId: this.SiteId(),
  44. UserId: this.UserId(),
  45. CompanyId: this.CompanyId(),
  46. DepartmentId: this.DepartmentId(),
  47. PositionId: this.PositionId(),
  48. BusinessFieldId: this.BusinessFieldId(),
  49. UserGroupId: this.UserGroupId(),
  50. Name: this.Name(),
  51. Passwd: this.Passwd(),
  52. Birthday: this.Birthday(),
  53. Lunar: this.Lunar(),
  54. StateId: this.StateId(),
  55. EmploymentType: this.EmploymentType(),
  56. EmploymentStatus: this.EmploymentStatus(),
  57. OfficePhoneNo: this.OfficePhoneNo(),
  58. HomePhoneNo: this.HomePhoneNo(),
  59. MobilePhoneNo: this.MobilePhoneNo(),
  60. HomeZip1: this.HomeZip1(),
  61. HomeZip2: this.HomeZip2(),
  62. HomeAddress1: this.HomeAddress1(),
  63. HomeAdderss2: this.HomeAdderss2(),
  64. Email: this.Email(),
  65. EnterDate: this.EnterDate(),
  66. RetireDate: this.RetireDate(),
  67. Comment: this.Comment(),
  68. Rfcsn: this.Rfcsn(),
  69. PasswordUpdatedDate: this.PasswordUpdatedDate(),
  70. //PhotoFileId: this.PhotoFileId(),
  71. IsBems: this.IsBems(),
  72. IsUse: this.IsUse(),
  73. Certificated: this.Certificated(),
  74. IsScheduleUser: this.IsScheduleUser(),
  75. IsSI: this.IsSI(),
  76. IsMobile: this.IsMobile(),
  77. };
  78. },
  79. fromJS: function (data) {
  80. if (data) {
  81. this.SiteId(data.SiteId);
  82. this.UserId(data.UserId);
  83. this.CompanyId(data.CompanyId);
  84. this.DepartmentId(data.DepartmentId);
  85. this.PositionId(data.PositionId);
  86. this.BusinessFieldId(data.BusinessFieldId);
  87. this.UserGroupId(data.UserGroupId);
  88. this.Name(data.Name);
  89. this.Passwd(data.Passwd);
  90. this.Birthday(data.Birthday);
  91. this.Lunar(data.Lunar);
  92. this.StateId(data.StateId);
  93. this.EmploymentType(data.EmploymentType);
  94. this.EmploymentStatus(data.EmploymentStatus);
  95. this.OfficePhoneNo(data.OfficePhoneNo);
  96. this.HomePhoneNo(data.HomePhoneNo);
  97. this.MobilePhoneNo(data.MobilePhoneNo);
  98. this.HomeZip1(data.HomeZip1);
  99. this.HomeZip2(data.HomeZip2);
  100. this.HomeAddress1(data.HomeAddress1);
  101. this.HomeAdderss2(data.HomeAdderss2);
  102. this.Email(data.Email);
  103. this.EnterDate(data.EnterDate);
  104. this.RetireDate(data.RetireDate);
  105. this.Comment(data.Comment);
  106. this.Rfcsn(data.Rfcsn);
  107. this.PasswordUpdatedDate(data.PasswordUpdatedDate);
  108. //this.PhotoFileId(data.PhotoFileId);
  109. this.IsBems(data.IsBems);
  110. this.IsUse(data.IsUse);
  111. this.Certificated(data.Certificated);
  112. this.IsScheduleUser(data.IsScheduleUser);
  113. this.IsSI(data.IsSI);
  114. this.IsMobile(data.IsMobile);
  115. }
  116. }
  117. });
  118. })();