(function() { BemsWebApplication.FmsFacilityOperationItemViewModel = function(data) { this.SiteId = ko.observable(); this.FacilityCode = ko.observable(); this.ItemId = ko.observable(); this.Name = ko.observable(); this.ResultUnit = ko.observable(); this.PointId = ko.observable(); this.SystemId = ko.observable(); this.EnergyCode = ko.observable(); this.IsUse = ko.observable(); this.SortOrderNo = ko.observable(); this.InsertedDate = ko.observable(); this.InsertedUserId = ko.observable(); this.UpdatedDate = ko.observable(); this.UpdatedUserId = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsFacilityOperationItemViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), FacilityCode: this.FacilityCode(), ItemId: this.ItemId(), Name: this.Name(), ResultUnit: this.ResultUnit(), PointId: this.PointId(), SystemId: this.SystemId(), EnergyCode: this.EnergyCode(), IsUse: this.IsUse(), SortOrderNo: this.SortOrderNo(), InsertedDate: this.InsertedDate(), InsertedUserId: this.InsertedUserId(), UpdatedDate: this.UpdatedDate(), UpdatedUserId: this.UpdatedUserId(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.FacilityCode(data.FacilityCode); this.ItemId(data.ItemId); this.Name(data.Name); this.ResultUnit(data.ResultUnit); this.PointId(data.PointId); this.SystemId(data.SystemId); this.EnergyCode(data.EnergyCode); this.IsUse(data.IsUse); this.SortOrderNo(data.SortOrderNo); this.InsertedDate(data.InsertedDate); this.InsertedUserId(data.InsertedUserId); this.UpdatedDate(data.UpdatedDate); this.UpdatedUserId(data.UpdatedUserId); } } }); })();