/* New Form with selected Mode */
 public AddWarehouseInformation(models.WarehouseInformationModel model)
 {
     this.model = model;
     InitializeComponent();
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            model.catGl    = (checkGeneral.Checked) ? "1" : "0";
            model.catBon   = (checkBonded.Checked) ? "1" : "0";
            model.catExp   = (checkEXPLOSIVES.Checked) ? "1" : "0";
            model.catFrz   = (checkFreeze.Checked) ? "1" : "0";
            model.catRefri = (checkPefrigeration.Checked) ? "1" : "0";
            model.catHeav  = (checkHeaveis.Checked) ? "1" : "0";
            model.catX     = (checkOther.Checked) ? "1" : "0";

            if (model == null)                                                   // add Industrial mode
            {
                model                = new models.WarehouseInformationModel();   //new model to assign data
                model.memberCode     = comboMemberCode.SelectedValue.ToString(); // set province id
                model.provinceCode   = comboProvince.SelectedValue.ToString();   //set english name
                model.industrialCode = comboIndustrial.SelectedValue.ToString(); // set thai name
                model.usageType      = comboUsage.SelectedValue.ToString();      // set japan name
                model.lat            = txtLocationLat.Text.Trim();               // set search name
                model.lng            = txtLocationLng.Text.Trim();               // set province id
                model.catGl          = checkGeneral.Text;                        //set english name
                model.catBon         = checkBonded.Text;                         // set thai name
                model.catExp         = checkEXPLOSIVES.Text;                     // set japan name
                model.catFrz         = checkFreeze.Text;                         // set search name
                model.catRefri       = checkPefrigeration.Text;
                model.catHeav        = checkHeaveis.Text;                        // set search name
                model.catX           = checkOther.Text;
                model.nameEn         = txtLocationLat.Text.Trim();               // set search name
                model.nameTh         = txtLocationLng.Text.Trim();               // set province id
                model.nameJp         = txtLocationLat.Text.Trim();               // set search name
                model.addr           = txtLocationLng.Text.Trim();               // set province id
                model.tel            = txtLocationLat.Text.Trim();               // set search name
                model.contactEn      = txtLocationLng.Text.Trim();               // set province id
                model.contactTh      = txtLocationLat.Text.Trim();               // set search name
                model.contactJp      = txtLocationLng.Text.Trim();               // set province id
                model.desEn          = txtLocationLat.Text.Trim();               // set search name
                model.desTh          = txtLocationLng.Text.Trim();               // set province id
                model.desJp          = txtLocationLat.Text.Trim();               // set search name
                model.regDate        = txtLocationLng.Text.Trim();               // set province id
                model.activeDate     = txtLocationLat.Text.Trim();               // set search name
                model.InActiveDate   = txtLocationLng.Text.Trim();               // set province id
                WarehouseInformationController.InsertData(model);                // call update method
            }
            else // update (edit) Industrial mode
            {
                model                = new models.WarehouseInformationModel();   //new model to assign data
                model.memberCode     = comboMemberCode.SelectedValue.ToString(); // set province id
                model.provinceCode   = comboProvince.SelectedValue.ToString();   //set english name
                model.industrialCode = comboIndustrial.SelectedValue.ToString(); // set thai name
                model.usageType      = comboUsage.SelectedValue.ToString();      // set japan name
                model.lat            = txtLocationLat.Text.Trim();               // set search name
                model.lng            = txtLocationLng.Text.Trim();               // set province id
                model.catGl          = checkGeneral.Text;                        //set english name
                model.catBon         = checkBonded.Text;                         // set thai name
                model.catExp         = checkEXPLOSIVES.Text;                     // set japan name
                model.catFrz         = checkFreeze.Text;                         // set search name
                model.catRefri       = checkPefrigeration.Text;
                model.catHeav        = checkHeaveis.Text;                        // set search name
                model.catX           = checkOther.Text;
                model.nameEn         = txtLocationLat.Text.Trim();               // set search name
                model.nameTh         = txtLocationLng.Text.Trim();               // set province id
                model.nameJp         = txtLocationLat.Text.Trim();               // set search name
                model.addr           = txtLocationLng.Text.Trim();               // set province id
                model.tel            = txtLocationLat.Text.Trim();               // set search name
                model.contactEn      = txtLocationLng.Text.Trim();               // set province id
                model.contactTh      = txtLocationLat.Text.Trim();               // set search name
                model.contactJp      = txtLocationLng.Text.Trim();               // set province id
                model.desEn          = txtLocationLat.Text.Trim();               // set search name
                model.desTh          = txtLocationLng.Text.Trim();               // set province id
                model.desJp          = txtLocationLat.Text.Trim();               // set search name
                model.regDate        = txtLocationLng.Text.Trim();               // set province id
                model.activeDate     = txtLocationLat.Text.Trim();               // set search name
                model.InActiveDate   = txtLocationLng.Text.Trim();               // set province id
                WarehouseInformationController.UpdateData(model);                // call update method
            }
        }
 public static void UpdateData(models.WarehouseInformationModel model)
 {
     //show message box when cannot insert data
     MessageBox.Show((models.WarehouseInformationModel.updateWarehouseInformation(model)) ? "Insert Success" :
                     "Insert Failed, Please Check parameter or something");
 }