コード例 #1
0
        private void userpref()
        {
            RateMastFTDAL objGrprepDAL = new RateMastFTDAL();
            tblUserPref   userpref     = objGrprepDAL.selectuserpref();

            iFromCity = Convert.ToInt32(userpref.BaseCity_Idno);
        }
コード例 #2
0
        protected void imgBtnExcel_Click(object sender, ImageClickEventArgs e)
        {
            RateMastFTDAL objRateMst = new RateMastFTDAL();
            DataTable     dt         = new DataTable();

            dt = objRateMst.SelectDBDataExport(Convert.ToInt64(ddlLorryType.SelectedValue), Convert.ToInt32(drpBaseCity.SelectedValue), ApplicationFunction.ConnectionString());
            Export(dt);
        }
コード例 #3
0
        protected void lnkbtnSave_Click(object sender, EventArgs e)
        {
            RateMastFT objRGH = new RateMastFT();

            objRGH.LorryTyp_idno = Convert.ToInt32(ddlLorryType.SelectedValue);
            objRGH.Loc_Idno      = Convert.ToInt32(drpBaseCity.SelectedValue);
            List <RateMastFT> RgDlst = new List <RateMastFT>();
            Int64             RateIdno = 0; bool isinsert = false;

            DtTemp = (DataTable)ViewState["dt"];
            if (DtTemp == null || DtTemp.Rows.Count <= 0)
            {
                ShowMessage("Please enter details");
                return;
            }
            RateMastFTDAL obj = new RateMastFTDAL();

            if (Convert.ToInt32(ddlLorryType.SelectedValue) <= 0)
            {
                ShowMessage("Please select Lorry Type"); ddlLorryType.Focus();
                return;
            }
            else
            {
                using (TransactionScope Tran = new TransactionScope(TransactionScopeOption.Required))
                {
                    int value = obj.Delete(Convert.ToInt32(ddlLorryType.SelectedValue), Convert.ToInt32(drpBaseCity.SelectedValue));
                    if (value > 0)
                    {
                        isinsert = obj.Insert(DtTemp, Convert.ToInt32(ddlDateRange.SelectedValue));
                        this.Clear();
                    }
                    else
                    {
                        ShowMessage("Record not saved successfully");
                    }

                    obj = null;
                    if (isinsert == true)
                    {
                        Tran.Complete();
                        ShowMessage("Record save successfully");
                        Clear();
                    }
                    else
                    {
                        Tran.Dispose();
                        ShowMessage("Record not saved successfully");
                    }
                }
            }
        }
コード例 #4
0
        private void BindLorryType()
        {
            RateMastFTDAL obj = new RateMastFTDAL();
            var           lst = obj.BindLorryType();

            obj = null;
            if (lst.Count > 0)
            {
                ddlLorryType.DataSource     = lst;
                ddlLorryType.DataTextField  = "Lorry_No";
                ddlLorryType.DataValueField = "Lorry_Idno";
                ddlLorryType.DataBind();
            }
            ddlLorryType.Items.Insert(0, new ListItem("--Select--", "0"));
        }
コード例 #5
0
        private void BindGridDB()
        {
            RateMastFTDAL objRateMstFT = new RateMastFTDAL();
            DataTable     dt1          = new DataTable();
            DataRow       Dr;

            DtTemp = CreateDt();
            dt1    = objRateMstFT.SelectDBData(Convert.ToInt64(ddlLorryType.SelectedValue), Convert.ToInt32(drpBaseCity.SelectedValue), ApplicationFunction.ConnectionString());

            if (dt1 != null && dt1.Rows.Count > 0)
            {
                for (int i = 0; i < dt1.Rows.Count; i++)
                {
                    Dr = DtTemp.NewRow();
                    Dr.BeginEdit();
                    Dr[0] = DtTemp.Rows.Count == 0 ? 1 : DtTemp.Rows.Count + 1;
                    Dr[1] = Convert.IsDBNull(dt1.Rows[i]["City_FIdno"]) ? "0" : Convert.ToString(dt1.Rows[i]["City_FIdno"]);
                    Dr[2] = Convert.IsDBNull(dt1.Rows[i]["City_FName"]) ? "0" : Convert.ToString(dt1.Rows[i]["City_FName"]);
                    Dr[3] = Convert.IsDBNull(dt1.Rows[i]["Lorry_Idno"]) ? "0" : Convert.ToString(dt1.Rows[i]["Lorry_Idno"]);
                    Dr[4] = Convert.IsDBNull(dt1.Rows[i]["Lorry_Type"]) ? "0" : Convert.ToString(dt1.Rows[i]["Lorry_Type"]);
                    Dr[5] = Convert.IsDBNull(dt1.Rows[i]["Rate_Date"]) ? "" : Convert.ToDateTime((dt1.Rows[i]["Rate_Date"])).ToString();
                    Dr[6] = Convert.IsDBNull(dt1.Rows[i]["ToCity_Idno"]) ? "0" : Convert.ToString(dt1.Rows[i]["ToCity_Idno"]);
                    Dr[7] = Convert.IsDBNull(dt1.Rows[i]["City_Name"]) ? "0" : Convert.ToString(dt1.Rows[i]["City_Name"]);
                    Dr[8] = Convert.IsDBNull(dt1.Rows[i]["Item_Rate"]) ? "0" : Convert.ToDouble(dt1.Rows[i]["Item_Rate"]).ToString("N2");

                    Dr.EndEdit();
                    DtTemp.Rows.Add(Dr);
                }

                ViewState["dt"]     = DtTemp;
                ViewState["newNdt"] = DtTemp;
                BindGrid();
                imgBtnExcel.Visible = true;
            }
            else
            {
                ViewState["dt"] = null;
                BindGrid();
                imgBtnExcel.Visible = false;
            }
        }