protected void btnupdateTransportdetail_click(object sender, EventArgs e) { Dispatch dispatch = new Dispatch(); DispatchData dispatchdata = new DispatchData(); dispatch.TM_Id = string.IsNullOrEmpty(htransId.Value) ? 0 : Convert.ToInt32(htransId.Value); dispatch.VehicleNo = txtVehicleNo.Text; dispatch.VehicleBrand = string.IsNullOrEmpty(dpVehicleBrand.SelectedItem.Value.ToString()) ? 0 : Convert.ToInt32(dpVehicleBrand.SelectedItem.Value); dispatch.Veh_Model = string.IsNullOrEmpty(dpVeh_Model.SelectedItem.Value.ToString()) ? 0 : Convert.ToInt32(dpVeh_Model.SelectedItem.Value); dispatch.Veh_Year = txtVeh_Year.Text; dispatch.Veh_Type = string.IsNullOrEmpty(dpVeh_Type.SelectedItem.Text.ToString()) ? string.Empty : Convert.ToString(dpVeh_Type.SelectedItem.Text); dispatch.Veh_Reg = txtVeh_Reg.Text; dispatch.Veh_ChassisNo = txtVeh_ChassisNo.Text; dispatch.Veh_EngineNo = txtVeh_EngineNo.Text; dispatch.Veh_InsProvider = string.IsNullOrEmpty(dpVeh_InsProvider.SelectedItem.Text.ToString()) ? 0 : Convert.ToInt32(dpVeh_InsProvider.SelectedItem.Value); dispatch.Veh_InsPolicyNo = txtVeh_InsPolicyNo.Text; dispatch.Veh_InsStart = string.IsNullOrEmpty(txtVeh_InsStart.Text) ? string.Empty : (Convert.ToDateTime(txtVeh_InsStart.Text)).ToString("dd-MM-yyyy"); //------------------------------------ dispatch.Veh_InsLast = string.IsNullOrEmpty(txtVeh_InsLast.Text) ? string.Empty : (Convert.ToDateTime(txtVeh_InsLast.Text)).ToString("dd-MM-yyyy"); dispatch.Veh_InsAmount = string.IsNullOrEmpty(txtInsAmount.Text.ToString()) ? 0 : Convert.ToDouble(txtInsAmount.Text); dispatch.Veh_OwnershipType = string.IsNullOrEmpty(dpVeh_OwnershipType.SelectedItem.Text.ToString()) ? string.Empty : Convert.ToString(dpVeh_OwnershipType.SelectedItem.Text); dispatch.Veh_OwnerName = txtVeh_OwnerName.Text; dispatch.Veh_ContactNo = txtVeh_ContactNo.Text; //--------------------------------------------- dispatch.Veh_OwnerAddress = txtVeh_OwnerAddress.Text; dispatch.Veh_FuelType = string.IsNullOrEmpty(dpVeh_FuelType.SelectedItem.Text.ToString()) ? 0 : Convert.ToInt32(dpVeh_FuelType.SelectedItem.Value); dispatch.BankId = string.IsNullOrEmpty(dpBank.Text.ToString()) ? 0 : Convert.ToInt32(dpBank.SelectedItem.Value); dispatch.BankAc = string.IsNullOrEmpty(txtBankAc.Text.ToString()) ? string.Empty : Convert.ToString(txtBankAc.Text); if (dpIsActive.SelectedItem.Value == "1") { dispatch.IsActive = true; } if (dpIsActive.SelectedItem.Value == "2") { dispatch.IsActive = false; } dispatch.CreatedBy = GlobalInfo.Userid; dispatch.Createddate = DateTime.Now.ToString("dd-MM-yyyy"); if (dispatchdata.UpdateTransportInfo(dispatch)) { lblHeaderTab.Text = "Add Transport Details"; divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Transport Updated Successfully"; ClearTextBox(); bindTransportList(); pnlError.Update(); btnAddTransportInfo.Visible = true; btnupdateTransportdetail.Visible = false; upMain.Update(); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } }