Ejemplo n.º 1
0
        private void SearchResult()
        {
            try
            {
                int    _limit  = 20;
                int    _skip   = 0;
                string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);
                int    _catid  = Utils.CIntDef(ddlCategory.SelectedValue);
                if (_catid != 0 || !String.IsNullOrEmpty(keyword))
                {
                    _limit = 200;
                }

                if (_page != 0)
                {
                    _skip = _page * _limit - _limit;
                }
                var AllList = (from g in DB.ESHOP_NEWs
                               join a in DB.ESHOP_NEWS_CATs on g.NEWS_ID equals a.NEWS_ID into t2_join
                               from d in t2_join.DefaultIfEmpty()
                               where ("" == keyword || SqlMethods.Like(g.NEWS_KEYWORD_ASCII, "%" + keyword + "%") || g.NEWS_CODE.Contains(keyword)) &&
                               (_gtype != 1 ? (getCatid().Contains(d.ESHOP_CATEGORy.CAT_ID.ToString()) || getCatid().Contains(d.ESHOP_CATEGORy.CAT_PARENT_ID.ToString())) : true) &&
                               (_type == 1 ? g.NEWS_TYPE == 1 : g.NEWS_TYPE != 1) &&
                               ((d.ESHOP_CATEGORy.CAT_ID == _catid || d.ESHOP_CATEGORy.CAT_PARENT_PATH.Contains(_catid.ToString())) || 0 == _catid)
                               orderby g.NEWS_ID descending
                               select g).GroupBy(n => n.NEWS_ID).Select(n => new
                {
                    NEWS_ID          = n.First().NEWS_ID,
                    NEWS_TITLE       = n.First().NEWS_TITLE,
                    NEWS_TYPE        = n.First().NEWS_TYPE,
                    NEWS_SHOWTYPE    = n.First().NEWS_SHOWTYPE,
                    NEWS_ORDER       = n.First().NEWS_ORDER,
                    NEWS_PUBLISHDATE = n.First().NEWS_PUBLISHDATE,
                }).OrderByDescending(n => n.NEWS_ID).ToList();


                RpItemList.DataSource = AllList.Skip(_skip).Take(_limit);
                RpItemList.DataBind();
                LitPage.Text = pagechange.changePageNews("news_list.aspx", AllList.Count, _limit, _page, _type);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Ejemplo n.º 2
0
        private void SearchResult()
        {
            try
            {
                int    _limit  = 20;
                int    _skip   = 0;
                string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);
                int    _catid  = Utils.CIntDef(ddlCategory.SelectedValue);
                if (_catid != 0 || !String.IsNullOrEmpty(keyword))
                {
                    _limit = 200;
                }

                if (_page != 0)
                {
                    _skip = _page * _limit - _limit;
                }
                var AllList = (from g in DB.ESHOP_NEWs
                               join a in DB.ESHOP_NEWS_CATs on g.NEWS_ID equals a.NEWS_ID
                               join d in DB.ESHOP_CATEGORies on a.CAT_ID equals d.CAT_ID
                               where ("" == keyword || (DB.fClearUnicode(g.NEWS_TITLE)).Contains(keyword) || g.NEWS_CODE.Contains(keyword)) &&
                               (g.NEWS_TYPE == 1) && g.UNIT_ID2 > 0 &&
                               ((d.CAT_ID == _catid || d.CAT_PARENT_PATH.Contains(_catid.ToString())) || 0 == _catid)
                               orderby g.UNIT_ID2 descending
                               select g).GroupBy(n => n.NEWS_ID).Select(n => new
                {
                    UNIT_ID2         = n.First().UNIT_ID2,
                    NEWS_ID          = n.First().NEWS_ID,
                    NEWS_TITLE       = n.First().NEWS_TITLE,
                    NEWS_TYPE        = n.First().NEWS_TYPE,
                    NEWS_SHOWTYPE    = n.First().NEWS_SHOWTYPE,
                    NEWS_ORDER       = n.First().NEWS_ORDER,
                    NEWS_PUBLISHDATE = n.First().NEWS_PUBLISHDATE,
                }).OrderByDescending(n => n.NEWS_ID).ToList();
                RpItemList.DataSource = AllList.Skip(_skip).Take(_limit);
                RpItemList.DataBind();
                LitPage.Text = pagechange.changePageNews(AllList.Count, _limit, "xulylinkdie.aspx", _page, _type, 10);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }