public void Load_XB()
        {
            Pager_Xuatban.PageSize = 5;
            T_MultimediaDAL _untilDAL = new T_MultimediaDAL();
            DataSet         _ds;

            _ds = _untilDAL.BindGridT_Multimedia(Pager_Xuatban.PageIndex, Pager_Xuatban.PageSize, WhereCondition(1));
            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_Multimedia(Pager_Xuatban.PageIndex - 1, Pager_Xuatban.PageSize, WhereCondition(1));
            }
            DataGrid_Daxuatban.DataSource = _ds.Tables[0];
            DataGrid_Daxuatban.DataBind(); _ds.Clear();
            Pager_Xuatban.TotalRecords     = CurrentPage_Xuatban.TotalRecords = TotalRecords;
            CurrentPage_Xuatban.TotalPages = Pager_Xuatban.CalculateTotalPages();
            CurrentPage_Xuatban.PageIndex  = Pager_Xuatban.PageIndex;
            GetTotal();
        }
예제 #2
0
        public void Load_XB()
        {
            //string _where = " 1 = 1 AND Languages_ID IN (SELECT DISTINCT(T_Nguoidung_NgonNgu.Ma_Ngonngu) FROM T_Nguoidung_NgonNgu WHERE T_Nguoidung_NgonNgu.[Ma_Nguoidung] = " + _user.UserID + ") and Status = 3 ";
            string _where = " 1=1 and Status = 3 ";

            if (txtSearch.Text.Length > 0)
            {
                _where += " AND " + string.Format(" Tittle like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearch.Text.Trim()));
            }
            if (ddlLang.SelectedIndex > 0)
            {
                _where += " AND " + string.Format(" Languages_ID = {0}", ddlLang.SelectedValue);
            }
            if (this.ddlCategorys.SelectedIndex > 0)
            {
                _where += " AND" + string.Format(" Category IN (SELECT * FROM [fn_Return_Category_Tree] ({0}))", this.ddlCategorys.SelectedValue);
            }

            _where += " Order by T_Multimedia.DatePublish DESC";
            Pager_Xuatban.PageSize = 5;
            T_MultimediaDAL _untilDAL = new T_MultimediaDAL();
            DataSet         _ds;

            _ds = _untilDAL.BindGridT_Multimedia(Pager_Xuatban.PageIndex, Pager_Xuatban.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_Multimedia(Pager_Xuatban.PageIndex - 1, Pager_Xuatban.PageSize, _where);
            }
            DataGrid_Daxuatban.DataSource = _ds.Tables[0];
            DataGrid_Daxuatban.DataBind();
            Pager_Xuatban.TotalRecords     = CurrentPage_Xuatban.TotalRecords = TotalRecords;
            CurrentPage_Xuatban.TotalPages = Pager_Xuatban.CalculateTotalPages();
            CurrentPage_Xuatban.PageIndex  = Pager_Xuatban.PageIndex;
        }