(function() { BemsWebApplication.BemsAlarmSettingViewModel = function(data) { this.SiteId = ko.observable(); this.FacilityTypeId = ko.observable(); this.FacilityCode = ko.observable(); this.PropertyId = ko.observable(); this.FormulaId = ko.observable(); this.FacilityName = ko.observable(); this.PointName = ko.observable(); this.UseUpperLimit = ko.observable(); this.UpperLimit = ko.observable(); this.UseLowerLimit = ko.observable(); this.LowerLimit = ko.observable(); this.UseAlarm = ko.observable(); this.UseSMS = ko.observable(); this.UseEmail = ko.observable(); this.AlarmGroupName = ko.observable(); this.Content = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.BemsAlarmSettingViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), FacilityTypeId: this.FacilityTypeId(), FacilityCode: this.FacilityCode(), PropertyId: this.PropertyId(), FormulaId: this.FormulaId(), FacilityName: this.FacilityName(), PointName: this.PointName(), UseUpperLimit: this.UseUpperLimit(), UpperLimit: this.UpperLimit(), UseLowerLimit: this.UseLowerLimit(), LowerLimit: this.LowerLimit(), UseAlarm: this.UseAlarm(), UseSMS: this.UseSMS(), UseEmail: this.UseEmail(), AlarmGroupName: this.AlarmGroupName(), Content: this.Content() }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.FacilityTypeId(data.FacilityTypeId); this.FacilityCode(data.FacilityCode); this.PropertyId(data.PropertyId); this.FormulaId(data.FormulaId); this.FacilityName(data.FacilityName); this.PointName(data.PointName); this.UseUpperLimit(data.UseUpperLimit); this.UpperLimit(data.UpperLimit); this.UseLowerLimit(data.UseLowerLimit); this.LowerLimit(data.LowerLimit); this.UseAlarm(data.UseAlarm); this.UseSMS(data.UseSMS); this.UseEmail(data.UseEmail); this.AlarmGroupName(data.AlarmGroupName); this.Content(data.Content); } } }); })();