private void TotalRecords() { using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString())) { string UserClass = Convert.ToString(Session["Userclass"]); Int64 UserIdno = 0; if (UserClass != "Admin") { UserIdno = Convert.ToInt64(Session["UserIdno"]); } Int64 iREcvrIDNO = (ddlRecvr.SelectedIndex <= 0 ? 0 : Convert.ToInt64(ddlRecvr.SelectedValue)); Int64 iSenderIDNO = (ddlSender.SelectedIndex <= 0 ? 0 : Convert.ToInt64(ddlSender.SelectedValue)); Int64 iDElvryIDNO = (ddlDelvPlce.SelectedIndex <= 0 ? 0 : Convert.ToInt64(ddlDelvPlce.SelectedValue)); Int32 iGRTypIDNO = (ddlGRType.SelectedIndex <= 0 ? 0 : Convert.ToInt32(ddlGRType.SelectedValue)); Int64 iFromCityIDNO = (drpBaseCity.SelectedIndex <= 0 ? 0 : Convert.ToInt64(drpBaseCity.SelectedValue)); GRRepDAL obj = new GRRepDAL(); DataTable list1 = obj.SelectRep("SelectRep", Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), iREcvrIDNO, iSenderIDNO, iFromCityIDNO, iDElvryIDNO, iGRTypIDNO, UserIdno, conString); lblTotalRecord.Text = "T. Record (s): " + Convert.ToString(list1.Rows.Count); } }
private void BindGrid() { GRRepDAL obj = new GRRepDAL(); Int64 iREcvrIDNO = (ddlRecvr.SelectedIndex <= 0 ? 0 : Convert.ToInt64(ddlRecvr.SelectedValue)); Int64 iSenderIDNO = (ddlSender.SelectedIndex <= 0 ? 0 : Convert.ToInt64(ddlSender.SelectedValue)); Int64 iDElvryIDNO = (ddlDelvPlce.SelectedIndex <= 0 ? 0 : Convert.ToInt64(ddlDelvPlce.SelectedValue)); Int32 iGRTypIDNO = (ddlGRType.SelectedIndex <= 0 ? 0 : Convert.ToInt32(ddlGRType.SelectedValue)); Int64 iFromCityIDNO = (drpBaseCity.SelectedIndex <= 0 ? 0 : Convert.ToInt64(drpBaseCity.SelectedValue)); string strreporttypr = ""; if (ddlreporttype.SelectedValue == "1") { strreporttypr = "SelectRep"; } else { strreporttypr = "SelectRepItemWise"; } string UserClass = Convert.ToString(Session["Userclass"]); Int64 UserIdno = 0; if (UserClass != "Admin") { UserIdno = Convert.ToInt64(Session["UserIdno"]); } DataTable list = obj.SelectRep(strreporttypr, Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), iREcvrIDNO, iSenderIDNO, iFromCityIDNO, iDElvryIDNO, iGRTypIDNO, UserIdno, conString); if ((list != null) && (list.Rows.Count > 0)) { ViewState["CSVdt"] = list; grdMain.DataSource = list; grdMain.DataBind(); Double TotalNetAmount = 0, TotGrossAmnt = 0, TotSurcharge = 0, TotWages = 0, TotServTax = 0; for (int i = 0; i < list.Rows.Count; i++) { TotGrossAmnt += Convert.ToDouble(list.Rows[i]["Gross_Amnt"]); TotSurcharge += Convert.ToDouble(list.Rows[i]["Surcrg_Amnt"]); TotWages += Convert.ToDouble(list.Rows[i]["Wages_Amnt"]); TotServTax += Convert.ToDouble(list.Rows[i]["ServTax_Amnt"]); TotalNetAmount += Convert.ToDouble(list.Rows[i]["Net_Amnt"]); } lblGrossAmnt.Text = TotGrossAmnt.ToString("N2"); lblSurcharge.Text = TotSurcharge.ToString("N2"); lblWages.Text = TotWages.ToString("N2"); lblServtax.Text = TotServTax.ToString("N2"); lblNetTotalAmount.Text = TotalNetAmount.ToString("N2"); int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1; int lastRowOnPage = startRowOnPage + grdMain.Rows.Count - 1; lblcontant.Text = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + list.Rows.Count.ToString(); lblcontant.Visible = true; imgBtnExcel.Visible = true; divpaging.Visible = true; lblTotalRecord.Text = "T. Record (s): " + list.Rows.Count; if (ddlreporttype.SelectedValue == "1") { grdMain.Columns[7].Visible = false; grdMain.Columns[8].Visible = false; //grdMain.Columns[9].Visible = false; grdMain.Columns[10].Visible = false; grdMain.Columns[11].Visible = false; grdMain.Columns[12].Visible = false; grdMain.Columns[13].Visible = false; } else { grdMain.Columns[7].Visible = true; grdMain.Columns[8].Visible = true; //grdMain.Columns[9].Visible = true; grdMain.Columns[10].Visible = true; grdMain.Columns[11].Visible = true; grdMain.Columns[12].Visible = true; grdMain.Columns[13].Visible = true; } } else { grdMain.DataSource = null; grdMain.DataBind(); imgBtnExcel.Visible = false; lblTotalRecord.Text = "T. Record (s): 0 "; lblcontant.Visible = false; divpaging.Visible = false; } }