bemsmonitoringpoint-view-model.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. (function() {
  2. BemsWebApplication.BemsMonitoringPointViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.FacilityTypeId = ko.observable();
  5. this.FacilityCode = ko.observable();
  6. this.PropertyId = ko.observable();
  7. this.ValueType = ko.observable();
  8. this.ServiceTypeId = ko.observable();
  9. this.FuelTypeId = ko.observable();
  10. //this.IsAccumulated = ko.observable();
  11. this.Name = ko.observable();
  12. this.Description = ko.observable();
  13. this.BuildingId = ko.observable();
  14. this.FloorId = ko.observable();
  15. this.ZoneId = ko.observable();
  16. //this.TagInput = ko.observable();
  17. //this.TagOutput = ko.observable();
  18. //this.IsVirtualFacility = ko.observable();
  19. if(data)
  20. this.fromJS(data);
  21. };
  22. $.extend(BemsWebApplication.BemsMonitoringPointViewModel.prototype, {
  23. toJS: function() {
  24. return {
  25. SiteId: this.SiteId(),
  26. FacilityTypeId: this.FacilityTypeId(),
  27. FacilityCode: this.FacilityCode(),
  28. PropertyId: this.PropertyId(),
  29. ValueType: this.ValueType(),
  30. ServiceTypeId: this.ServiceTypeId(),
  31. FuelTypeId: this.FuelTypeId(),
  32. //IsAccumulated: this.IsAccumulated(),
  33. Name: this.Name(),
  34. Description: this.Description(),
  35. BuildingId: this.BuildingId(),
  36. FloorId: this.FloorId(),
  37. ZoneId: this.ZoneId(),
  38. //TagInput: this.TagInput(),
  39. //TagOutput: this.TagOutput(),
  40. //IsVirtualFacility: this.IsVirtualFacility(),
  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.ValueType(data.ValueType);
  50. this.ServiceTypeId(data.ServiceTypeId);
  51. this.FuelTypeId(data.FuelTypeId);
  52. //this.IsAccumulated(data.IsAccumulated);
  53. this.Name(data.Name);
  54. this.Description(data.Description);
  55. this.BuildingId(data.BuildingId);
  56. this.FloorId(data.FloorId);
  57. this.ZoneId(data.ZoneId);
  58. //this.TagInput(data.TagInput);
  59. //this.TagOutput(data.TagOutput);
  60. //this.IsVirtualFacility(data.IsVirtualFacility);
  61. }
  62. }
  63. });
  64. })();