private void DataBindDiscount()
        {
            this.id = Globals.RequestQueryNum("id");
            if (this.id > 0)
            {
                LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id);
                if (discountInfo != null)
                {
                    this.actionName = discountInfo.ActivityName;
                }
            }
            ProductQuery productQuery = new ProductQuery
            {
                Keywords    = this.txtProductName.Text,
                ProductCode = "",
                CategoryId  = this.dropCategories.SelectedValue,
                PageSize    = this.pager.PageSize,
                PageIndex   = this.pager.PageIndex,
                SortOrder   = SortAction.Desc,
                SortBy      = "DisplaySequence"
            };

            if (this.dropCategories.SelectedValue.HasValue && this.dropCategories.SelectedValue > 0)
            {
                productQuery.MaiCategoryPath = CatalogHelper.GetCategory(this.dropCategories.SelectedValue.Value).Path;
            }
            DbQueryResult discountProduct = LimitedTimeDiscountHelper.GetDiscountProduct(productQuery);

            this.grdProducts.DataSource = discountProduct.Data;
            this.grdProducts.DataBind();
            this.pager.TotalRecords = discountProduct.TotalRecords;
        }
Esempio n. 2
0
        private void DataBindDiscount()
        {
            string str = Globals.RequestQueryStr("key").Trim();

            if (!string.IsNullOrEmpty(str))
            {
                this.txtProductName.Text = str;
            }
            int num = Globals.RequestQueryNum("cid");

            this.id = Globals.RequestQueryNum("id");
            if (this.id > 0)
            {
                LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id);
                if (discountInfo != null)
                {
                    this.actionName = discountInfo.ActivityName;
                }
                int?nullable = null;
                if (num > 0)
                {
                    nullable = new int?(num);
                    this.dropCategories.SelectedValue = new int?(num);
                }
                ProductQuery query = new ProductQuery
                {
                    Keywords    = str,
                    ProductCode = "",
                    CategoryId  = nullable,
                    PageSize    = this.pager.PageSize,
                    PageIndex   = this.pager.PageIndex,
                    SortOrder   = SortAction.Desc,
                    SortBy      = "DisplaySequence"
                };
                if (num > 0)
                {
                    query.MaiCategoryPath = CatalogHelper.GetCategory(num).Path;
                }
                DbQueryResult discountProduct = LimitedTimeDiscountHelper.GetDiscountProduct(query);
                this.grdProducts.DataSource = discountProduct.Data;
                this.grdProducts.DataBind();
                this.pager.TotalRecords = discountProduct.TotalRecords;
            }
            else
            {
                base.Response.Redirect("LimitedTimeDiscountList.aspx");
            }
        }