/// <summary> /// BindDataGrid :Method used to bind grod /// </summary> public void BindDataGrid() { dailySalesReport.StartDate = ViewState["StartDate"].ToString(); dailySalesReport.EndDate = ViewState["EndDate"].ToString(); lblPeriod.Text = "Period : " + Convert.ToDateTime(dailySalesReport.StartDate).ToShortDateString() + " to " + Convert.ToDateTime(dailySalesReport.EndDate).ToShortDateString(); sortExpression = ((hidSort.Value != "") ? hidSort.Value : "SalesPerson asc"); if (Request.QueryString["BranchID"].ToString() == "ALL" && !IsPostBack) { dtSalesAnalysis = dailySalesReport.GetSalesToDatetable(noneBranchID); ViewState["ALLMode"] = true; } else dtSalesAnalysis = dailySalesReport.GetSalesToDatetable(ddlBranch.SelectedValue); dtSalesAnalysis.DefaultView.Sort = sortExpression; if (dtSalesAnalysis.Rows.Count == 0) { DataRow drow = dtSalesAnalysis.NewRow(); dtSalesAnalysis.Rows.Add(drow); status = true; } dvDailySales.DataSource = dtSalesAnalysis.DefaultView.ToTable(); dtTotal = dtSalesAnalysis.DefaultView.ToTable(); GetTotal(); dvPager.InitPager(dvDailySales, pagesize); if (dtSalesAnalysis != null && dtSalesAnalysis.Rows.Count > 1) { divPager.Style.Add("display",""); lblStatus.Visible = false; } else { divPager.Style.Add("display","none"); lblStatus.Visible =((bool)ViewState["ALLMode"])? false: status; lblStatus.Text = "No Records Found"; if (!(cldEndDt.SelectedDate.CompareTo(cldStartDt.SelectedDate) == 1 || cldEndDt.SelectedDate.CompareTo(cldStartDt.SelectedDate) == 0)) lblStatus.Text = "Invalid Date Range"; } pnlBranch.Update(); pnlProgress.Update(); upnlGrid.Update(); if (hidShowMode.Value == "Show") ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ShoW", "ShowPanel();", true); else if (hidShowMode.Value == "ShowL") ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ShoWL", "ShowHide('Show');", true); else if (hidShowMode.Value == "HideL") ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ShoWL", "ShowHide('Hide');", true); }
/// <summary> /// BindDataGrid :Used to bind data grid view /// </summary> public void BindDataGrid() { bool status = false; dailySalesReport.StartDate = Request.QueryString["StartDate"].ToString(); dailySalesReport.EndDate = Request.QueryString["EndDate"].ToString(); sortExpression = ((Request.QueryString["Sort"] != null) ? Request.QueryString["Sort"].ToString() : "SalesPerson asc"); dtSalesAnalysis = dailySalesReport.GetSalesToDatetable(Request.QueryString["Branch"].ToString()); dtSalesAnalysis.DefaultView.Sort = sortExpression; if (dtSalesAnalysis.Rows.Count == 0) { DataRow drow = dtSalesAnalysis.NewRow(); dtSalesAnalysis.Rows.Add(drow); status = true; } dvDailySales.DataSource = dtSalesAnalysis.DefaultView.ToTable(); dtTotal = dtSalesAnalysis.DefaultView.ToTable(); GetTotal(); dvDailySales.DataBind(); if (dtSalesAnalysis != null && dtSalesAnalysis.Rows.Count > 1) { lblStatus.Visible = false; } else { lblStatus.Visible = status; lblStatus.Text = "No Records Found"; if (!(Convert.ToDateTime(dailySalesReport.EndDate).CompareTo(Convert.ToDateTime(dailySalesReport.StartDate)) == 1 || Convert.ToDateTime(dailySalesReport.EndDate).CompareTo(Convert.ToDateTime(dailySalesReport.StartDate)) == 0)) lblStatus.Text = "Invalid Date Range"; } }