(function() { BemsWebApplication.FmsMaterialCodeClassViewModel = function(data) { this.SiteId = ko.observable(); this.MaterialClassId = ko.observable(); this.ParentMaterialClassId = ko.observable(); this.Depth = ko.observable(); this.Name = ko.observable(); this.Abbreviation = ko.observable(); this.IsUse = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsMaterialCodeClassViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), MaterialClassId: this.MaterialClassId(), ParentMaterialClassId: this.ParentMaterialClassId(), Depth: this.Depth(), Name: this.Name(), Abbreviation: this.Abbreviation(), IsUse: this.IsUse(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.MaterialClassId(data.MaterialClassId); this.ParentMaterialClassId(data.ParentMaterialClassId); this.Depth(data.Depth); this.Name(data.Name); this.Abbreviation(data.Abbreviation); this.IsUse(data.IsUse); } } }); })();