private void LoadData()
        {
            string _where = " 1 = 1 AND News_Status <> 55 AND T_News.News_Lock =1 ";

            //if (ddlLang.SelectedIndex > 0)
            //    _where += " AND " + string.Format(" T_News.Lang_ID = {0}", ddlLang.SelectedValue);
            if (ddlCategorysAll.SelectedIndex > 0)
            {
                _where += " AND " + string.Format(" T_News.CAT_ID = {0}", ddlCategorysAll.SelectedValue);
            }
            if (txt_tieude.Text.Length > 0)
            {
                _where += "AND " + string.Format(" News_Tittle like N'%{0}%'", UltilFunc.SqlFormatText(this.txt_tieude.Text.Trim()));
            }
            _where        += "Order by T_News.News_DateEdit DESC ";
            pages.PageSize = Global.MembersPerPage;
            HPCBusinessLogic.DAL.T_NewsDAL _untilDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
            DataSet _ds;

            _ds = _untilDAL.BindGridT_NewsEditor(pages.PageIndex, pages.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 = _untilDAL.BindGridT_NewsEditor(pages.PageIndex - 1, pages.PageSize, _where);
            }
            grdList.DataSource = _ds.Tables[0];
            grdList.DataBind();
            pages.TotalRecords = curentPages.TotalRecords = TotalRecords;
            System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "javascript", "javascript: SetInnerBaiDangxyLy(" + TotalRecords + ");", true);
            curentPages.TotalPages = pages.CalculateTotalPages();
            curentPages.PageIndex  = pages.PageIndex;
        }
Esempio n. 2
0
        private void LoadData_Baibixoa()
        {
            string sOrder = " Order by News_DateEdit DESC ";

            pageBaixoa.PageSize = Global.MembersPerPage;
            HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
            DataSet _ds;

            _ds = _T_newsDAL.BindGridT_NewsEditor(pageBaixoa.PageIndex, pageBaixoa.PageSize, BuildSQL(ConstNews.NewsDelete, sOrder));
            int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString());
            int TotalRecord  = Convert.ToInt32(_ds.Tables[0].Rows.Count);

            if (TotalRecord == 0)
            {
                for (int i = 1; i <= TotalRecords; i++)
                {
                    _ds = _T_newsDAL.BindGridT_NewsEditor(pageBaixoa.PageIndex - i, pageBaixoa.PageSize, BuildSQL(ConstNews.NewsDelete, sOrder));
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        break;
                    }
                }
            }
            dgr_BaiXoa.DataSource = _ds;
            dgr_BaiXoa.DataBind(); _ds.Clear();
            pageBaixoa.TotalRecords      = CurrentPageBaixoa.TotalRecords = TotalRecords;
            CurrentPageBaixoa.TotalPages = pageBaixoa.CalculateTotalPages();
            CurrentPageBaixoa.PageIndex  = pageBaixoa.PageIndex;
            GetTotal();
        }
Esempio n. 3
0
        private void LoadData_DangXuly()
        {
            string sOrder = " Order by News_DateCreated DESC ";

            pages.PageSize = Global.MembersPerPage;
            HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
            DataSet _ds;

            _ds = _T_newsDAL.BindGridT_NewsEditor(pages.PageIndex, pages.PageSize, BuildSQL(ConstNews.AddNew, sOrder));
            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 = _T_newsDAL.BindGridT_NewsEditor(pages.PageIndex - 1, pages.PageSize, BuildSQL(ConstNews.AddNew, sOrder));
            }
            this.dgr_tintuc1.DataSource = _ds;
            this.dgr_tintuc1.DataBind(); _ds.Clear();
            pages.TotalRecords      = CurrentPage2.TotalRecords = TotalRecords;
            CurrentPage2.TotalPages = pages.CalculateTotalPages();
            CurrentPage2.PageIndex  = pages.PageIndex;
            GetTotal();
        }