(function() {
    BemsWebApplication.FmsWorkOperationItemViewModel = function(data) {
            this.SiteId = ko.observable();
            this.FacilityCode = ko.observable();
            this.CheckDateTime = ko.observable();
            this.ItemId = ko.observable();
            this.ItemName = ko.observable();
            this.ItemResult = ko.observable();
            this.ResultUnit = 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.FmsWorkOperationItemViewModel.prototype, {
        toJS: function() {
            return {
                SiteId: this.SiteId(),
                FacilityCode: this.FacilityCode(),
                CheckDateTime: this.CheckDateTime(),
                ItemId: this.ItemId(),
                ItemName: this.ItemName(),
                ItemResult: this.ItemResult(),
                ResultUnit: this.ResultUnit(),
                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.FacilityCode(data.FacilityCode);
                this.CheckDateTime(data.CheckDateTime);
                this.ItemId(data.ItemId);
                this.ItemName(data.ItemName);
                this.ItemResult(data.ItemResult);
                this.ResultUnit(data.ResultUnit);
                this.SortOrderNo(data.SortOrderNo);
                this.InsertedDate(data.InsertedDate);
                this.InsertedUserId(data.InsertedUserId);
                this.UpdatedDate(data.UpdatedDate);
                this.UpdatedUserId(data.UpdatedUserId);

            }
        }
    });
})();