(function() { BemsWebApplication.FmsMaterialCodeTypeViewModel = function(data) { this.SiteId = ko.observable(); this.MaterialTypeId = ko.observable(); this.Name = ko.observable(); this.Nickname = ko.observable(); this.IsUse = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsMaterialCodeTypeViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), MaterialTypeId: this.MaterialTypeId(), Name: this.Name(), Nickname: this.Nickname(), IsUse: this.IsUse(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.MaterialTypeId(data.MaterialTypeId); this.Name(data.Name); this.Nickname(data.Nickname); this.IsUse(data.IsUse); } } }); })();