Ejemplo n.º 1
0
        /// <summary>
        /// update
        /// </summary>
        /// <param name="txyInfo"></param>
        /// <returns></returns>
        public void Update(txyInfo model)
        {
            var str  = GetUpdateStr(model);
            var dict = GetParameters(model);

            SqlHelperHere.ExcuteNon(str, dict);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取已发布的文章数量
        /// </summary>
        /// <returns></returns>
        public int GetArticleCount()
        {
            string str = "select Count(*) from articleInfo where isarticle=1 and status=1 and isdeleted=0 ";
            var    dt  = SqlHelperHere.ExecuteScalar(str);

            return(Convert.ToInt32(dt));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取所有的batch
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, string> GetTs()
        {
            string str = "select distinct batch,name from coupon where isdeleted=0";
            var    dt  = SqlHelperHere.ExecuteGetDt(str);

            return(dt.ConvertToList <Coupon>().Select(p => new { p.batch, p.name }).ToDictionary(p => p.batch, p => p.name));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// add
        /// </summary>
        /// <param name="OrderFoods"></param>
        /// <returns></returns>
        public int Add(OrderFoods model)
        {
            var str  = GetInsertStr(model) + " select @@identity";
            var dict = GetParameters(model);

            return(Convert.ToInt32(SqlHelperHere.ExecuteScalar(str, dict)));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取最后一个公告
        /// </summary>
        /// <returns></returns>
        public ArticleInfo GetLastNotice()
        {
            string str = "select top 1 * from articleInfo where isarticle=0 and status=1 and isdeleted=0 order by id desc";
            var    dt  = SqlHelperHere.ExecuteGetDt(str);

            return(dt.ConvertToList <ArticleInfo>().FirstOrDefault());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 后台删除某些菜品时,所有骑手库存都要删掉
        /// </summary>
        /// <param name="foodId"></param>
        public void DeleteRsByFoodId(int[] foodIds)
        {
            var    idsStr = string.Join(",", foodIds);
            string str    = " update riderstock set isdeleted=1 where foodId in (" + idsStr + ")";

            SqlHelperHere.ExcuteNon(str);
        }
Ejemplo n.º 7
0
        public void DeleteByTs(string ts)
        {
            string str  = "update coupon set isdeleted=1 where batch=@ts";
            var    dict = new Dictionary <string, string>();

            dict.Add("@ts", ts);
            SqlHelperHere.ExcuteNon(str, dict);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 根据用户id获取的最新的一个订单 status 1或2
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public int GetSendingOrderIdsByUserId(int userId)
        {
            string str  = "select top 1 id from orderinfo where   isdeleted = 0 and status in (1,2) and userid=@userId order by id desc";
            var    dict = new Dictionary <string, string>();

            dict.Add("@userId", userId.ToString());
            return(Convert.ToInt32(SqlHelperHere.ExecuteScalar(str, dict)));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// update
        /// </summary>
        /// <param name="RiderStock"></param>
        /// <returns></returns>
        public void Update(RiderStock model)
        {
            CacheHelper.LockCache("RiderStock");
            var str  = GetUpdateStr(model);
            var dict = GetParameters(model);

            SqlHelperHere.ExcuteNon(str, dict);
            CacheHelper.ReleaseLock("RiderStock");
        }
Ejemplo n.º 10
0
        /// <summary>
        /// update
        /// </summary>
        /// <param name="AllocateRecord"></param>
        /// <returns></returns>
        public void Update(AllocateRecord model)
        {
            CacheHelper.LockCache("AllocateRecord");
            var str  = GetUpdateStr(model);
            var dict = GetParameters(model);

            SqlHelperHere.ExcuteNon(str, dict);
            CacheHelper.ReleaseLock("AllocateRecord");
        }
Ejemplo n.º 11
0
        /// <summary>
        /// update
        /// </summary>
        /// <param name="ArticleInfo"></param>
        /// <returns></returns>
        public void Update(ArticleInfo model)
        {
            //CacheHelper.LockCache("ArticleInfo");
            var str  = GetUpdateStr(model);
            var dict = GetParameters(model);

            SqlHelperHere.ExcuteNon(str, dict);
            //CacheHelper.ReleaseLock("ArticleInfo");
        }
Ejemplo n.º 12
0
        /// <summary>
        /// update
        /// </summary>
        /// <param name="OrderFoods"></param>
        /// <returns></returns>
        public void Update(OrderFoods model)
        {
            //CacheHelper.LockCache("OrderFoods");
            var str  = GetUpdateStr(model);
            var dict = GetParameters(model);

            SqlHelperHere.ExcuteNon(str, dict);
            //CacheHelper.ReleaseLock("OrderFoods");
        }
Ejemplo n.º 13
0
        /// <summary>
        /// update
        /// </summary>
        /// <param name="Suggestion"></param>
        /// <returns></returns>
        public void Update(Suggestion model)
        {
            //CacheHelper.LockCache("Suggestion");
            var str  = GetUpdateStr(model);
            var dict = GetParameters(model);

            SqlHelperHere.ExcuteNon(str, dict);
            //CacheHelper.ReleaseLock("Suggestion");
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 获取某用户使用app的最后一条记录
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public UserOpenInfo GetLastByUserId(int userId)
        {
            string str  = "select top 1 * from UserOpenInfo where userid=@userId order by id desc";
            var    dict = new Dictionary <string, string>();

            dict.Add("@userId", userId.ToString());
            var dt = SqlHelperHere.ExecuteGetDt(str, dict);

            return(dt.ConvertToList <UserOpenInfo>().FirstOrDefault());
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 获取同批次第一个记录
        /// </summary>
        /// <param name="ts"></param>
        /// <returns></returns>
        public Coupon GetFirstByTs(string ts)
        {
            string str  = "select top 1 * from coupon where batch=@ts";
            var    dict = new Dictionary <string, string>();

            dict.Add("@ts", ts);
            var dt = SqlHelperHere.ExecuteGetDt(str, dict);

            return(dt.ConvertToList <Coupon>().FirstOrDefault());
        }
Ejemplo n.º 16
0
        public string Get(webReq req)
        {
            var    status      = req.status;
            string search      = req.search == null ? "" : req.search; //搜索内容
            int    index       = Convert.ToInt32(req.index);           //页码
            int    articleType = Convert.ToInt32(req.articleType);
            int    pages       = 0;                                    //总页数
            int    size        = 12;                                   //一页size条数据

            var condition = " isdeleted=0 ";

            if (articleType != 2)
            {
                condition += " and isarticle = " + articleType;
            }

            if (status != 2)
            {
                condition += " and status = " + status;
            }

            condition += " and ( articleName like '%" + search + "%' or content like '%" + search + "%' )";

            string str     = "select id,lasttime,status from articleInfo where " + condition + " order by status desc,lastTime desc";
            var    listAll = SqlHelperHere.ExecuteGetList <ArticleInfo>(str);

            if (listAll.Count < 1)
            {
                return(JsonHelperHere.EmptyJson());
            }
            var ids = listAll.Skip((index - 1) * size).Take(size).Select(p => p.id).ToArray();

            if (ids.Count() < 1)
            {
                return(JsonHelperHere.EmptyJson());
            }
            var idsStr = string.Join(",", ids);

            var list = CacheHelper.GetByCondition <ArticleView>("ArticleView", " id in (" + idsStr + ")");

            var count = listAll.Count;

            pages = count / size;
            //总页数
            pages = pages * size == count ? pages : pages + 1;
            var listR = new List <ArticleViewForWeb>();

            foreach (var item in list)
            {
                ArticleViewForWeb temp = new ArticleViewForWeb(item);
                listR.Add(temp);
            }

            return(JsonHelperHere.JsonAddPage(pages, JsonConvert.SerializeObject(listR.OrderByDescending(p => p.status).ThenBy(p => p.lastTime)), index));
        }
Ejemplo n.º 17
0
        public string GetDownloadList(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            string search    = req.search == null ? "" : req.search; //搜索内容
            int    index     = Convert.ToInt32(req.index);           //页码
            int    pages     = 0;                                    //总页数
            int    size      = 12;                                   //一页size条数据
            var    isRepeat  = Convert.ToInt32(req.isRepeat);
            var    condition = " ";

            if (isRepeat != 2)
            {
                condition += " isRepeat=" + isRepeat + " and ";
            }
            condition += " 1=1 and  name like '%" + search + "%' ";

            string str     = "select * from couponView where " + condition + " order by createTime desc";
            var    listAll = SqlHelperHere.ExecuteGetList <CouponView>(str);

            if (listAll.Count < 1)
            {
                r.data = JsonHelperHere.EmptyJson();
                return(JsonConvert.SerializeObject(r));
            }
            //分页
            var list2 = listAll.Skip((index - 1) * size).Take(size).ToArray();

            if (list2.Length < 1)
            {
                r.data = JsonHelperHere.EmptyJson();
                return(JsonConvert.SerializeObject(r));
            }

            var count = listAll.Count;

            pages = count / size;
            //总页数
            pages = pages * size == count ? pages : pages + 1;
            var listR = new List <DownList>();

            foreach (var item in list2)
            {
                DownList d = new DownList(item);
                listR.Add(d);
            }

            r.data = JsonHelperHere.JsonAddPage(pages, JsonConvert.SerializeObject(listR), index);
            return(JsonConvert.SerializeObject(r));
        }
Ejemplo n.º 18
0
        public int[] GetIdsByTs(string ts)
        {
            string str  = "select top 1 ids from coupon where batch=@ts";
            var    dict = new Dictionary <string, string>();

            dict.Add("@ts", ts);
            var idsStr = SqlHelperHere.ExecuteScalar(str, dict);
            var r      = idsStr.Split(',');

            return(Array.ConvertAll(r, int.Parse));
            //return r;
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 增加骑手配送次数
        /// </summary>
        /// <param name="riderId"></param>
        public void AddRiderSendCount(int riderId)
        {
            string str = "update RiderInfo set sendCount=sendCount+1 where id=" + riderId;

            SqlHelperHere.ExcuteNon(str);

            //var rider = GetById(riderId);
            ////rider.sendCount += 1;
            //var riderHere = new RiderInfo();
            //riderHere.id = riderId;
            //riderHere.sendCount = rider.sendCount + 1;
            //Update(riderHere);
        }
Ejemplo n.º 20
0
        public string BatchDel(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var ids = req.ids;

            SqlHelperHere.DeleteByIds("orderinfo", ids);
            return(JsonConvert.SerializeObject(r));
        }
Ejemplo n.º 21
0
        public void BatchDel(webReq req)
        {
            //var ids = req.ids;
            var ids   = Request.Form.GetValues("ids[]");
            var temps = Array.ConvertAll <string, int>(ids, s => int.Parse(s));

            SqlHelperHere.DeleteByIds("orderinfo", temps);
            //string str = "update set ";
            ////string[] ids = Request.Form.GetValues("ids[]");
            //for (int i = 0; i < ids.Length; i++)
            //{
            //    DoDelete(ids[i]);
            //}
        }
Ejemplo n.º 22
0
        public string GetDownloadList(webReq req)
        {
            string search    = Request["search"] == null ? "" : Request["search"]; //搜索内容
            int    index     = Convert.ToInt32(Request["index"]);                  //页码
            int    pages     = 0;                                                  //总页数
            int    size      = 12;                                                 //一页size条数据
            var    isRepeat  = Convert.ToInt32(req.isRepeat);
            var    condition = " ";

            if (isRepeat != 2)
            {
                condition += " isRepeat=" + isRepeat + " and ";
            }
            condition += " 1=1 and  name like '%" + search + "%' ";

            string str     = "select * from couponView where " + condition + " order by createTime desc";
            var    listAll = SqlHelperHere.ExecuteGetList <CouponView>(str);

            if (listAll.Count < 1)
            {
                return(JsonHelperHere.EmptyJson());
            }
            //分页
            var list2 = listAll.Skip((index - 1) * size).Take(size).ToArray();

            if (list2.Length < 1)
            {
                return(JsonHelperHere.EmptyJson());
            }
            //var idsStr = string.Join(",", ids);
            //查具体信息
            //var viewList = CacheHelper.GetByCondition<CouponView>("CouponView", " name in (" + idsStr + ")");


            var count = listAll.Count;

            pages = count / size;
            //总页数
            pages = pages * size == count ? pages : pages + 1;
            var listR = new List <DownList>();

            foreach (var item in list2)
            {
                DownList d = new DownList(item);
                listR.Add(d);
            }

            return(JsonHelperHere.JsonAddPage(pages, JsonConvert.SerializeObject(listR), index));
        }
Ejemplo n.º 23
0
        public string Get(webReq req)
        {
            ResultForWeb r = new ResultForWeb();

            r.HttpCode = 200;
            r.Message  = "";
            r.data     = "{}";
            if (Session["pfId"] == null)
            {
                r.HttpCode = 300;
                return(JsonConvert.SerializeObject(r));
            }
            string search = req.search ?? "";           //搜索内容
            int    index  = Convert.ToInt32(req.index); //页码

            int pages = 0;                              //总页数
            int size  = 12;                             //一页size条数据

            var condition = " type = 99 and status = 0 ";

            condition += " and (takeTypeName like '%" + search + "%' or username like '%" + search + "%' or userphone like '%" + search + "%' ) order by createTime desc ";

            string str     = "select distinct id,createTime from userpayview where 1=1 and " + condition;
            var    dt      = SqlHelperHere.ExecuteGetDt(str);
            var    listAll = dt.ConvertToList <UserPayView>();

            var ids      = listAll.Skip((index - 1) * size).Take(size).Select(p => p.id).ToArray();
            var idsStr   = string.Join(",", ids);
            var viewList = CacheHelper.GetByCondition <UserPayView>("UserPayView", " id in (" + idsStr + ")");

            var count = listAll.Count;

            pages = count / size;
            pages = pages * size == count ? pages : pages + 1;//总页数
            var listR = new List <UserPayViewRes>();

            foreach (var item in viewList)
            {
                UserPayViewRes temp = new UserPayViewRes(item);
                listR.Add(temp);
            }

            r.data = JsonHelperHere.JsonAddPage(pages, JsonConvert.SerializeObject(listR.OrderByDescending(p => p.id)), index);
            return(JsonConvert.SerializeObject(r));
        }
Ejemplo n.º 24
0
        public ActionResult Index()
        {
            if (Session["pfId"] != null)
            {
                var days = Convert.ToInt32(new SettingRes().couponSaveDays);
                //过时的二维码图片和zip删掉
                ControllerHelper.Instance.ClearTempQCode(this.Server.MapPath("/Img/coupon"), days);
                //过时的优惠券删掉
                string str = "update Coupon set isDeleted=1 where  DATEDIFF(SECOND, createTime, GETDATE())>" + days * 24 * 3600;
                SqlHelperHere.ExcuteNon(str);
                var tsDict = CouponOper.Instance.GetTs();
                ViewBag.tss = tsDict;

                return(View());
            }
            else
            {
                return(View("_Login"));
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 清除过期的预定菜品
        /// </summary>
        public void ClearWeekFood()
        {
            var now = Convert.ToInt32(DateTime.Now.DayOfWeek);

            now = now == 0 ? 7 : now;
            var    dt   = DateTime.Now.AddDays((7 - now) - 14);
            string str  = "select id from foodview where isWeek=0 and foodTime<'" + dt.ToString("yyyy-MM-dd") + "'";
            var    list = SqlHelperHere.ExecuteGetList <FoodView>(str);

            if (list.Count > 0)
            {
                foreach (var item in list)
                {
                    var food = new FoodInfo();
                    food.id        = item.id;
                    food.isDeleted = true;
                    food.isOn      = false;
                    FoodInfoOper.Instance.Update(food);
                }
            }
        }
Ejemplo n.º 26
0
        public string Get(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };

            FoodInfoOper.Instance.ClearWeekFood();



            var isOn      = req.isOn;
            var orderStr  = req.orderStr;
            var desc      = req.desc;
            var isDeleted = req.isDeleted;
            Dictionary <int, string> dict = FoodTagInfoOper.Instance.GetFoodTypeDict();
            string search     = req.search == null ? "" : req.search;//搜索内容
            string isWeekTemp = req.isWeek;
            var    isMainTemp = req.isMain;
            var    weekTag    = req.weekTag;
            var    isDeposit  = req.isDeposit;

            int index = req.index; //页码
            int pages = 0;         //总页数
            int size  = 12;        //一页size条数据

            //查询条件
            var condition = " 1=1 and  (foodname like '%" + search + "%' or foodText like '%" + search + "%' or foodTagName like '%" + search + "%') ";

            if (!string.IsNullOrEmpty(isMainTemp))
            {
                var isMain = 0;
                if (isMainTemp == "true")
                {
                    isMain = 1;
                }
                condition += " and ismain=" + isMain;
            }
            if (!string.IsNullOrEmpty(isWeekTemp) && isWeekTemp != "2")
            {
                condition += " and isweek=" + isWeekTemp;
                if (isWeekTemp == "1" && isOn != 2)
                {
                    condition += " and isOn=" + isOn;
                }
            }
            //else
            condition += " and isdeleted=0 ";

            if (!string.IsNullOrEmpty(isWeekTemp) && isWeekTemp != "0")
            {
                if (weekTag != 0)
                {
                    condition += " and foodTagId=" + weekTag;
                }
            }

            if (isDeposit == 1)
            {
                condition += " and deposit>0";
            }
            else if (isDeposit == 0)
            {
                condition += " and deposit=0";
            }

            string str   = "select id,isdeleted from foodview where " + condition;
            string order = " order by isdeleted,id desc";

            if (string.IsNullOrEmpty(orderStr))
            {
                str += order;
            }
            else
            {
                order = " order by " + orderStr;
                if (desc == 1)
                {
                    order += " desc";
                }
                order += " ,isdeleted,id desc";
                str   += order;
            }

            var dt      = SqlHelperHere.ExecuteGetDt(str);
            var listAll = dt.ConvertToList <FoodView>();

            if (listAll.Count < 1)
            {
                r.data = JsonHelperHere.EmptyJson();
                return(JsonConvert.SerializeObject(r));
            }
            //分页
            var ids    = listAll.Skip((index - 1) * size).Take(size).Select(p => p.id).ToArray();
            var idsStr = string.Join(",", ids);

            var viewList = CacheHelper.GetByCondition <FoodView>("FoodView", " id in (" + idsStr + ") " + order);

            var count = listAll.Count;

            pages = count / size;
            //总页数
            pages = pages * size == count ? pages : pages + 1;

            r.data = JsonHelperHere.JsonAddPage(pages, JsonConvert.SerializeObject(viewList), index);
            return(JsonConvert.SerializeObject(r));
        }
Ejemplo n.º 27
0
        public int GetLastCoupon()
        {
            string str = "select top 1 id from coupon order by id desc";

            return(Convert.ToInt32(SqlHelperHere.ExecuteScalar(str)));
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 后台删除某种菜品时,所有骑手库存都要删掉
        /// </summary>
        /// <param name="foodId"></param>
        public void DeleteRsByFoodId(int foodId)
        {
            string str = " update riderstock set isdeleted=1 where foodId = " + foodId;

            SqlHelperHere.ExcuteNon(str);
        }