示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ddlVehicleType.SelectedIndex == -1 || txtModelName.Text == "" || txtLTRTOtherExp.Text == "" || txtMarginPrice.Text == "" || txt70Margin.Text == "" || txtModelCode.Text == "" || txtShowRoomPrice.Text == "" || txtOnRoadPrice.Text == "" || txt50Margin.Text == "" || txtInsurancePrice.Text == "" || txtWarranty.Text == "")
            {
                MyMessageBox.ShowBox("Please Enter All Mandatory Fields!!!");
                return;
            }
            VehicleInfoDTO info    = new VehicleInfoDTO();
            var            selItem = (ComboboxItem)ddlVehicleType.SelectedItem;

            info.VehicleInfoID   = _vehicleInfoID;
            info.VehicleTypeID   = Convert.ToInt32(selItem.Value);
            info.ModelCode       = txtModelCode.Text;
            info.ModelName       = txtModelName.Text;
            info.ExShowRoomPrice = Convert.ToInt32(txtShowRoomPrice.Text);
            info.LT_RT_OtherExp  = Convert.ToInt32(txtLTRTOtherExp.Text);
            info.InsurancePrice  = Convert.ToInt32(txtInsurancePrice.Text);
            info.OnRoadPrice     = Convert.ToInt32(txtOnRoadPrice.Text);
            info.MarginPrice     = Convert.ToInt32(txtMarginPrice.Text);
            info.Margin50        = Convert.ToInt32(txt50Margin.Text);
            info.Margin70        = Convert.ToInt32(txt70Margin.Text);
            info.CreatedDate     = System.DateTime.Now;
            info.CreatedBy       = GlobalSetup.Userid;
            info.ModifiedDate    = System.DateTime.Now;
            info.WarrantyPrice   = Convert.ToInt32(txtWarranty.Text);
            VehicleInfoBL viBL = new VehicleInfoBL();
            var           flag = viBL.SaveVehicleInfo(info, _mode);

            if (flag)
            {
                MyMessageBox.ShowBox("Vehicle Information Saved", "Vehicle Info");
                Clear();
            }
            else
            {
                MyMessageBox.ShowBox("Vehicle Information Failed to Save", "Vehicle Info");
            }
        }