Beispiel #1
0
        private void LoadData_TinBaiTheoDeTai()
        {
            string sOrder = GetOrderString() == "" ? "" : " ORDER BY " + GetOrderString();

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

            _ds = _T_newsDAL.BindGridT_NewsEditor(pages.PageIndex, pages.PageSize, GetWhereTinBai(2, 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, GetWhereTinBai(2, sOrder));
            }
            dgr_tintuc1.DataSource = _ds;
            dgr_tintuc1.DataBind();


            pages.TotalRecords     = CurrentPage.TotalRecords = TotalRecords;
            CurrentPage.TotalPages = pages.CalculateTotalPages();
            CurrentPage.PageIndex  = pages.PageIndex;
            Session["PageIndex"]   = pages.PageIndex;
            GetTotalRecordTinBai();
        }
Beispiel #2
0
        public ListData LoadDataPaging(object Tieude, object Anpham, object Sobao, object Trang, object Chuyenmuc, object Tungay, object Denngay, object Tacgia, object Matacgia, object PageIndex, object PageSize)
        {
            int       TotalRecords = 0;
            string    sOrder       = string.Empty;
            DataSet   _ds          = new DataSet();
            DataTable _dt          = new DataTable();
            var       data         = new ListData();

            try
            {
                string _where = GetWhere(Tieude.ToString(), Anpham.ToString(), Sobao.ToString(), Trang.ToString(), Chuyenmuc.ToString(), Tungay.ToString(), Denngay.ToString(), Tacgia.ToString(), Matacgia.ToString());
                _ds          = _Daltinbai.BindGridT_NewsEditor(int.Parse(PageIndex.ToString()), int.Parse(PageSize.ToString()), _where);
                TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString());

                _dt = _ds.Tables[0];
                for (int i = 0; i < _dt.Rows.Count; i++)
                {
                    _objtinbai.Add(new T_TinBai()
                    {
                        Ma_Tinbai    = double.Parse(_dt.Rows[i]["Ma_Tinbai"].ToString()),
                        Tieude       = _dt.Rows[i]["Tieude"].ToString(),
                        Ma_TacGia    = int.Parse(_dt.Rows[i]["Ma_TacGia"].ToString()),
                        Ma_Anpham    = int.Parse(_dt.Rows[i]["Ma_Anpham"].ToString()),
                        Ma_Chuyenmuc = int.Parse(_dt.Rows[i]["Ma_Chuyenmuc"].ToString()),
                        Ma_Sobao     = int.Parse(_dt.Rows[i]["Ma_Sobao"].ToString())
                    });
                }
                data.ListNews = _objtinbai;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            data.TotalRecords = TotalRecords;
            return(data);
        }