예제 #1
0
        private void TotalRecords()
        {
            using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString()))
            {
                Int32  iyearidno = (Convert.ToString(ddlDateRange.SelectedValue) == "" ? 0 : Convert.ToInt32(ddlDateRange.SelectedValue));
                string UserClass = Convert.ToString(Session["Userclass"]);
                Int64  UserIdno  = 0;
                if (UserClass != "Admin")
                {
                    UserIdno = Convert.ToInt64(Session["UserIdno"]);
                }

                PendGrForInvDAL obj   = new PendGrForInvDAL();
                DataTable       list1 = obj.selectGrDetails("SelectGRWithoutChallan", Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), 0, 0, iyearidno, UserIdno, 0, ApplicationFunction.ConnectionString());
                lblTotalRecord.Text = "T. Record (s): " + Convert.ToString(list1.Rows.Count);
            }
        }
예제 #2
0
        private void BindGrid()
        {
            try
            {
                PendGrForInvDAL obj           = new PendGrForInvDAL();
                DataTable       DsGrdetail    = null;
                Int64           iFromCityIDNO = (Convert.ToString(drpBaseCity.SelectedValue) == "" ? 0 : Convert.ToInt64(drpBaseCity.SelectedValue));
                Int64           iSenderIDNO   = (Convert.ToString(drpSenderName.SelectedValue) == "" ? 0 : Convert.ToInt64(drpSenderName.SelectedValue));
                Int32           iyearidno     = (Convert.ToString(ddlDateRange.SelectedValue) == "" ? 0 : Convert.ToInt32(ddlDateRange.SelectedValue));
                Int64           intgrno       = (Convert.ToString(txtInvoiceNo.Text) == "" ? 0 : Convert.ToInt32(txtInvoiceNo.Text));
                string          userclass     = Convert.ToString(Session["Userclass"]);
                Int64           UserIdno      = 0;
                if (userclass != "Admin")
                {
                    UserIdno = Convert.ToInt64(Session["UserIdno"]);
                }
                if (ddlType.SelectedValue == "2")
                {
                    DsGrdetail = obj.selectGrDetails("SelectRep", Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), iFromCityIDNO, iSenderIDNO, iyearidno, UserIdno, intgrno, ApplicationFunction.ConnectionString());
                }
                else
                {
                    DsGrdetail = obj.selectGrDetails("SelectGRWithoutChallan", Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), iFromCityIDNO, iSenderIDNO, iyearidno, UserIdno, intgrno, ApplicationFunction.ConnectionString());
                }
                if ((DsGrdetail != null) && (DsGrdetail.Rows.Count > 0))
                {
                    ViewState["dtCSV"] = DsGrdetail;
                    grdMain.DataSource = DsGrdetail;
                    grdMain.DataBind();

                    Double TotalNetAmount = 0, Total_Amnt = 0;

                    for (int i = 0; i < DsGrdetail.Rows.Count; i++)
                    {
                        Total_Amnt     += Convert.ToDouble(DsGrdetail.Rows[i]["Total_Amnt"]);
                        TotalNetAmount += Convert.ToDouble(DsGrdetail.Rows[i]["Net_Amnt"]);
                    }
                    lblNetTotalAmount.Text = TotalNetAmount.ToString("N2");
                    lblTotAmnt.Text        = Total_Amnt.ToString("N2");
                    int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                    int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;
                    lblcontant.Text    = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + DsGrdetail.Rows.Count.ToString();
                    lblcontant.Visible = true;
                    divpaging.Visible  = true;

                    imgBtnExcel.Visible = true;
                    lblTotalRecord.Text = "T. Record (s): " + Convert.ToString(DsGrdetail.Rows.Count);
                }
                else
                {
                    ViewState["dtCSV"] = null;
                    grdMain.DataSource = null;
                    grdMain.DataBind();
                    lblcontant.Visible  = false;
                    divpaging.Visible   = false;
                    imgBtnExcel.Visible = false;
                }
            }
            catch (Exception Ex)
            {
                throw (Ex);
            }
        }