(function() { BemsWebApplication.BemsPriceFormulaViewModel = function(data) { this.SiteId = ko.observable(); this.PriceTypeId = ko.observable(); this.FacilityTypeId = ko.observable(); this.FormulaId = ko.observable(); this.FacilityCode = ko.observable(); this.UseYN = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.BemsPriceFormulaViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), PriceTypeId: this.PriceTypeId(), FacilityTypeId: this.FacilityTypeId(), FormulaId: this.FormulaId(), FacilityCode: this.FacilityCode(), UseYN: this.UseYN() }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.PriceTypeId(data.PriceTypeId); this.FacilityTypeId(data.FacilityTypeId); this.FormulaId(data.FormulaId); this.FacilityCode(data.FacilityCode); this.UseYN(data.UseYN); } } }); })();