public void LoadDataApprovied() { string where = " TieuDe IS NULL And NguoiTao =" + _user.UserID; if (!String.IsNullOrEmpty(this.txt_FromDate.Text.Trim())) { where += " AND " + string.Format(" NgayTao >='{0}'", UltilFunc.ToDate(this.txt_FromDate.Text.Trim(), "dd/MM/yyyy").ToShortDateString() + " 00:00:00 "); } if (!String.IsNullOrEmpty(this.txt_ToDate.Text.Trim())) { where += " AND " + string.Format(" NgayTao <='{0}'", UltilFunc.ToDate(this.txt_ToDate.Text.Trim(), "dd/MM/yyyy").ToShortDateString() + " 23:59:59 "); } where += " ORDER BY NgayTao DESC "; AnhDAL _DAL = new AnhDAL(); DataSet _ds; pageappro.PageSize = 5; _ds = _DAL.BindGridT_Anh(pageappro.PageIndex, pageappro.PageSize, where); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _DAL.BindGridT_Anh(pageappro.PageIndex - 1, pageappro.PageSize, where); } dgrListAppro.DataSource = _ds; dgrListAppro.DataBind(); pageappro.TotalRecords = CurrentPage1.TotalRecords = TotalRecords; CurrentPage1.TotalPages = pageappro.CalculateTotalPages(); CurrentPage1.PageIndex = pageappro.PageIndex; Session["CurrentPage"] = pageappro.PageIndex; }
public void LoadDataApprovied() { string where = " TieuDe IS NOT NULL "; if (!String.IsNullOrEmpty(txtSearchName.Text.Trim())) { where += " AND " + string.Format(" TieuDe like N'%{0}%' OR dbo.ClearVNMark(TieuDe) Like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearchName.Text.Trim())); } if (!String.IsNullOrEmpty(this.txt_FromDate.Text.Trim())) { where += " AND " + string.Format(" NgayTao >='{0}'", UltilFunc.ToDate(this.txt_FromDate.Text.Trim(), "dd/MM/yyyy").ToShortDateString() + " 00:00:00 "); } if (!String.IsNullOrEmpty(this.txt_ToDate.Text.Trim())) { where += " AND " + string.Format(" NgayTao <='{0}'", UltilFunc.ToDate(this.txt_ToDate.Text.Trim(), "dd/MM/yyyy").ToShortDateString() + " 23:59:59 "); } where += " ORDER BY NgayTao DESC "; AnhDAL _DAL = new AnhDAL(); DataSet _ds; pageappro.PageSize = 5; _ds = _DAL.BindGridT_Anh(pageappro.PageIndex, pageappro.PageSize, where); if (_ds.Tables[0].Rows.Count > 0) { int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _DAL.BindGridT_Anh(pageappro.PageIndex - 1, pageappro.PageSize, where); } dgrListAppro.DataSource = _ds; dgrListAppro.DataBind(); pageappro.TotalRecords = CurrentPage1.TotalRecords = TotalRecords; CurrentPage1.TotalPages = pageappro.CalculateTotalPages(); CurrentPage1.PageIndex = pageappro.PageIndex; Session["CurrentPage"] = pageappro.PageIndex; panelReport.Visible = false; panelContent.Visible = true; } else { panelReport.Visible = true; panelContent.Visible = false; Session["CurrentPage"] = null; } }