(function() { BemsWebApplication.CmSiteViewModel = function(data) { this.SiteId = ko.observable(); this.Name = ko.observable(); this.AddressZip1 = ko.observable(); this.AddressZip2 = ko.observable(); this.Address1 = ko.observable(); this.Adderss2 = ko.observable(); this.PhoneNo = ko.observable(); this.URL = ko.observable(); this.Comment = ko.observable(); this.IsUse = ko.observable(); this.IsControlSchedule = ko.observable(); this.ScheduleCheckHour = ko.observable(); this.MaxPeak = ko.observable(); this.CompletionDate = ko.observable(); this.BuildingSize = ko.observable(); this.GrossArea = ko.observable(); this.BuildingArea = ko.observable(); this.FloorAreaRatio = ko.observable(); this.BuildingCoverageRatio = ko.observable(); this.MainUse = ko.observable(); this.Standard = ko.observable(); this.MainUseIndex = ko.observable(); this.HDD = ko.observable(); this.CDD = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.CmSiteViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), Name: this.Name(), AddressZip1: this.AddressZip1(), AddressZip2: this.AddressZip2(), Address1: this.Address1(), Adderss2: this.Adderss2(), PhoneNo: this.PhoneNo(), URL: this.URL(), Comment: this.Comment(), IsUse: this.IsUse(), IsControlSchedule: this.IsControlSchedule(), ScheduleCheckHour: this.ScheduleCheckHour(), CompletionDate: this.CompletionDate(), BuildingSize: this.BuildingSize(), GrossArea: this.GrossArea(), BuildingArea: this.BuildingArea(), FloorAreaRatio: this.FloorAreaRatio(), BuildingCoverageRatio: this.BuildingCoverageRatio(), MainUse: this.MainUse(), Standard: this.Standard(), MainUseIndex: this.MainUseIndex(), HDD: this.HDD(), CDD: this.CDD(), MaxPeak: this.MaxPeak(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.Name(data.Name); this.AddressZip1(data.AddressZip1); this.AddressZip2(data.AddressZip2); this.Address1(data.Address1); this.Adderss2(data.Adderss2); this.PhoneNo(data.PhoneNo); this.URL(data.URL); this.Comment(data.Comment); this.IsUse(data.IsUse); this.IsControlSchedule(data.IsControlSchedule); this.ScheduleCheckHour(data.ScheduleCheckHour); this.CompletionDate(data.CompletionDate); this.BuildingSize(data.BuildingSize); this.GrossArea(data.GrossArea); this.BuildingArea(data.BuildingArea); this.FloorAreaRatio(data.FloorAreaRatio); this.BuildingCoverageRatio(data.BuildingCoverageRatio); this.MainUse(data.MainUse); this.Standard(data.Standard); this.MainUseIndex(data.MainUseIndex); this.HDD(data.HDD); this.CDD(data.CDD); this.MaxPeak(data.MaxPeak); } } }); })();