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