Ejemplo n.º 1
0
        private void Bind()
        {
            if (bll == null)
            {
                bll = new BLL.SearchKeyword();
            }
            int totalCount = 0;

            rpData.DataSource = bll.GetList(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount, sqlWhere, parms == null ? null : parms.ToArray());
            rpData.DataBind();
            AspNetPager1.RecordCount = totalCount;
        }
Ejemplo n.º 2
0
 private void Bind()
 {
     if (!string.IsNullOrEmpty(nId))
     {
         if (bll == null)
         {
             bll = new BLL.SearchKeyword();
         }
         Model.SearchKeyword model = bll.GetModel(nId);
         if (model != null)
         {
             txtSearchName.Value = model.SearchName;
             txtTotalCount.Value = model.TotalCount.ToString();
             txtDataCount.Value  = model.DataCount.ToString();
         }
     }
 }
Ejemplo n.º 3
0
        private void OnDelete()
        {
            string sAppend = hV.Value.Trim();

            if (!string.IsNullOrEmpty(sAppend))
            {
                string[] orderIds = sAppend.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                if (orderIds.Length > 0)
                {
                    if (bll == null)
                    {
                        bll = new BLL.SearchKeyword();
                    }
                    if (bll.DeleteBatch(orderIds.ToList <string>()))
                    {
                        GetSearchItem();
                        Bind();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public static List <string> GetKeywords()
        {
            BLL.SearchKeyword bll = new BLL.SearchKeyword();

            if (!enableCaching)
            {
                return(bll.GetKeywords());
            }

            string        key  = "keyword_all";
            List <string> data = (List <string>)HttpRuntime.Cache[key];

            if (data == null)
            {
                data = bll.GetKeywords();

                AggregateCacheDependency cd = DependencyFactory.GetProvinceCityDependency();

                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(keywordTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 保存数据
        /// </summary>
        private void OnSave()
        {
            #region 获取输入并验证

            string sSearchName = txtSearchName.Value.Trim();
            string sTotalCount = txtTotalCount.Value.Trim();
            string sDataCount  = txtDataCount.Value.Trim();

            if (string.IsNullOrEmpty(sSearchName))
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "关键字名称为必填项,请检查", "操作错误", "error");
                return;
            }

            int totalCount = 0;
            if (!string.IsNullOrEmpty(sTotalCount))
            {
                if (!int.TryParse(sTotalCount, out totalCount))
                {
                    WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "累计次数正确格式为整数,请检查", "操作错误", "error");
                    return;
                }
            }
            int dataCount = 0;
            if (!string.IsNullOrEmpty(sDataCount))
            {
                if (!int.TryParse(sDataCount, out dataCount))
                {
                    WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "数据个数正确格式为整数,请检查", "操作错误", "error");
                    return;
                }
            }

            #endregion

            if (bll == null)
            {
                bll = new BLL.SearchKeyword();
            }
            if (!string.IsNullOrEmpty(nId))
            {
                Model.SearchKeyword model = new Model.SearchKeyword();
                model.NumberID        = nId;
                model.SearchName      = sSearchName;
                model.TotalCount      = totalCount;
                model.LastUpdatedDate = DateTime.Now;
                model.DataCount       = dataCount;
                if (bll.Update(model) > 0)
                {
                    WebHelper.MessageBox.MessagerShow(this.Page, lbtnPostBack, "操作成功!");
                    return;
                }
                else
                {
                    WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "操作失败,请检查", "系统提示");
                    return;
                }
            }
            else
            {
                if (bll.CreateKeyword(sSearchName, dataCount) > -1)
                {
                    WebHelper.MessageBox.MessagerShow(this.Page, lbtnPostBack, "操作成功!");
                    return;
                }
                else
                {
                    WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "操作失败,请检查", "系统提示");
                    return;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 绑定产品列表
        /// </summary>
        private void Bind()
        {
            BindCategory();

            if (!string.IsNullOrEmpty(categoryId))
            {
                if (!string.IsNullOrEmpty(cIdAppend))
                {
                    categoryId = cIdAppend;
                }
                List <Model.ProductInfo> list = WebHelper.ProductDataProxy.GetProductsByCategory(categoryId);
                AspNetPager1.RecordCount = list.Count();
                if (list != null)
                {
                    if (startPrice > -1)
                    {
                        list = list.FindAll(delegate(Model.ProductInfo m) { return(m.ProductPrice >= startPrice); });
                    }
                    if (endPrice > -1)
                    {
                        list = list.FindAll(delegate(Model.ProductInfo m) { return(m.ProductPrice <= endPrice); });
                    }
                    if (orderBy == "ProductPrice asc")
                    {
                        list = list.OrderBy(m => m.ProductPrice).ToList();
                    }
                    else if (orderBy == "ProductPrice desc")
                    {
                        list = list.OrderByDescending(m => m.ProductPrice).ToList();
                    }

                    rpData.DataSource = list.Skip(AspNetPager1.CurrentPageIndex - 1).Take(AspNetPager1.PageSize);
                    rpData.DataBind();
                }
                else
                {
                    list = new List <Model.ProductInfo>();
                    rpData.DataSource = list;
                    rpData.DataBind();
                }
            }
            else if (!string.IsNullOrEmpty(keyword))
            {
                List <Model.ProductInfo> list = WebHelper.ProductDataProxy.GetProductsBySearch(keyword);
                int count = list.Count;
                AspNetPager1.RecordCount = count;
                if (list != null && count > 0)
                {
                    if (startPrice > -1)
                    {
                        list = list.FindAll(delegate(Model.ProductInfo m) { return(m.ProductPrice >= startPrice); });
                    }
                    if (endPrice > -1)
                    {
                        list = list.FindAll(delegate(Model.ProductInfo m) { return(m.ProductPrice <= endPrice); });
                    }
                    if (orderBy == "ProductPrice asc")
                    {
                        list.OrderBy(m => m.ProductPrice);
                    }
                    else if (orderBy == "ProductPrice desc")
                    {
                        list.OrderByDescending(m => m.ProductPrice);
                    }

                    rpData.DataSource = list.Skip(AspNetPager1.CurrentPageIndex - 1).Take(AspNetPager1.PageSize);
                    rpData.DataBind();
                }
                else
                {
                    list = new List <Model.ProductInfo>();
                    rpData.DataSource = list;
                    rpData.DataBind();
                }

                //开启一个线程处理,将查询关键字写入到数据存储
                BLL.SearchKeyword skBll = new BLL.SearchKeyword(keyword, count);
                skBll.ThreadStart();
            }
        }