Example #1
0
        public _Response GetTeaList()
        {
            List <T_MenuGoods> list = new List <T_MenuGoods>();

            if (menus == null)
            {
                menus = this._lable.GetLables((int)Entity.Enum.RelateEnum.tea);
            }
            foreach (var item in menus)
            {
                T_MenuGoods entity = new T_MenuGoods();
                entity.id        = item.id;
                entity.lableName = item.lableName;
                entity.goods     = this._goods.GetGoodsBypid(item.id);
                if (entity.goods != null)
                {
                    foreach (var goods in entity.goods)
                    {
                        if (!string.IsNullOrWhiteSpace(goods.img))
                        {
                            goods.img = Config.GetValue("BackGroundServer") + goods.img;
                        }
                        goods.lbs = this._lable.GetLables((int)Entity.Enum.RelateEnum.label, goods.id);
                    }
                }
                list.Add(entity);
            }

            _Response result = new _Response(true);

            result.body       = list;
            result.totalCount = list.Count;

            return(result);
        }
Example #2
0
        public _Response CreateOrder(string json)
        {
            //JObject obj = JObject.Parse(json);
            //int num = Convert.ToInt32(obj["num"]);
            T_orderDetail list = JSONHelper.JsonToObject <T_orderDetail>(json);

            T_Order order = T_Order.createEntiy();

            order.orderNumber    = list.num;
            order.orderSumPrice  = list.sumPrice;
            order.orderUser      = list.user.userID;
            order.orderUserName  = list.user.userName;
            order.orderUserPhone = list.user.userPhone;
            order.orderUserAdder = list.user.userAddress;

            int result = _order.SaveOrder(order);

            if (result > 0)
            {
                foreach (var item in list.list)
                {
                    item.orderid      = result;
                    item.GoodsInfoStr = string.Join(",", item.GoodsInfo);
                    item.createTime   = DateTime.Now;
                    _order.SaveOrderDetail(item);
                }
            }

            _Response response = new _Response(true);

            response.body = "数据保存成功";

            return(response);
        }
Example #3
0
        public _Response GetMenus()
        {
            List <T_Lable> entity = this._lable.GetLables((int)Entity.Enum.RelateEnum.tea);

            menus = entity;
            _Response result = new _Response(true);

            result.body       = entity;
            result.totalCount = entity.Count;

            return(result);
        }
Example #4
0
        public _Response GeTxtPage(string json)
        {
            JObject obj = JObject.Parse(json);

            int pageIndex = Convert.ToInt32(obj["pageIndex"]);

            List <int> ids = new List <int>();

            for (int i = 0; i < 10;)
            {
                int num = new Random().Next(2000);
                if (num > 1999)
                {
                    continue;
                }
                if (!ids.Contains(num))
                {
                    ids.Add(num);
                    i++;
                }
            }

            List <youdaoQusery> rows = _youdao.GeTxtPage(pageIndex, string.Join(",", ids));

            List <youdaoResponse> list = new List <youdaoResponse>();

            foreach (var item in rows)
            {
                if (!string.IsNullOrWhiteSpace(item.responseJson))
                {
                    youdaoResponse response = JSONHelper.JSONToObject <youdaoResponse>(item.responseJson);
                    list.Add(response);
                }
            }
            _Response result = new _Response(true);

            result.body = list;

            return(result);
        }
Example #5
0
        /// <summary>
        /// 俱乐部成员信息
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public _Response GetShopInfo(string json)
        {
            //JObject obj = JObject.Parse(json);

            //int userid = Convert.ToInt32(obj["userid"]);

            T_ShopInfo entity = this._shop.GetShopinfo(1);

            if (entity != null && !string.IsNullOrWhiteSpace(entity.logo))
            {
                if (!string.IsNullOrWhiteSpace(entity.logo))
                {
                    entity.logo = Config.GetValue("BackGroundServer") + entity.logo;
                }
            }

            _Response result = new _Response(true);

            result.body = entity;

            return(result);
        }
Example #6
0
        /// <summary>
        /// 获取图片地址
        /// </summary>
        /// <returns></returns>
        public _Response GetNoticeImgs()
        {
            string path = HttpContext.Current.Server.MapPath("~/Content/NoticeImg");

            string[] imgurl = Common.FileHelper.Context().GetFileNames(path);
            for (int i = 0; i < imgurl.Count(); i++)
            {
                string tmpRootDir = HttpContext.Current.Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString()); //获取程序根目录

                string imagesurl2 = imgurl[i].Replace(tmpRootDir, "");                                                                     //转换成相对路径

                imagesurl2 = imagesurl2.Replace(@"\", @"/");

                imgurl[i] = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + "/" + imagesurl2;
            }

            _Response result = new _Response(true);

            result.body = imgurl;

            return(result);
        }