7b6bc4598c2f6bac82a4de331c7e1e71592ddac7.svn-base 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. (function() {
  2. BemsWebApplication.BemsAlarmSettingViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.FacilityTypeId = ko.observable();
  5. this.FacilityCode = ko.observable();
  6. this.PropertyId = ko.observable();
  7. this.FormulaId = ko.observable();
  8. this.FacilityName = ko.observable();
  9. this.PointName = ko.observable();
  10. this.UseUpperLimit = ko.observable();
  11. this.UpperLimit = ko.observable();
  12. this.UseLowerLimit = ko.observable();
  13. this.LowerLimit = ko.observable();
  14. this.UseAlarm = ko.observable();
  15. this.UseSMS = ko.observable();
  16. this.UseEmail = ko.observable();
  17. this.AlarmGroupName = ko.observable();
  18. this.Content = ko.observable();
  19. if(data)
  20. this.fromJS(data);
  21. };
  22. $.extend(BemsWebApplication.BemsAlarmSettingViewModel.prototype, {
  23. toJS: function() {
  24. return {
  25. SiteId: this.SiteId(),
  26. FacilityTypeId: this.FacilityTypeId(),
  27. FacilityCode: this.FacilityCode(),
  28. PropertyId: this.PropertyId(),
  29. FormulaId: this.FormulaId(),
  30. FacilityName: this.FacilityName(),
  31. PointName: this.PointName(),
  32. UseUpperLimit: this.UseUpperLimit(),
  33. UpperLimit: this.UpperLimit(),
  34. UseLowerLimit: this.UseLowerLimit(),
  35. LowerLimit: this.LowerLimit(),
  36. UseAlarm: this.UseAlarm(),
  37. UseSMS: this.UseSMS(),
  38. UseEmail: this.UseEmail(),
  39. AlarmGroupName: this.AlarmGroupName(),
  40. Content: this.Content()
  41. };
  42. },
  43. fromJS: function(data) {
  44. if(data) {
  45. this.SiteId(data.SiteId);
  46. this.FacilityTypeId(data.FacilityTypeId);
  47. this.FacilityCode(data.FacilityCode);
  48. this.PropertyId(data.PropertyId);
  49. this.FormulaId(data.FormulaId);
  50. this.FacilityName(data.FacilityName);
  51. this.PointName(data.PointName);
  52. this.UseUpperLimit(data.UseUpperLimit);
  53. this.UpperLimit(data.UpperLimit);
  54. this.UseLowerLimit(data.UseLowerLimit);
  55. this.LowerLimit(data.LowerLimit);
  56. this.UseAlarm(data.UseAlarm);
  57. this.UseSMS(data.UseSMS);
  58. this.UseEmail(data.UseEmail);
  59. this.AlarmGroupName(data.AlarmGroupName);
  60. this.Content(data.Content);
  61. }
  62. }
  63. });
  64. })();