(function() {
    BemsWebApplication.FmsWorkDailyRecordTemplateViewModel = function(data) {
            this.SiteId = ko.observable();
            this.BusinessFieldId = ko.observable();
            this.TemplateId = ko.observable();
            this.TemplateName = ko.observable();
            this.StartDate = ko.observable();
            this.IsUse = ko.observable();
            this.SortOrderNo = ko.observable();
            this.InsertedDate = ko.observable();
            this.InsertedUserId = ko.observable();
            this.UpdatedDate = ko.observable();
            this.UpdatedUserId = ko.observable();
            if(data)
                this.fromJS(data);
    };

    $.extend(BemsWebApplication.FmsWorkDailyRecordTemplateViewModel.prototype, {
        toJS: function() {
            return {
                SiteId: this.SiteId(),
                BusinessFieldId: this.BusinessFieldId(),
                TemplateId: this.TemplateId(),
                TemplateName: this.TemplateName(),
                StartDate: this.StartDate(),
                IsUse: this.IsUse(),
                SortOrderNo: this.SortOrderNo(),
                InsertedDate: this.InsertedDate(),
                InsertedUserId: this.InsertedUserId(),
                UpdatedDate: this.UpdatedDate(),
                UpdatedUserId: this.UpdatedUserId(),
            };
        },

        fromJS: function(data) {
            if(data) {
                this.SiteId(data.SiteId);
                this.BusinessFieldId(data.BusinessFieldId);
                this.TemplateId(data.TemplateId);
                this.TemplateName(data.TemplateName);
                this.StartDate(data.StartDate);
                this.IsUse(data.IsUse);
                this.SortOrderNo(data.SortOrderNo);
                this.InsertedDate(data.InsertedDate);
                this.InsertedUserId(data.InsertedUserId);
                this.UpdatedDate(data.UpdatedDate);
                this.UpdatedUserId(data.UpdatedUserId);

            }
        }
    });
})();