(function() {
    BemsWebApplication.FmsMaterialTradeCompanyViewModel = function(data) {
            this.SiteId = ko.observable();
            this.TradeCompanyId = ko.observable();
            this.Name = ko.observable();
            this.RegistrationNo = ko.observable();
            this.RepresentativeName = ko.observable();
            this.PhoneNo = ko.observable();
            this.FaxNo = ko.observable();
            this.SalesName = ko.observable();
            this.SalesPhoneNo = ko.observable();
            this.AddressZip1 = ko.observable();
            this.AddressZip2 = ko.observable();
            this.Address1 = ko.observable();
            this.Adderss2 = ko.observable();
            this.HomepageUri = ko.observable();
            this.Note = ko.observable();
            this.IsUse = ko.observable();
            if(data)
                this.fromJS(data);
    };

    $.extend(BemsWebApplication.FmsMaterialTradeCompanyViewModel.prototype, {
        toJS: function() {
            return {
                SiteId: this.SiteId(),
                TradeCompanyId: this.TradeCompanyId(),
                Name: this.Name(),
                RegistrationNo: this.RegistrationNo(),
                RepresentativeName: this.RepresentativeName(),
                PhoneNo: this.PhoneNo(),
                FaxNo: this.FaxNo(),
                SalesName: this.SalesName(),
                SalesPhoneNo: this.SalesPhoneNo(),
                AddressZip1: this.AddressZip1(),
                AddressZip2: this.AddressZip2(),
                Address1: this.Address1(),
                Adderss2: this.Adderss2(),
                HomepageUri: this.HomepageUri(),
                Note: this.Note(),
                IsUse: this.IsUse(),
            };
        },

        fromJS: function(data) {
            if(data) {
                this.SiteId(data.SiteId);
                this.TradeCompanyId(data.TradeCompanyId);
                this.Name(data.Name);
                this.RegistrationNo(data.RegistrationNo);
                this.RepresentativeName(data.RepresentativeName);
                this.PhoneNo(data.PhoneNo);
                this.FaxNo(data.FaxNo);
                this.SalesName(data.SalesName);
                this.SalesPhoneNo(data.SalesPhoneNo);
                this.AddressZip1(data.AddressZip1);
                this.AddressZip2(data.AddressZip2);
                this.Address1(data.Address1);
                this.Adderss2(data.Adderss2);
                this.HomepageUri(data.HomepageUri);
                this.Note(data.Note);
                this.IsUse(data.IsUse);

            }
        }
    });
})();