(function() { BemsWebApplication.FmsWorkRequestViewModel = function(data) { this.SiteId = ko.observable(); this.WorkRequestId = ko.observable(); this.WorkTypeId = ko.observable(); this.BusinessFieldId = ko.observable(); this.WorkScheduleId = ko.observable(); this.WorkProgressId = ko.observable(); this.RequestUserId = ko.observable(); this.Title = ko.observable(); this.Content = ko.observable(); this.RequestDate = ko.observable(); this.StartWorkDate = ko.observable(); this.RejectUserId = ko.observable(); this.RejectDate = ko.observable(); this.RejectReason = ko.observable(); this.InspectionAgencyId = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsWorkRequestViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), WorkRequestId: this.WorkRequestId(), WorkTypeId: this.WorkTypeId(), BusinessFieldId: this.BusinessFieldId(), WorkScheduleId: this.WorkScheduleId(), WorkProgressId: this.WorkProgressId(), RequestUserId: this.RequestUserId(), Title: this.Title(), Content: this.Content(), RequestDate: this.RequestDate(), StartWorkDate: this.StartWorkDate(), RejectUserId: this.RejectUserId(), RejectDate: this.RejectDate(), RejectReason: this.RejectReason(), InspectionAgencyId: this.InspectionAgencyId(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.WorkRequestId(data.WorkRequestId); this.WorkTypeId(data.WorkTypeId); this.BusinessFieldId(data.BusinessFieldId); this.WorkScheduleId(data.WorkScheduleId); this.WorkProgressId(data.WorkProgressId); this.RequestUserId(data.RequestUserId); this.Title(data.Title); this.Content(data.Content); this.RequestDate(data.RequestDate); this.StartWorkDate(data.StartWorkDate); this.RejectUserId(data.RejectUserId); this.RejectDate(data.RejectDate); this.RejectReason(data.RejectReason); this.InspectionAgencyId(data.InspectionAgencyId); } } }); })();