867452665522d34cad5fa447f12e136fc1afef76.svn-base 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 
  2. (function () {
  3. BemsWebApplication.BemsMonitoringPointConfigViewModel = function (data) {
  4. this.SiteId = ko.observable();
  5. this.FacilityTypeId = ko.observable();
  6. this.FacilityCode = ko.observable();
  7. this.PropertyId = ko.observable();
  8. this.IsAccumulated = ko.observable();
  9. this.IsSampled = ko.observable();
  10. this.SaveMode = ko.observable();
  11. this.ControlPointName = ko.observable();
  12. this.IsConverted = ko.observable();
  13. if (data)
  14. this.fromJS(data);
  15. };
  16. $.extend(BemsWebApplication.BemsMonitoringPointConfigViewModel.prototype, {
  17. toJS: function () {
  18. return {
  19. SiteId: this.SiteId(),
  20. FacilityTypeId: this.FacilityTypeId(),
  21. FacilityCode: this.FacilityCode(),
  22. PropertyId: this.PropertyId(),
  23. IsAccumulated: this.IsAccumulated(),
  24. IsSampled: this.IsSampled(),
  25. SaveMode: this.SaveMode(),
  26. ControlPointName: this.ControlPointName(),
  27. IsConverted: this.IsConverted(),
  28. };
  29. },
  30. fromJS: function (data) {
  31. if (data) {
  32. this.SiteId(data.SiteId);
  33. this.FacilityTypeId(data.FacilityTypeId);
  34. this.FacilityCode(data.FacilityCode);
  35. this.PropertyId(data.PropertyId);
  36. this.IsAccumulated(data.IsAccumulated);
  37. this.IsSampled(data.IsSampled);
  38. this.SaveMode(data.SaveMode);
  39. this.ControlPointName(data.ControlPointName);
  40. this.IsConverted(data.IsConverted);
  41. }
  42. }
  43. });
  44. })();