1a2559ddef32898aff16ca5557cfa64629dd64cc.svn-base 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. (function () {
  2. BemsWebApplication.CmPatrolHistoryViewModel = function (data) {
  3. this.SiteId = ko.observable();
  4. this.PatrolHistoryId = ko.observable();
  5. this.ScheduleId = ko.observable();
  6. this.startDate = ko.observable();
  7. this.endDate = ko.observable();
  8. this.resultTypeId = ko.observable();
  9. this.resultDesc = ko.observable();
  10. if (data)
  11. this.fromJS(data);
  12. };
  13. $.extend(BemsWebApplication.CmPatrolHistoryViewModel.prototype, {
  14. toJS: function () {
  15. return {
  16. SiteId: this.SiteId(),
  17. PatrolHistoryId: this.PatrolHistoryId(),
  18. ScheduleId: this.ScheduleId(),
  19. startDate: this.startDate(),
  20. endDate: this.endDate(),
  21. resultTypeId: this.resultTypeId(),
  22. resultDesc: this.resultDesc(),
  23. };
  24. },
  25. fromJS: function (data) {
  26. if (data) {
  27. this.SiteId(data.SiteId);
  28. this.PatrolHistoryId(data.PatrolHistoryId);
  29. this.ScheduleId(data.ScheduleId);
  30. this.startDate(data.startDate);
  31. this.endDate(data.endDate);
  32. this.resultTypeId(data.resultTypeId);
  33. this.resultDesc(data.resultDesc);
  34. }
  35. }
  36. });
  37. })();