コード例 #1
0
ファイル: FuelPumpMaster.aspx.cs プロジェクト: amolsm/Nanjil2
        public void GetTransportOperationInfoByID(int Tr_FuelID)
        {
            transportdata = new TransportData();
            DS            = transportdata.GetFuelPumpDetailsInfoByID(Tr_FuelID);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                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;
                }


                //txtBata.Text = string.IsNullOrEmpty((Convert.ToDecimal(DS.Tables[0].Rows[0]["Bata"]).ToString("#.##"))) ? string.Empty : (Convert.ToDecimal(DS.Tables[0].Rows[0]["Bata"]).ToString("#.##"));

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


                dproute.ClearSelection();
                if (dproute.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["routeId"]).ToString()) != null)
                {
                    dproute.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["routeId"]).ToString()).Selected = true;
                }
                dpfuelcompany.ClearSelection();
                if (dpfuelcompany.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["FuelCompanyId"]).ToString()) != null)
                {
                    dpfuelcompany.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["FuelCompanyId"]).ToString()).Selected = true;
                }
                txtfuelpumpname.Text   = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["fuelpumpname"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["fuelpumpname"].ToString();
                txtpumpaddress.Text    = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["pumpaddress"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["pumpaddress"].ToString();
                txtregistrationno.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["registrationno"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["registrationno"].ToString();
                txtcontractamt.Text    = string.IsNullOrEmpty((Convert.ToDecimal(DS.Tables[0].Rows[0]["contractamt"]).ToString("#.##"))) ? string.Empty : (Convert.ToDecimal(DS.Tables[0].Rows[0]["contractamt"]).ToString("#.##"));
            }
        }