private void BindPartyName() { LorryMasterRepDAL obj = new LorryMasterRepDAL(); var PartyName = obj.SelectPartyName(); ddlPartyName.DataSource = PartyName; ddlPartyName.DataTextField = "Acnt_Name"; ddlPartyName.DataValueField = "Acnt_Idno"; ddlPartyName.DataBind(); objLorryDAL = null; ddlPartyName.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); }
private void TotalRecords() { using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString())) { Int32 iPanNoIDNO = (Convert.ToString(ddlPanNo.SelectedValue) == "" ? 0 : Convert.ToInt32(ddlPanNo.SelectedValue)); string UserClass = Convert.ToString(Session["Userclass"]); Int64 UserIdno = 0; if (UserClass != "Admin") { UserIdno = Convert.ToInt64(Session["UserIdno"]); } LorryMasterRepDAL obj = new LorryMasterRepDAL(); DataTable list1 = obj.SelectForSearch(-1, "", 0, 0, txtPanNumber.Text.Trim(), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), conString); lblTotalRecord.Text = "T. Record (s): " + Convert.ToString(list1.Rows.Count); } }
private void BindGrid() { try { LorryMasterRepDAL obj = new LorryMasterRepDAL(); Int32 iLorryTypeIDNO = (Convert.ToString(ddlLorryType.SelectedValue) == "" ? 0 : Convert.ToInt32(ddlLorryType.SelectedValue)); Int32 iPanNoIDNO = (Convert.ToString(ddlPanNo.SelectedValue) == "" ? 0 : Convert.ToInt32(ddlPanNo.SelectedValue)); Int32 iPartyIdno = (Convert.ToString(ddlPartyName.SelectedValue) == "" ? 0 : Convert.ToInt32(ddlPartyName.SelectedValue)); string iLorryNo = (Convert.ToString(txtLorryNo.Text) == "" ? "" : Convert.ToString(txtLorryNo.Text)); DataTable DsGrdetail = obj.SelectForSearch(iLorryTypeIDNO, Convert.ToString(iLorryNo), iPanNoIDNO, iPartyIdno, txtPanNumber.Text.Trim(), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), conString); if (DsGrdetail != null && DsGrdetail.Rows.Count > 0) { ViewState["CSV"] = DsGrdetail; grdMain.DataSource = DsGrdetail; grdMain.DataBind(); lblTotalRecord.Text = "T. Record (s): " + DsGrdetail.Rows.Count.ToString(); imgBtnExcel.Visible = true; 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; } else { lblcontant.Visible = false; divpaging.Visible = false; grdMain.DataSource = null; grdMain.DataBind(); lblTotalRecord.Text = "T. Record (s): 0 "; imgBtnExcel.Visible = false; } } catch (Exception Ex) { throw (Ex); } }
private void BindGrid() { bool error = false; iLorry_Id = Convert.ToInt32((hidLorryIdno.Value == null || hidLorryIdno.Value == "") ? "0" : hidLorryIdno.Value); iYear_Id = Convert.ToInt32(ddlDateRange.SelectedValue == null ? "0" : ddlDateRange.SelectedValue); strDateFrom = txtDatefrom.Text; strDateTo = txtDateto.Text; //Validate Form Fields if (iYear_Id == 0) { InfoMessage = "Year cannot be null."; ddlDateRange.Focus(); error = true; return; } else if (strDateFrom == "") { InfoMessage = "From date cannot be blank."; txtDatefrom.Focus(); error = true; return; } else if (strDateTo == "") { InfoMessage = "To date cannot be blank."; txtDateto.Focus(); error = true; return; } else if (iLorry_Id == 0) { InfoMessage = "Please choose a lorry number."; txtLorryNo.Focus(); error = true; return; } if (error) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "PassMessageError('" + Convert.ToString(InfoMessage) + "')", true); } ////////////////////// else { try { LorryMasterRepDAL obj = new LorryMasterRepDAL(); string iLorryNo = (Convert.ToString(txtLorryNo.Text) == "" ? "" : Convert.ToString(txtLorryNo.Text)); DataTable DsGrdetail = obj.SelectLorrySummary(iLorry_Id, iYear_Id, strDateFrom, strDateTo, conString); lblOwnerName.Text = DsGrdetail.Rows[0]["Owner Name"].ToString(); lblDriverName.Text = DsGrdetail.Rows[0]["Driver Name"].ToString(); //DataTable DsGrdetail = obj.SelectForSearch('', conString); if (DsGrdetail != null && DsGrdetail.Rows.Count > 0) { ViewState["CSV"] = DsGrdetail; grdReport.DataSource = DsGrdetail; grdReport.DataBind(); lblTotalRecord.Text = DsGrdetail.Rows.Count.ToString(); imgBtnExcel.Visible = true; int startRowOnPage = (grdReport.PageIndex * grdReport.PageSize) + 1; int lastRowOnPage = startRowOnPage + grdReport.Rows.Count - 1; lblcontant.Text = startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + DsGrdetail.Rows.Count.ToString(); lblcontant.Visible = true; divpaging.Visible = true; } else { lblcontant.Visible = false; divpaging.Visible = false; grdReport.DataSource = null; grdReport.DataBind(); lblTotalRecord.Text = "0"; imgBtnExcel.Visible = false; } } catch (Exception Ex) { throw (Ex); } } }