示例#1
0
        public void GetTransportDatabyId(int TM_Id)
        {
            DataSet      DS        = new DataSet();
            DispatchData transdata = new DispatchData();

            DS = transdata.GetTransportDatabyId(TM_Id);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                txtVehicleNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["VehicleNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["VehicleNo"].ToString();
                dpVehicleBrand.ClearSelection();
                if (dpVehicleBrand.Items.FindByValue(DS.Tables[0].Rows[0]["VehicleBrand"].ToString()) != null)
                {
                    dpVehicleBrand.Items.FindByValue(DS.Tables[0].Rows[0]["VehicleBrand"].ToString()).Selected = true;
                }
                dpVeh_Model.ClearSelection();
                if (dpVeh_Model.Items.FindByValue(DS.Tables[0].Rows[0]["Veh_Model"].ToString()) != null)
                {
                    dpVeh_Model.Items.FindByValue(DS.Tables[0].Rows[0]["Veh_Model"].ToString()).Selected = true;
                }

                txtVeh_Year.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_Year"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_Year"].ToString();
                dpVeh_Type.ClearSelection();
                if (dpVeh_Type.Items.FindByText(DS.Tables[0].Rows[0]["Veh_Type"].ToString()) != null)
                {
                    dpVeh_Type.Items.FindByText(DS.Tables[0].Rows[0]["Veh_Type"].ToString()).Selected = true;
                }
                txtVeh_Reg.Text       = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_Reg"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_Reg"].ToString();
                txtVeh_ChassisNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_ChassisNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_ChassisNo"].ToString();
                txtVeh_EngineNo.Text  = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_EngineNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_EngineNo"].ToString();
                dpVeh_InsProvider.ClearSelection();
                if (dpVeh_InsProvider.Items.FindByValue(DS.Tables[0].Rows[0]["Veh_InsProvider"].ToString()) != null)
                {
                    dpVeh_InsProvider.Items.FindByValue(DS.Tables[0].Rows[0]["Veh_InsProvider"].ToString()).Selected = true;
                }

                txtVeh_InsPolicyNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_InsPolicyNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_InsPolicyNo"].ToString();


                if (DS.Tables[0].Rows[0]["Veh_InsStart"].ToString() == "")
                {
                    txtVeh_InsStart.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_InsStart"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_InsStart"].ToString();
                }
                else
                {
                    string insDue = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_InsStart"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_InsStart"].ToString();
                    //sky
                    DateTime insDue1 = Convert.ToDateTime(insDue, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat);
                    txtVeh_InsStart.Text = (Convert.ToDateTime(insDue1).ToString("yyyy-MM-dd"));
                }

                if (DS.Tables[0].Rows[0]["Veh_InsLast"].ToString() == "")
                {
                    txtVeh_InsLast.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_InsLast"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_InsLast"].ToString();
                }
                else
                {
                    string   insDue2 = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_InsLast"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_InsLast"].ToString();
                    DateTime ins2    = Convert.ToDateTime(insDue2, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat);
                    txtVeh_InsLast.Text = (Convert.ToDateTime(ins2).ToString("yyyy-MM-dd"));
                }
                txtInsAmount.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["InsAmount"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["InsAmount"].ToString();
                dpVeh_OwnershipType.ClearSelection();
                if (dpVeh_OwnershipType.Items.FindByText(DS.Tables[0].Rows[0]["Veh_OwnershipType"].ToString()) != null)
                {
                    dpVeh_OwnershipType.Items.FindByText(DS.Tables[0].Rows[0]["Veh_OwnershipType"].ToString()).Selected = true;
                }

                txtVeh_OwnerName.Text    = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_OwnerName"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_OwnerName"].ToString();
                txtVeh_ContactNo.Text    = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_ContactNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_ContactNo"].ToString();
                txtVeh_OwnerAddress.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Veh_OwnerAddress"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Veh_OwnerAddress"].ToString();
                dpVeh_FuelType.ClearSelection();
                if (dpVeh_FuelType.Items.FindByValue(DS.Tables[0].Rows[0]["Veh_FuelType"].ToString()) != null)
                {
                    dpVeh_FuelType.Items.FindByValue(DS.Tables[0].Rows[0]["Veh_FuelType"].ToString()).Selected = true;
                }
                dpBank.ClearSelection();
                if (dpBank.Items.FindByValue(DS.Tables[0].Rows[0]["BankId"].ToString()) != null)
                {
                    dpBank.Items.FindByValue(DS.Tables[0].Rows[0]["BankId"].ToString()).Selected = true;
                }
                txtBankAc.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["BankAc"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["BankAc"].ToString();

                dpIsActive.ClearSelection();
                if (DS.Tables[0].Rows[0]["IsActive"].ToString() == "True")
                {
                    dpIsActive.Items.FindByValue("1").Selected = true;
                }
                if (DS.Tables[0].Rows[0]["IsActive"].ToString() == "False")
                {
                    dpIsActive.Items.FindByValue("2").Selected = true;
                }
            }
        }