Пример #1
0
        protected void btnAddTransportInfo_click(object sender, EventArgs e)
        {
            dispatchdata               = new DispatchData();
            dispatch                   = new Dispatch();
            dispatch.TM_Id             = 0;
            dispatch.VehicleNo         = string.IsNullOrEmpty(txtVehicleNo.Text.ToString()) ? string.Empty : Convert.ToString(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          = string.IsNullOrEmpty(txtVeh_Year.Text.ToString()) ? string.Empty : Convert.ToString(txtVeh_Year.Text);
            dispatch.Veh_Type          = string.IsNullOrEmpty(dpVeh_Type.SelectedItem.Text.ToString()) ? string.Empty : Convert.ToString(dpVeh_Type.SelectedItem.Text);
            dispatch.Veh_Reg           = string.IsNullOrEmpty(txtVeh_Reg.Text.ToString()) ? string.Empty : Convert.ToString(txtVeh_Reg.Text);
            dispatch.Veh_ChassisNo     = string.IsNullOrEmpty(txtVeh_ChassisNo.Text.ToString()) ? string.Empty : Convert.ToString(txtVeh_ChassisNo.Text);
            dispatch.Veh_EngineNo      = string.IsNullOrEmpty(txtVeh_EngineNo.Text.ToString()) ? string.Empty : Convert.ToString(txtVeh_EngineNo.Text);
            dispatch.Veh_InsProvider   = string.IsNullOrEmpty(dpVeh_InsProvider.SelectedItem.Text.ToString()) ? 0 : Convert.ToInt32(dpVeh_InsProvider.SelectedItem.Value);
            dispatch.Veh_InsPolicyNo   = string.IsNullOrEmpty(txtVeh_InsPolicyNo.Text.ToString()) ? string.Empty : Convert.ToString(txtVeh_InsPolicyNo.Text);
            dispatch.Veh_InsStart      = string.IsNullOrEmpty(txtVeh_InsStart.Text.ToString()) ? string.Empty : (Convert.ToDateTime(txtVeh_InsStart.Text)).ToString("dd-MM-yyyy");
            dispatch.Veh_InsLast       = string.IsNullOrEmpty(txtVeh_InsLast.Text.ToString()) ? 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.Text.ToString()) ? string.Empty : Convert.ToString(dpVeh_OwnershipType.SelectedItem.Text);
            dispatch.Veh_OwnerName     = string.IsNullOrEmpty(txtVeh_OwnerName.Text.ToString()) ? string.Empty : Convert.ToString(txtVeh_OwnerName.Text);
            dispatch.Veh_ContactNo     = string.IsNullOrEmpty(txtVeh_ContactNo.Text.ToString()) ? string.Empty : Convert.ToString(txtVeh_ContactNo.Text);
            dispatch.Veh_OwnerAddress  = string.IsNullOrEmpty(txtVeh_OwnerAddress.Text.ToString()) ? string.Empty : Convert.ToString(txtVeh_OwnerAddress.Text);
            dispatch.Veh_FuelType      = string.IsNullOrEmpty(dpVeh_FuelType.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);
            dispatch.CreatedBy         = GlobalInfo.Userid;
            dispatch.Createddate       = DateTime.Now.ToString("dd-MM-yyyy");
            if (dpIsActive.SelectedItem.Value == "1")
            {
                dispatch.IsActive = true;
            }
            if (dpIsActive.SelectedItem.Value == "2")
            {
                dispatch.IsActive = false;
            }

            int Result = 0;

            Result = dispatchdata.AddTransportInfo(dispatch);
            if (Result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Transport Information Add  Successfully";

                ClearTextBox();
                GetTransportDetails();
                pnlError.Update();
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }