public void Delete(webReq req) { var id = req.riderId; //int id = Convert.ToInt32(Request["riderId"]); RiderInfoOper.Instance.Delete(id); }
public string Get(webReq req) { ResultForWeb r = new ResultForWeb(); r.HttpCode = 200; r.Message = ""; r.data = "{}"; string search = req.search == null ? "" : req.search; //搜索内容 int index = Convert.ToInt32(req.index); //页码 int pages = 0; //总页数 int size = 12; //一页size条数据 var condition = " isdeleted=0 and (areaName like '%" + search + "%' or areaNo like '%" + search + "%' ) "; var listAll = CacheHelper.GetDistinctCount <AreaInfo>("areainfo", condition); 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 viewList = CacheHelper.GetByIds <AreaInfo>("AreaInfo", ids); var count = listAll.Count; pages = count / size; //总页数 pages = pages * size == count ? pages : pages + 1; r.data = JsonHelperHere.JsonResult(pages, viewList, index); return(JsonConvert.SerializeObject(r)); }
public void BatchDel(webReq req) { string[] ids = Request.Form.GetValues("ids[]"); for (int i = 0; i < ids.Length; i++) { RiderStockOper.Instance.Delete(Convert.ToInt32(ids[i])); } }
public string Update(webReq req) { ResultForWeb r = new ResultForWeb { HttpCode = 200, Message = "", data = "{}" }; var createTime = req.createTime; var status = req.status; var isActual = Convert.ToBoolean(req.isActual); var remarks = req.remarks; var riderId = req.riderId; var orderAreaId = req.orderAreaId; var endTime = req.endTime; var riderComment = req.riderComment; var useBalance = req.useBalance; var useCoupon = req.useCoupon; var deposit = req.deposit; var payTime = req.payTime; var payType = req.payType; var payMoney = req.payMoney; var foodIds = req.foodIds; var amounts = req.amounts; var orderId = req.orderId; OrderInfo order = new OrderInfo(); order.createTime = Convert.ToDateTime(createTime); order.status = Convert.ToInt32(status); order.isActual = isActual; order.remarks = remarks; order.riderId = riderId; order.orderAreaId = orderAreaId; if (endTime < new DateTime(2017, 1, 1)) { order.endTime = Convert.ToDateTime(endTime); } order.riderComment = riderComment; order.useBalance = useBalance; order.useCoupon = useCoupon; order.deposit = deposit; order.payTime = Convert.ToDateTime(payTime); order.payType = payType; order.payMoney = payMoney; order.id = orderId; OrderInfoOper.Instance.Update(order); var listFoods = new List <foodId_Amount>(); for (int i = 0; i < foodIds.Length; i++) { foodId_Amount fa = new foodId_Amount(Convert.ToInt32(foodIds[i]), Convert.ToInt32(amounts[i])); listFoods.Add(fa); } OrderFoodsOper.Instance.UpdateOrderFoodsForWeb(orderId, listFoods); return(JsonConvert.SerializeObject(r)); }
public string Get(webReq req) { var set = new SettingRes(); var days = Convert.ToInt32(set.couponSaveDays); int isUse = req.isUse; string search = Request["search"] == null ? "" : Request["search"]; //搜索内容 int index = Convert.ToInt32(Request["index"]); //页码 var batch = Request["batch"]; var isRepeat = Convert.ToInt32(req.isRepeat); int pages = 0; //总页数 int size = 12; //一页size条数据 var condition = " isdeleted=0 and "; if (isUse != 2) { condition += " isuse=" + isUse + " and "; } if (batch != "0") { condition += " batch=" + batch + " and "; } if (isRepeat != 2) { condition += " isRepeat=" + isRepeat + " and "; } condition += " (batch like '%" + search + "%' or couponNo like '%" + search + "%' )"; var listAll = CacheHelper.GetDistinctCount <Coupon>("Coupon", condition); if (listAll.Count < 1) { return(JsonHelperHere.EmptyJson()); } //分页 var ids = listAll.Skip((index - 1) * size).Take(size).Select(p => p.id).ToArray(); if (ids.Length < 1) { return(JsonHelperHere.EmptyJson()); } var idsStr = string.Join(",", ids); //查具体信息 var viewList = CacheHelper.GetByCondition <Coupon>("Coupon", " id in (" + idsStr + ")"); var count = listAll.Count; pages = count / size; //总页数 pages = pages * size == count ? pages : pages + 1; var listR = new List <CouponRes>(); foreach (var item in viewList) { CouponRes t = new CouponRes(item, days); listR.Add(t); } return(JsonHelperHere.JsonAddPage(pages, JsonConvert.SerializeObject(listR.OrderByDescending(p => p.id)), index)); }
public string CreateCode(webReq req) { ResultForWeb r = new ResultForWeb { HttpCode = 200, Message = "", data = "{}" }; var money = Convert.ToDecimal(req.couponMoney); var cname = req.name; var isRepeat = req.isRepeat == "1" ? true : false; var amount = Convert.ToInt32(req.amount); if (ControllerHelper.Instance.IsExists("coupon", "name", cname, "0")) { r.Message = "已存在该名称"; r.HttpCode = 500; return(JsonConvert.SerializeObject(r)); } var url = apiHost + "/coupon/download?#"; var timeStamp = StringHelperHere.Instance.GetTimeStamp(); var lastId = CouponOper.Instance.GetLastCoupon(); string key = "fdCkey"; var now = DateTime.Now; var path = Server.MapPath("~/") + "/img/coupon/" + cname; path = path.Replace('/', '\\'); for (int i = 0; i < amount; i++) { Coupon coupon = new Coupon(); lastId++; var no = StringHelperHere.Instance.GetLastFiveStr(lastId.ToString()); var ran = RandHelper.Instance.Str_char(1, true).ToLower(); var word = StringHelperHere.Instance.IntToKey(no); var couponNo = StringHelperHere.Instance.Encrypt(word, ran + key) + ran; coupon.batch = timeStamp; coupon.couponNo = couponNo; coupon.createTime = now; coupon.money = money; coupon.isRepeat = isRepeat; coupon.name = cname; CouponOper.Instance.Add(coupon); var bitmap = QCodeHelper.Instance.Create_ImgCode(url + couponNo, 32); DirectorySecurity ds = new DirectorySecurity(); ds.SetAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Allow)); Directory.CreateDirectory(path, ds); var name = couponNo; var pathStr = path + "\\" + name + ".jpg"; bitmap.Save(pathStr, System.Drawing.Imaging.ImageFormat.Jpeg); } QCodeHelper.Instance.PackageFolder(path, path + ".zip", true); return(JsonConvert.SerializeObject(r)); //return JsonHelper.Instance.JsonMsg(true, ""); }
public string Add(webReq req) { ResultForWeb r = new ResultForWeb(); r.HttpCode = 200; r.Message = ""; r.data = "{}"; if (Session["pfId"] == null) { r.HttpCode = 300; return(JsonConvert.SerializeObject(r)); } var phone = req.userPhone; var birthday = req.birthday; if (ControllerHelper.Instance.IsExists("userinfo", "userphone", phone, "0")) { r.Message = "已存在该手机号的用户"; r.HttpCode = 500; return(JsonConvert.SerializeObject(r)); } UserInfo user = new UserInfo(); user.userName = req.userName; var balance = Convert.ToDecimal(req.userBalance); var coupon = Convert.ToDecimal(req.coupon); if (balance < 0) { r.Message = "余额不能为负数"; r.HttpCode = 500; return(JsonConvert.SerializeObject(r)); } if (coupon < 0) { r.Message = "优惠券不能为负数"; r.HttpCode = 500; return(JsonConvert.SerializeObject(r)); } //user.userBalance = balance; if (req.userPwd != null) { user.userPwd = MD5Helper.Instance.StrToMD5(req.userPwd); } user.userPhone = phone; if (!string.IsNullOrEmpty(birthday)) { user.birthday = Convert.ToDateTime(birthday); } user.coupon = coupon; UserInfoOper.Instance.Add(user); r.data = ""; return(JsonConvert.SerializeObject(r)); }
public void upFood(webReq req) { var id = req.foodId; FoodInfo food = new FoodInfo(); food.id = id; food.isOn = true; FoodInfoOper.Instance.Update(food); }
/// <summary> /// 菜品上架 /// </summary> /// <param name="req"></param> /// <returns></returns> public void Up(webReq req) { var foodId = req.foodId; FoodInfo food = new FoodInfo(); food.id = foodId; food.isDeleted = false; FoodInfoOper.Instance.Update(food); }
public void BatchDel(webReq req) { string[] ids = Request.Form.GetValues("ids[]"); //var ids = req.ids; for (int i = 0; i < ids.Length; i++) { DoDelete(Convert.ToInt32(ids[i])); } }
public string delete(webReq req) { var id = req.id; Platform pf = new Platform(); pf.id = id; pf.isDeleted = true; PlatformOper.Instance.Update(pf); return(JsonHelperHere.JsonMsg(true, "")); }
public string DownArticle(webReq req) { ArticleInfo article = new ArticleInfo(); article.id = req.articleId; article.status = false; article.lastTime = DateTime.Now; ArticleInfoOper.Instance.Update(article); return(JsonHelperHere.JsonMsg(true, "已撤下")); }
public string Delete(webReq req) { ResultForWeb r = new ResultForWeb(); r.HttpCode = 200; r.Message = ""; r.data = "{}"; DoDelete(Convert.ToInt32(req.foodTagId)); return(JsonConvert.SerializeObject(r)); }
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)); }
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)); }
public void BatchDel(webReq req) { var serverPath = this.Server.MapPath(""); string[] ids = Request.Form.GetValues("ids[]"); //var b = req.ids; for (int i = 0; i < ids.Length; i++) { ArticleInfoOper.Instance.Delete(Convert.ToInt32(ids[i]), this.Server.MapPath("")); } }
public void Update(webReq req) { var createTime = Request["createTime"]; var status = req.status; var isActual = Convert.ToBoolean(Request["isActual"]); var remarks = Request["remarks"]; var riderId = req.riderId; var orderAreaId = req.orderAreaId; var endTime = Request["endTime"]; var riderComment = Request["riderComment"]; var useBalance = req.useBalance; var useCoupon = req.useCoupon; var deposit = req.deposit; var payTime = Request["payTime"]; var payType = req.payType; var payMoney = req.payMoney; var foodIds = Request.Form.GetValues("foodIds[]"); var amounts = Request.Form.GetValues("amounts[]"); var orderId = req.orderId; OrderInfo order = new OrderInfo(); order.createTime = Convert.ToDateTime(createTime); order.status = Convert.ToInt32(status); order.isActual = isActual; order.remarks = remarks; order.riderId = riderId; order.orderAreaId = orderAreaId; if (endTime != "") { order.endTime = Convert.ToDateTime(endTime); } order.riderComment = riderComment; order.useBalance = useBalance; order.useCoupon = useCoupon; order.deposit = deposit; order.payTime = Convert.ToDateTime(payTime); order.payType = payType; order.payMoney = payMoney; order.id = orderId; OrderInfoOper.Instance.Update(order); var listFoods = new List <foodId_Amount>(); for (int i = 0; i < foodIds.Length; i++) { foodId_Amount fa = new foodId_Amount(Convert.ToInt32(foodIds[i]), Convert.ToInt32(amounts[i])); listFoods.Add(fa); } OrderFoodsOper.Instance.UpdateOrderFoodsForWeb(orderId, listFoods); //OrderInfo type = new OrderInfo(); ////type.comment = Request["comment"]; //type.id = Convert.ToInt32(Request["foodTypeId"]); //DoUpdate(type); }
public void Add(webReq req) { AreaInfo area = new AreaInfo(); area.lat1 = Convert.ToDecimal(req.lat1); area.lng1 = Convert.ToDecimal(req.lng1); area.lat2 = Convert.ToDecimal(req.lat2); area.lng2 = Convert.ToDecimal(req.lng2); area.areaNo = req.areaNo; area.areaName = req.areaName; AreaInfoOper.Instance.Add(area); }
public void Add(webReq req) { var riderId = Convert.ToInt32(Request["riderId"]); var foodId = Convert.ToInt32(Request["foodId"]); var amount = Convert.ToInt32(Request["amount"]); RiderStock rs = new RiderStock(); rs.foodId = foodId; rs.riderId = riderId; rs.amount = amount; RiderStockOper.Instance.Add(rs); }
public string Delete(webReq req) { ResultForWeb r = new ResultForWeb { HttpCode = 200, Message = "", data = "{}" }; DoDelete(Convert.ToInt32(req.areaId)); return(JsonConvert.SerializeObject(r)); }
//用 public string GetFoodDictForWeb(webReq req) { var dict = FoodInfoOper.Instance.GetFoods(); List <foodId_name_amount_price_isMain> listFoods = new List <foodId_name_amount_price_isMain>(); foreach (var item in dict) { foodId_name_amount_price_isMain fn = new foodId_name_amount_price_isMain(item, 1); listFoods.Add(fn); } return(JsonConvert.SerializeObject(listFoods)); }
public void BatchDel(webReq req) { //var ids = req.ids; string[] ids = Request.Form.GetValues("ids[]"); for (int i = 0; i < ids.Length; i++) { DoDelete(Convert.ToInt32(ids[i])); } var temps = Array.ConvertAll <string, int>(ids, s => int.Parse(s)); RiderStockOper.Instance.DeleteRsByFoodId(temps); }
public string Delete(webReq req) { ResultForWeb r = new ResultForWeb { HttpCode = 200, Message = "", data = "{}" }; CouponOper.Instance.Delete(Convert.ToInt32(req.couponId)); return(JsonConvert.SerializeObject(r)); }
public void Update(webReq req) { var id = Convert.ToInt32(Request["id"]); var foodId = Convert.ToInt32(Request["foodId"]); var amount = Convert.ToInt32(Request["amount"]); RiderStock rs = new RiderStock(); rs.id = id; rs.foodId = foodId; rs.amount = amount; RiderStockOper.Instance.Update(rs); }
public string update(webReq req) { ResultForWeb r = new ResultForWeb { HttpCode = 200, Message = "", data = "{}" }; var lv = req.lv; var id = req.id; var thisLv = Convert.ToInt32(Session["lv"]); if (thisLv < lv) { r.Message = "权限不够"; r.HttpCode = 500; return(JsonConvert.SerializeObject(r)); } var account = req.account; if (!StringHelperHere.Instance.IsAccountValidate(account)) { r.Message = "账号应为5~16位英文字母、数字"; r.HttpCode = 500; return(JsonConvert.SerializeObject(r)); } if (ControllerHelper.Instance.IsExists("platform", "account", account, id.ToString())) { r.Message = "已存在该账号"; r.HttpCode = 500; return(JsonConvert.SerializeObject(r)); } var pwd = req.pwd; if (!StringHelperHere.Instance.IsPwdValidate(pwd)) { r.Message = "密码应为6~16位英文字母、数字"; r.HttpCode = 500; return(JsonConvert.SerializeObject(r)); } Platform pf = new Platform(); pf.id = id; pf.level = lv; pf.account = account; pf.pwd = pwd; PlatformOper.Instance.Update(pf); //return JsonHelperHere.JsonMsg(true, ""); return(JsonConvert.SerializeObject(r)); }
public void Update(webReq req) { AreaInfo area = new AreaInfo(); area.lat1 = Convert.ToDecimal(req.lat1); area.lng1 = Convert.ToDecimal(req.lng1); area.lat2 = Convert.ToDecimal(req.lat2); area.lng2 = Convert.ToDecimal(req.lng2); area.areaNo = req.areaNo; area.areaName = req.areaName; area.id = Convert.ToInt32(req.areaId); AreaInfoOper.Instance.Update(area); }
/// <summary> /// 获取周标签 /// </summary> /// <returns></returns> public string GetWeekTags(webReq req) { ResultForWeb r = new ResultForWeb { HttpCode = 200, Message = "", data = "{}" }; var list = CacheHelper.GetByCondition <FoodTagInfo>("foodtaginfo", " isdeleted=0 and isWeek=1"); r.data = JsonHelperHere.JsonPlus(true, JsonConvert.SerializeObject(list), ""); return(JsonConvert.SerializeObject(r)); }
public string Delete(webReq req) { ResultForWeb r = new ResultForWeb { HttpCode = 200, Message = "", data = "{}" }; var id = req.riderId; RiderInfoOper.Instance.Delete(id); return(JsonConvert.SerializeObject(r)); }
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)); }
public string Delete(webReq req) { ResultForWeb r = new ResultForWeb { HttpCode = 200, Message = "", data = "{}" }; var serverPath = this.Server.MapPath("/"); ArticleInfoOper.Instance.Delete(Convert.ToInt32(req.articleId), serverPath); return(JsonConvert.SerializeObject(r)); }