Exemplo n.º 1
0
    //加载
    public void LoadDataBind()
    {
        int ID = CommonClass.ReturnRequestInt("id", 0);

        if (ID > 0)
        {
            TB_Info_HotSearch model = InfoService.HotSearchService.Get(ID);
            TbTitle.Text    = model.KeyWord;
            TbCount.Text    = model.ClickCount.ToStr();
            TbOrderBy.Text  = model.OrderBy.ToStr();
            ViewState["id"] = model.ID;
        }
    }
Exemplo n.º 2
0
    //保存
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        TB_Info_HotSearch model = new TB_Info_HotSearch();

        if (ViewState["id"] != null)
        {
            model = InfoService.HotSearchService.Get(ViewState["id"]);
        }
        model.KeyWord    = TbTitle.Text;
        model.ClickCount = TbCount.Text.ToInt();
        model.OrderBy    = TbOrderBy.Text.ToInt();
        model.Creater    = AdminUserName;

        IInfo_HotSearch HotSearch = InfoService.HotSearchService;

        if (ViewState["id"] == null)
        {
            model.AddDate = DateTime.Now;
            if (HotSearch.Insert(model) == 1)
            {
                //操作日志
                AdminService.LogService.Insert(OperationType.用户操作, 0, "添加热门搜索" + model.KeyWord);

                MessageDiv.InnerHtml = CommonClass.Reload("数据添加成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据添加失败");
            }
        }
        else
        {
            if (HotSearch.Update(model) == 1)
            {
                //操作日志
                AdminService.LogService.Insert(OperationType.用户操作, 0, "修改热门搜索" + model.KeyWord);

                MessageDiv.InnerHtml = CommonClass.Reload("数据修改成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据修改失败");
            }
        }
    }
Exemplo n.º 3
0
    public void LoadDataBind(int pageIndex)
    {
        int recordCount           = 0;
        List <Expression> express = new List <Expression>();

        express.Add(new Expression("IsDelete", "=", "0"));
        string key        = CommonClass.ReturnRequestStr("key");
        int    min        = CommonClass.ReturnRequestInt("min");
        int    max        = CommonClass.ReturnRequestInt("max");
        int    categoryId = CommonClass.ReturnRequestInt("categoryId");
        int    brandId    = CommonClass.ReturnRequestInt("brandId");
        string orderBy    = CommonClass.ReturnRequestStr("orderBy");

        //搜索关键词
        if (!string.IsNullOrEmpty(key))
        {
            List <Expression> expression = new List <Expression>();
            expression.Add(new Expression("KeyWord", "=", key));

            TB_Info_HotSearch model = InfoService.HotSearchService.Get(expression);
            model.KeyWord = key;
            model.AddDate = DateTime.Now;

            //获取会员信息
            if (Request.Cookies["MemberInfo"] != null)
            {
                model.Creater = Request.Cookies["MemberInfo"].Values["MemberName"].ToStr();
            }

            if (model.ID == 0)
            {
                InfoService.HotSearchService.Insert(model);
            }
            else
            {
                InfoService.HotSearchService.Update(model);
            }
        }

        if (categoryId > 0)
        {
            express.Add(new Expression("CategoryId", "in", ProductService.CategoryService.GetCategoryList(categoryId)));
        }
        if (brandId > 0)
        {
            express.Add(new Expression("BrandID", "=", brandId.ToStr()));
        }
        string orderByStr = "id desc,addDate desc";

        if (!string.IsNullOrEmpty(orderBy))
        {
            switch (orderBy)
            {
            case "price":
                orderByStr = "SalesPrice asc";
                break;

            case "date":
                orderByStr = "addDate desc";
                break;
            }
        }
        if (Request.QueryString["mark"] != null)
        {
            express.Add(new Expression("Mark", "like", Request.QueryString["mark"]));
        }
        if (max > 0)
        {
            express.Add(new Expression("SalesPrice", ">=", min.ToStr()));
            express.Add(new Expression("SalesPrice", "<", max.ToStr()));
        }
        else
        {
            express.Add(new Expression("SalesPrice", ">=", min.ToStr()));
        }

        RepList.DataSource = ProductService.ProductsService.Search(AspNetPager1.PageSize, pageIndex, express, orderByStr, ref recordCount);
        RepList.DataBind();
        AspNetPager1.RecordCount = recordCount;
        AspNetPager2.RecordCount = recordCount;
    }