Exemplo n.º 1
0
 public MessageResult GetGoodsList(int gtypeId, string keywords)
 {
     try
     {
         List <ViewGoodsInfoModel> list = goodsBLL.GetGoodsList(gtypeId, keywords);
         return(MessageResult.Success(list));
     }
     catch (Exception ex)
     {
         return(MessageResult.Fail(ex.Message));
     }
 }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string effectId = context.Request.QueryString["effect"];

            int pageSize = 8;
            int pageIndex;

            if (!int.TryParse(context.Request.QueryString["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageCount = GoodsBLL.GetGoodsPageCount(pageSize);

            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pageCount ? pageCount : pageIndex;
            List <GoodModel> GoodsList = GoodsBLL.GetGoodsList(pageIndex, pageSize);

            //string sqlText = GoodsBLL.getPaginationSql(0, pageSize, "goods", "*", "Goods_is_delete = 0", "goods_id");



            string        temp = File.ReadAllText(context.Server.MapPath("drugstore_all.html"));
            StringBuilder sb   = new StringBuilder();


            if (GoodsList == null)
            {
                temp = temp.Replace("@content", "该类型的商品还未上架,敬请期待.");
            }
            else
            {
                foreach (GoodModel item in GoodsList)
                {
                    sb.AppendFormat(@"<div class='col-lg-3' ><div class='thumbnail'><img src='{4}' style='height: 300px' alt='...'><div class='caption'><h3>{0}</h3><p>{1}元</p><p>总销量:{2}</p><p><a href='ProcessDrugDetails.ashx?goods_id={3}' class='btn btn-primary' role='button'>查看详情</a> <a href='../ShopCartInfo/ProcessAddCart.ashx?goods_id={3}' class='btn btn-default' role='button'>加入购物车</a></p></div></div></div>", item.GoodsName, item.GoodsPrice, item.GoodsSalesVolume, item.GoodsId, "../Images/product_img/" + item.GoodsPicture);
                }
            }

            temp = temp.Replace("@page", PageBarHelper.GetPageBar(pageIndex, pageCount));
            temp = temp.Replace("@content", sb.ToString());
            if (context.Session["users_id"] != null)
            {
                temp = temp.Replace("@user_name", context.Session["user_name"].ToString());
            }
            else
            {
                temp = temp.Replace("@user_name", "游客");
            }

            context.Response.Write(temp);
        }
Exemplo n.º 3
0
        public ActionResult GetGoodsList()
        {
            int count = 0;
            //string sql = @"select p.Uname,p.Sex,p.roleId,p.truename,p.UId from Users p order by UId desc";
            //string sql = @"select * ,(select top 1 truename from [dbo].Users where UId=m.UId) as truename, (select roleName from Role where roleId in(select top 1  roleId from Users where UId=m.UId)) as roelName  from .[dbo].Users m  where  " + strWhere;
            DataSet      ds   = bll.GetGoodsList();
            List <Goods> list = TBToList <Goods> .ConvertToList(ds.Tables[0]).ToList();

            var grid = new EasyuiDataGrid <List <Goods> >();

            grid.total = count;
            grid.rows  = list;
            return(Json(grid, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public MResultList <ItemGoods> GetGoodsList(string sid, string token, string guid, string user_id, string uid, string bid, string cid, string age, string price, string sort, string page, string size)
        {
            var result = new MResultList <ItemGoods>(true);

            try
            {
                var brandId    = MCvHelper.To <int>(bid);
                var categoryId = MCvHelper.To <int>(cid);
                var pIndex     = MCvHelper.To <int>(page);
                var pSize      = MCvHelper.To <int>(size);
                var channelId  = MCvHelper.To <SystemType>(sid);

                result = MCacheManager.UseCached <MResultList <ItemGoods> >(
                    string.Format("GetGoodsList_{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}", sid, user_id, bid, cid, age, price, sort, page, size),
                    MCaching.CacheGroup.Goods, () => GoodsBLL.GetGoodsList(sid, uid, (int)channelId, categoryId, brandId, age, price, sort, pSize, pIndex));
            }
            catch (Exception ex)
            {
                result.status = MResultStatus.ExceptionError;
                result.msg    = "处理数据出错!";
            }

            return(result);
        }