protected void GridItemList_SortCommand(object source, DataGridSortCommandEventArgs e)
        {
            string sortingDirection = string.Empty;

            if (sortProperty == SortDirection.Ascending)
            {
                sortProperty     = SortDirection.Descending;
                sortingDirection = "Desc";
            }
            else
            {
                sortProperty     = SortDirection.Ascending;
                sortingDirection = "Asc";
            }

            DataTable dataTable  = Session["UnitsList"] as DataTable;
            DataView  sortedView = new DataView(dataTable);

            sortedView.Sort         = e.SortExpression + " " + sortingDirection;
            GridItemList.DataSource = sortedView;
            GridItemList.DataBind();
        }
        private void SearchResult()
        {
            try
            {
                int    tinhtranghoso = Utils.CIntDef(ddlTinhtranghoso.SelectedValue, 0);
                string keyword       = CpanelUtils.ClearUnicode(txtKeyword.Value);

                var AllList = (from g in DB.ESHOP_NEWs
                               where ("" == keyword || DB.fClearUnicode(g.NEWS_TITLE).Contains(keyword) || g.NEWS_DESC.Contains(keyword))
                               //&& g.NEWS_LANGUAGE == lang
                               && (g.NEWS_TYPE == 2) &&
                               (g.TINHTRANGHOSO == tinhtranghoso || tinhtranghoso == 0)
                               orderby g.NEWS_ID descending
                               select g);


                if (AllList.ToList().Count > 0)
                {
                    Session["NewsList"] = DataUtil.LINQToDataTable(AllList);
                }

                GridItemList.DataSource = AllList;
                if (AllList.ToList().Count > GridItemList.PageSize)
                {
                    GridItemList.AllowPaging = true;
                }
                else
                {
                    GridItemList.AllowPaging = false;
                }
                GridItemList.DataBind();
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        private void SearchResult()
        {
            try
            {
                string keyword = txtKeyword.Value;

                var AllList = (from g in DB.ESHOP_CONTACTs
                               where ("" == keyword || (g.CONTACT_NAME).Contains(keyword) || (g.CONTACT_EMAIL).Contains(keyword) ||
                                      (g.CONTACT_TITLE).Contains(keyword) || (g.CONTACT_CONTENT).Contains(keyword) ||
                                      g.CONTACT_NAME.Contains(keyword) || g.CONTACT_EMAIL.Contains(keyword) ||
                                      g.CONTACT_TITLE.Contains(keyword) || g.CONTACT_CONTENT.Contains(keyword))
                               //&&g.CONTACT_TYPE!=1
                               orderby g.CONTACT_PUBLISHDATE descending
                               select g);


                if (AllList.ToList().Count > 0)
                {
                    Session["ContactList"] = DataUtil.LINQToDataTable(AllList);
                }

                GridItemList.DataSource = AllList;
                if (AllList.ToList().Count > GridItemList.PageSize)
                {
                    GridItemList.AllowPaging = true;
                }
                else
                {
                    GridItemList.AllowPaging = false;
                }
                GridItemList.DataBind();
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Exemplo n.º 4
0
        private void SearchResult()
        {
            try
            {
                string keyword = txtKeyword.Value;
                //int Cat_Id=Utils.CIntDef(ddlCategory.SelectedValue);
                DateTime fromDate = ucFromDate.returnDate;
                DateTime toDate   = new DateTime(ucToDate.returnDate.Year, ucToDate.returnDate.Month, ucToDate.returnDate.Day, 23, 59, 59);

                int _status = Utils.CIntDef(ddlStatus.SelectedValue);
                if (_status != 99)
                {
                    var AllList = (from o in DB.ESHOP_ORDERs
                                   //join o_i in DB.ESHOP_ORDER_ITEMs on o.ORDER_ID equals o_i.ORDER_ID
                                   where ("" == keyword || (o.ORDER_CODE).Contains(keyword) || (o.ORDER_FIELD1).Contains(keyword)) &&
                                   o.ORDER_PUBLISHDATE <= toDate && o.ORDER_PUBLISHDATE >= fromDate &&
                                   o.ORDER_STATUS == _status
                                   select o).Distinct().OrderByDescending(n => n.ORDER_ID);

                    if (AllList.ToList().Count > 0)
                    {
                        Session["OrderList"] = DataUtil.LINQToDataTable(AllList);
                    }

                    GridItemList.DataSource = AllList;
                    if (AllList.ToList().Count > GridItemList.PageSize)
                    {
                        GridItemList.AllowPaging = true;
                    }
                    else
                    {
                        GridItemList.AllowPaging = false;
                    }
                    GridItemList.DataBind();
                }
                else
                {
                    var AllList = (from o in DB.ESHOP_ORDERs
                                   //join o_i in DB.ESHOP_ORDER_ITEMs on o.ORDER_ID equals o_i.ORDER_ID
                                   where ("" == keyword || (o.ORDER_CODE).Contains(keyword) || (o.ORDER_FIELD1).Contains(keyword)) &&
                                   o.ORDER_PUBLISHDATE <= toDate && o.ORDER_PUBLISHDATE >= fromDate

                                   select o).Distinct().OrderByDescending(n => n.ORDER_ID);

                    if (AllList.ToList().Count > 0)
                    {
                        Session["OrderList"] = DataUtil.LINQToDataTable(AllList);
                    }

                    GridItemList.DataSource = AllList;
                    if (AllList.ToList().Count > GridItemList.PageSize)
                    {
                        GridItemList.AllowPaging = true;
                    }
                    else
                    {
                        GridItemList.AllowPaging = false;
                    }
                    GridItemList.DataBind();
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }