a4411015432e33ba9e693b8f5b7967fa6b13140e.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. (function() {
  2. BemsWebApplication.CmFacilityViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.FacilityTypeId = ko.observable();
  5. this.FacilityCode = ko.observable();
  6. this.FirstClassId = ko.observable();
  7. this.SecondClassId = ko.observable();
  8. this.ThirdClassId = ko.observable();
  9. this.DeviceType = ko.observable();
  10. this.ParentFacilityCode = ko.observable();
  11. this.Name = ko.observable();
  12. this.Nickname = ko.observable();
  13. this.Rfid = ko.observable();
  14. this.Manufacturer = ko.observable();
  15. this.ManufactureDate = ko.observable();
  16. this.ManufactureSerial = ko.observable();
  17. this.ManufactureModel = ko.observable();
  18. this.Supplier = ko.observable();
  19. this.SupplierPhoneNo = ko.observable();
  20. this.BuildingId = ko.observable();
  21. this.FloorId = ko.observable();
  22. this.ZoneId = ko.observable();
  23. this.InstallDate = ko.observable();
  24. this.OperationStartDate = ko.observable();
  25. this.FacilityCapacity = ko.observable();
  26. this.FacilityCost = ko.observable();
  27. this.FacilityCount = ko.observable();
  28. this.FacilitySeviceLifeYear = ko.observable();
  29. this.FacilityUsage = ko.observable();
  30. this.RatedPowerConsumption = ko.observable();
  31. this.RatedCOP = ko.observable();
  32. this.FileId = ko.observable();
  33. this.MainContactorUserId = ko.observable();
  34. this.SubContactorUserId = ko.observable();
  35. this.Note = ko.observable();
  36. this.Reserved1 = ko.observable();
  37. this.Reserved2 = ko.observable();
  38. this.IsUse = ko.observable();
  39. this.IsVirtualFacility = ko.observable();
  40. this.FuelTypeId = ko.observable();
  41. this.ContractType = ko.observable();
  42. if(data)
  43. this.fromJS(data);
  44. };
  45. $.extend(BemsWebApplication.CmFacilityViewModel.prototype, {
  46. toJS: function() {
  47. return {
  48. SiteId: this.SiteId(),
  49. FacilityTypeId: this.FacilityTypeId(),
  50. FacilityCode: this.FacilityCode(),
  51. FirstClassId: this.FirstClassId(),
  52. SecondClassId: this.SecondClassId(),
  53. ThirdClassId: this.ThirdClassId(),
  54. DeviceType: this.DeviceType(),
  55. ParentFacilityCode: this.ParentFacilityCode(),
  56. Name: this.Name(),
  57. Nickname: this.Nickname(),
  58. Rfid: this.Rfid(),
  59. Manufacturer: this.Manufacturer(),
  60. ManufactureDate: this.ManufactureDate(),
  61. ManufactureSerial: this.ManufactureSerial(),
  62. ManufactureModel: this.ManufactureModel(),
  63. Supplier: this.Supplier(),
  64. SupplierPhoneNo: this.SupplierPhoneNo(),
  65. BuildingId: this.BuildingId(),
  66. FloorId: this.FloorId(),
  67. ZoneId: this.ZoneId(),
  68. InstallDate: this.InstallDate(),
  69. OperationStartDate: this.OperationStartDate(),
  70. FacilityCapacity: this.FacilityCapacity(),
  71. FacilityCost: this.FacilityCost(),
  72. FacilityCount: this.FacilityCount(),
  73. FacilitySeviceLifeYear: this.FacilitySeviceLifeYear(),
  74. FacilityUsage: this.FacilityUsage(),
  75. RatedPowerConsumption: this.RatedPowerConsumption(),
  76. RatedCOP: this.RatedCOP(),
  77. FileId: this.FileId(),
  78. MainContactorUserId: this.MainContactorUserId(),
  79. SubContactorUserId: this.SubContactorUserId(),
  80. Note: this.Note(),
  81. Reserved1: this.Reserved1(),
  82. Reserved2: this.Reserved2(),
  83. IsUse: this.IsUse(),
  84. IsVirtualFacility: this.IsVirtualFacility(),
  85. FuelTypeId: this.FuelTypeId(),
  86. ContractType: this.ContractType(),
  87. };
  88. },
  89. fromJS: function(data) {
  90. if(data) {
  91. this.SiteId(data.SiteId);
  92. this.FacilityTypeId(data.FacilityTypeId);
  93. this.FacilityCode(data.FacilityCode);
  94. this.FirstClassId(data.FirstClassId);
  95. this.SecondClassId(data.SecondClassId);
  96. this.ThirdClassId(data.ThirdClassId);
  97. this.DeviceType(data.DeviceType);
  98. this.ParentFacilityCode(data.ParentFacilityCode);
  99. this.Name(data.Name);
  100. this.Nickname(data.Nickname);
  101. this.Rfid(data.Rfid);
  102. this.Manufacturer(data.Manufacturer);
  103. this.ManufactureDate(data.ManufactureDate);
  104. this.ManufactureSerial(data.ManufactureSerial);
  105. this.ManufactureModel(data.ManufactureModel);
  106. this.Supplier(data.Supplier);
  107. this.SupplierPhoneNo(data.SupplierPhoneNo);
  108. this.BuildingId(data.BuildingId);
  109. this.FloorId(data.FloorId);
  110. this.ZoneId(data.ZoneId);
  111. this.InstallDate(data.InstallDate);
  112. this.OperationStartDate(data.OperationStartDate);
  113. this.FacilityCapacity(data.FacilityCapacity);
  114. this.FacilityCost(data.FacilityCost);
  115. this.FacilityCount(data.FacilityCount);
  116. this.FacilitySeviceLifeYear(data.FacilitySeviceLifeYear);
  117. this.FacilityUsage(data.FacilityUsage);
  118. this.RatedPowerConsumption(data.RatedPowerConsumption);
  119. this.RatedCOP(data.RatedCOP);
  120. this.FileId(data.FileId);
  121. this.MainContactorUserId(data.MainContactorUserId);
  122. this.SubContactorUserId(data.SubContactorUserId);
  123. this.Note(data.Note);
  124. this.Reserved1(data.Reserved1);
  125. this.Reserved2(data.Reserved2);
  126. this.IsUse(data.IsUse);
  127. this.IsVirtualFacility(data.IsVirtualFacility);
  128. this.FuelTypeId(data.FuelTypeId);
  129. this.ContractType(data.ContractType);
  130. }
  131. }
  132. });
  133. })();