bemsalarmlog-view-model.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 
  2. (function () {
  3. BemsWebApplication.BemsAlarmLogViewModel = function (data) {
  4. this.SiteId = ko.observable();
  5. this.FacilityTypeId = ko.observable();
  6. this.FacilityCode = ko.observable();
  7. this.PropertyId = ko.observable();
  8. this.FormulaId = ko.observable();
  9. this.CreatedDateTime = ko.observable();
  10. this.CurrentValue = ko.observable();
  11. this.SMSResult = ko.observable();
  12. this.EmailResult = ko.observable();
  13. this.Conform = ko.observable();
  14. if (data)
  15. this.fromJS(data);
  16. };
  17. $.extend(BemsWebApplication.BemsAlarmLogViewModel.prototype, {
  18. toJS: function () {
  19. return {
  20. SiteId: this.SiteId(),
  21. FacilityTypeId: this.FacilityTypeId(),
  22. FacilityCode: this.FacilityCode(),
  23. PropertyId: this.PropertyId(),
  24. FormulaId: this.FormulaId(),
  25. CreatedDateTime: this.CreatedDateTime(),
  26. CurrentValue: this.CurrentValue(),
  27. SMSResult: this.SMSResult(),
  28. EmailResult: this.EmailResult(),
  29. Conform: this.Conform(),
  30. };
  31. },
  32. fromJS: function (data) {
  33. if (data) {
  34. this.SiteId(data.SiteId);
  35. this.FacilityTypeId(data.FacilityTypeId);
  36. this.FacilityCode(data.FacilityCode);
  37. this.PropertyId(data.PropertyId);
  38. this.FormulaId(data.FormulaId);
  39. this.CreatedDateTime(data.CreatedDateTime);
  40. this.CurrentValue(data.CurrentValue);
  41. this.SMSResult(data.SMSResult);
  42. this.EmailResult(data.EmailResult);
  43. this.Conform(data.Conform);
  44. }
  45. }
  46. });
  47. })();