/// <summary> /// 新增商品 /// </summary> private void ShopAdd() { T_Shop shop = new T_Shop { Supplier = new T_Supplier { SupplierID = Convert.ToInt32(HttpContext.Current.Request.Form["Supplier"]) }, ShopType = new T_ShopType { TypeID = Convert.ToInt32(HttpContext.Current.Request.Form["shopType"]) }, ShopCode = HttpContext.Current.Request.Form["ShopCode"].ToString(), Name = HttpContext.Current.Request.Form["ShopName"].ToString(), CostPrice = Convert.ToDecimal(HttpContext.Current.Request.Form["CostPrice"]), SalePrice = Convert.ToDecimal(HttpContext.Current.Request.Form["SalePrice"]), ShelfLife = Convert.ToInt32(HttpContext.Current.Request.Form["ShelfLife"]), }; var obj = new { status = 200, msg = "no" }; if (shopBll.shopAdd(shop)) { obj = new { status = 201, msg = "yes" }; } JavaScriptSerializer js = new JavaScriptSerializer(); string str = js.Serialize(obj); HttpContext.Current.Response.Write(str); HttpContext.Current.Response.End(); }
// GET: Admin/Message public ActionResult Index(int orderId) { T_Order order = null; using (IT_Order repository = new T_OrderRepository()) { order = repository.FindFirstOrDefault(o => o.ID == orderId); } if (order != null) { T_Shop shop = null; using (IT_Shop repository = new T_ShopRepository()) { shop = repository.FindFirstOrDefault(o => o.ID == order.ShopID); } if (shop != null) { WeixinTempMsg.SendCleanMsg(shop.ShopAddress, order.OrderNo, order.BTime, order.ETime, shop.CleanerOpenID); } return(Json("发送成功", JsonRequestBehavior.AllowGet)); } return(Json("发送失败", JsonRequestBehavior.AllowGet)); }
public ActionResult SetupPayType(ShopPayTypeSetupModel model) { JsonModel jm = new JsonModel(); //根据商家ID,获取商家信息 IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); T_Shop shop = shopBll.GetEntity(s => s.Id == model.shopId); // 新建用户角色关联表 List <T_ShopPaymentManagement> payTypes = new List <T_ShopPaymentManagement>(); if (model.ids != null) { foreach (var id in model.ids) { T_ShopPaymentManagement item = new T_ShopPaymentManagement() { ShopId = model.shopId, PayTypeId = id }; payTypes.Add(item); } } //修改商家支付类型集合 if (shopBll.SetupPayTypes(shop, payTypes)) { jm.Content = "商家 " + shop.ShopName + " 设置支付类型"; } else { jm.Msg = "设置支付类型失败"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 商品编辑查询 /// </summary> /// <param name="shopId"></param> /// <returns></returns> public static T_Shop shopEditSelect(int shopId) { string sql = string.Format(@"select ShopCode,T_Shop.Name as ShopName,T_Supplier.SupplierID as SupplierID,SupplierName,CostPrice,SalePrice,ShelfLife,ShopTypeID,T_ShopType.Name as TypeName from T_Shop join T_Supplier on T_Shop.SupplierID = T_Supplier.SupplierID join T_ShopType on T_Shop.ShopTypeID = T_ShopType.TypeID where ShopID={0}", shopId); var db = DBHelper.Read(sql); T_Shop shop = new T_Shop { ShopCode = db.Rows[0]["ShopCode"].ToString(), Name = db.Rows[0]["ShopName"].ToString(), Supplier = new T_Supplier { SupplierID = Convert.ToInt32(db.Rows[0]["SupplierID"].ToString()), SupplierName = db.Rows[0]["SupplierName"].ToString(), }, CostPrice = Convert.ToDecimal(db.Rows[0]["CostPrice"].ToString()), SalePrice = Convert.ToDecimal(db.Rows[0]["SalePrice"].ToString()), ShelfLife = Convert.ToInt32(db.Rows[0]["ShelfLife"].ToString()), ShopType = new T_ShopType { TypeID = Convert.ToInt32(db.Rows[0]["ShopTypeID"].ToString()), Name = db.Rows[0]["TypeName"].ToString() } }; return(shop); }
/// <summary> /// 二期商家结束HTML页面 /// </summary> /// <param name="ShopId">门店ID</param> /// <returns></returns> public ActionResult StoreIntroduce(int ShopId) { //获取要查看详细的门店实体对象 IShopBLL ShopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); T_Shop Shop = ShopBll.GetEntity(s => s.Id == ShopId); return(View(Shop)); }
public ActionResult AddShop(ShopModel model) { JsonModel jm = new JsonModel(); //如果表单模型验证成功 if (ModelState.IsValid) { IShopBLL ShopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); //初始化门店数据 T_Shop newShop = new T_Shop() { ShopName = model.ShopName, Phone = model.Tel, ProvinceId = model.ProvinceId, CityId = model.CityId, CountyId = model.CountyId, Address = model.Address, MainSale = model.MainSale, ShopUserId = model.ShopUserId, Content = model.Content, StartBusinessTime = model.StartBusinessTime, EndBusinessTime = model.EndBusinessTime, UpdateTime = DateTime.Now, Type = model.Types }; //如果服务小区不为空 if (!string.IsNullOrEmpty(model.PlaceIds)) { foreach (var placeId in model.PlaceIds.Split(',')) { newShop.ShopPlaces.Add(new R_ShopPlace() { PropertyPlaceId = Convert.ToInt32(placeId) }); } } //默认支付方式:货到现金支付 newShop.ShopPaymentManagements.Add(new T_ShopPaymentManagement() { PayTypeId = 3 }); // 保存到数据库 ShopBll.Save(newShop); //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } else { // 保存异常日志 jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
void Start() { tShop = GameObject.FindObjectOfType <T_Shop> (); for (int a = 0; a < tShop.ringPriceTexts.Length; a++) { tShop.ringPriceTexts [a].text = tShop.ringPrice [a].ToString(); } // update locks on start UpdateLocks(); }
public ApiResultModel ShopDetail2([FromUri] DetailSearchModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取要查看详细的门店实体对象 IShopBLL ShopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); T_Shop Shop = ShopBll.GetEntity(s => s.Id == model.Id); if (Shop != null) { resultModel.result = new { ShopImg = Shop.ImgPath, ShopInfoPath = "MobilePage/StoreDetail2?ShopId=" + model.Id, }; } else { resultModel.Msg = APIMessage.SHOP_NOEXIST; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ActionResult EditShop(ShopModel model) { JsonModel jm = new JsonModel(); //如果表单验证成功 if (ModelState.IsValid) { IShopBLL ShopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); T_Shop shop = ShopBll.GetEntity(m => m.Id == model.Id); if (shop != null) { shop.ShopName = model.ShopName; shop.Phone = model.Tel; shop.ProvinceId = model.ProvinceId; shop.CityId = model.CityId; shop.CountyId = model.CountyId; shop.Address = model.Address; shop.MainSale = model.MainSale; shop.Content = model.Content; shop.StartBusinessTime = model.StartBusinessTime; shop.EndBusinessTime = model.EndBusinessTime; //shop.IsDelivery = model.IsDelivery ? 1 : 0; shop.Type = model.Types; shop.UpdateTime = DateTime.Now; //修改保存到数据库 if (ShopBll.UpdateShop(shop, model.PlaceIds)) { //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } else { jm.Msg = "编辑失败"; } } else { jm.Msg = "该门店不存在"; } } else { jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public ActionResult SetupPayType(int id) { //根据商家ID,获取商家信息 IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); T_Shop shop = shopBll.GetEntity(s => s.Id == id); //是否是绿色直供 bool isGreenSupplied = shop.Type.Contains(Property.Common.ConstantParam.SHOP_TYPE_0.ToString()); ShopPayTypeModel paytypeModel = new ShopPayTypeModel(); //获取商家信息 paytypeModel.Shop = shop; //获取支付类型 绿色直供包含5种 var PayTypeList = new List <ShopPaymentType>(); if (isGreenSupplied) { PayTypeList.Add(new ShopPaymentType() { TypeId = 1, TypeName = "微信在线支付" }); PayTypeList.Add(new ShopPaymentType() { TypeId = 2, TypeName = "支付宝在线支付" }); } PayTypeList.Add(new ShopPaymentType() { TypeId = 3, TypeName = "货到现金付款" }); PayTypeList.Add(new ShopPaymentType() { TypeId = 4, TypeName = "货到微信付款" }); PayTypeList.Add(new ShopPaymentType() { TypeId = 5, TypeName = "货到支付宝付款" }); paytypeModel.PayTypeList = PayTypeList; //已经分配的支付类型 paytypeModel.PayTypeIds = shop.ShopPaymentManagements.Select(s => s.PayTypeId).ToList(); return(View(paytypeModel)); }
/// <summary> /// 查询商品表 /// </summary> /// <param name="shopName">商品名称</param> /// <returns></returns> public static object ShopSelect(string shopName, int page, int limit) { string sql = string.Format(@"select * from (select ROW_NUMBER() OVER(ORDER BY ShopId desc) as row , T_Shop.ShopID as ShopID ,T_Shop.ShopCode as ShopCode,T_Shop.name as ShopName,T_Supplier.SupplierName as SupplierName, T_Shop.CostPrice as CostPrice, T_Shop.SalePrice as SalePrice,T_Shop.BothTime as BothTime, T_Shop.ShelfLife as ShelfLife, T_ShopType.Name as TypeName from T_Shop join T_Supplier on T_Shop.SupplierID = T_Supplier.SupplierID join T_ShopType on T_Shop.ShopTypeID = T_ShopType.TypeID) o where ShopName like '%{0}%' ", shopName); string sqlpages = sql + string.Format("and o.row between ({0}-1)*{1}+1 and {2}*{3}", page, limit, page, limit); var shopTabCount = DBHelper.Read(sql).Rows.Count; var shopTabPage = DBHelper.Read(sqlpages); List <T_Shop> shoplst = new List <T_Shop>(); foreach (DataRow item in shopTabPage.Rows) { T_Shop shop = new T_Shop { ShopID = Convert.ToInt32(item["ShopID"].ToString()), ShopCode = item["ShopCode"].ToString(), Name = item["ShopName"].ToString(), Supplier = new T_Supplier { SupplierName = item["SupplierName"].ToString() }, CostPrice = Convert.ToDecimal(item["CostPrice"].ToString()), SalePrice = Convert.ToDecimal(item["SalePrice"].ToString()), //BothTime = Convert.ToDateTime(item["BothTime"].ToString()), ShelfLife = Convert.ToInt32(item["ShelfLife"].ToString()), ShopType = new T_ShopType { Name = item["TypeName"].ToString() } }; shoplst.Add(shop); } //定义匿名类型 接受商品总数用于分页 var obj = new { status = shopTabCount, lst = shoplst }; return(obj); }
public JsonResult DelShopImg(int id, string href, string thum) { JsonModel Jm = new JsonModel(); try { IShopBLL shopBLL = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); T_Shop Shop = shopBLL.GetEntity(a => a.Id == id); //删除缩略图路径 int start = Shop.ImgThumbnail.IndexOf(href + ";"); Shop.ImgThumbnail = Shop.ImgThumbnail.Remove(start, href.Length + 1); //获取缩略图片路径 string path = Server.MapPath(href); //删除缩略图片 if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } //获取大图片路径 int thumStart = Shop.ImgPath.IndexOf(thum + ";"); Shop.ImgPath = Shop.ImgPath.Remove(thumStart, thum.Length + 1); string thumPath = Server.MapPath(thum); if (System.IO.File.Exists(thumPath)) { try { //删除原图片 System.IO.File.Delete(thumPath); } catch { } } shopBLL.Update(Shop); //记录log Jm.Content = "删除门店图片" + href; } catch { Jm.Msg = "删除出现异常"; } return(Json(Jm)); }
public HttpResponseMessage DeleteShop(short id) { ResultMsg resultMsg = new ResultMsg(); try { using (IT_Shop repository = new T_ShopRepository()) { T_Shop shop = new T_Shop { ID = id }; repository.Delete(shop); } } catch (Exception ex) { resultMsg.code = (int)StatusCodeEnum.Error; resultMsg.msg = ex.Message; } return(resultMsg.toJson()); }
public HttpResponseMessage EditShop([FromBody] T_Shop shop) { ResultMsg resultMsg = new ResultMsg(); try { using (IT_Shop repository = new T_ShopRepository()) { if (!repository.EditShop(shop)) { resultMsg.code = 1; resultMsg.msg = "修改失败"; } } } catch (Exception ex) { resultMsg.code = (int)StatusCodeEnum.Error; resultMsg.msg = ex.Message; } return(resultMsg.toJson()); }
public IActionResult Add(T_Shop shop) { _BDD.T_Shop.Add(shop); _BDD.SaveChanges(); return RedirectToAction("Add"); }
public HttpResponseMessage XuDingOrderWX([FromBody] T_Order order) { ResultMsg resultMsg = new ResultMsg(); try { order.ETime = order.BTime.AddMinutes(order.Duration); if (order.ETime < DateTime.Now) { resultMsg.code = 1; resultMsg.msg = "预定结束时间必须大于当前时间!"; } else if (order.BTime.Minute != 0 && order.BTime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定开始时间必须以半小时为间隔,如:12:00,12:30!"; } else if (order.ETime.Minute != 0 && order.ETime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定结束时间必须以半小时为间隔,如:14:00,14:30!"; } else if (order.Duration < 30 || order.Duration % 30 != 0) { resultMsg.code = 1; resultMsg.msg = "预定时长至少半小时,时长必须半小时为整"; } else { bool checkOrderTime = false; using (IT_Order repository = new T_OrderRepository()) { checkOrderTime = repository.CheckOrderTime(order); } if (checkOrderTime) { resultMsg.code = 1; resultMsg.msg = "预定时间段被占用,请重新选择预定时间"; } else { T_Order porder = null; using (IT_Order repository = new T_OrderRepository()) { porder = repository.FindFirstOrDefault(o => o.OrderNo == order.ParentNo && o.PayStatus == 1); } if (porder != null) { order.ShopID = porder.ShopID; order.Mobile = porder.Mobile; order.CardNo = porder.CardNo; order.ReMarks = 0; order.Flag = 1; T_Shop shop = null; using (IT_Shop repository = new T_ShopRepository()) { shop = repository.FindFirstOrDefault(o => o.ID == order.ShopID); } if (shop != null) { WK.Tea.Lock.ApiRequest.CreateCardRequest postEntity = new WK.Tea.Lock.ApiRequest.CreateCardRequest { communityNo = "1316882760", roomNo = shop.RoomNo, floorNo = shop.FloorNo, buildNo = shop.BuildNo, startTime = order.BTime.AddMinutes(-15).ToString("yyMMddHHmm"), endTime = order.ETime.AddMinutes(10).ToString("yyMMddHHmm"), mobile = string.IsNullOrWhiteSpace(order.Mobile) ? WK.Tea.Lock.ApiRequest.LockApiHelper.Mobile : order.Mobile }; //WK.Tea.Lock.ApiRequest.CreateCardResponse result = // WK.Tea.Lock.ApiRequest.LockApiHelper.WebApi.Post<WK.Tea.Lock.ApiRequest.CreateCardRequest, WK.Tea.Lock.ApiRequest.CreateCardResponse>("https://api.uclbrt.com/?c=Qrcode&a=getLink", postEntity); using (IT_Order repository = new T_OrderRepository()) { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); order.OrderNo = "XDWX" + Convert.ToInt64(ts.TotalMilliseconds).ToString(); //order.CardNo = result.cardNo; order.ReMarks = 1; order.PayStatus = 0; order.Flag = 0; order.FeeCode = 50; var t = order.Duration - 30; if (t > 0) { order.FeeCode += t / 30 * 50; } order.OpenID = User.Identity.Name; order.CTime = DateTime.Now; order = repository.Insert(order); resultMsg.code = 200; resultMsg.data = order; } } else { resultMsg.code = 1; resultMsg.msg = "门店不存在"; } } else { resultMsg.code = 1; resultMsg.msg = "主订单不存在"; } } } } catch (Exception ex) { resultMsg.code = (int)StatusCodeEnum.Error; resultMsg.msg = ex.Message; } return(resultMsg.toJson()); }
public HttpResponseMessage EditOrderAdmin([FromBody] T_Order order) { ResultMsg resultMsg = new ResultMsg(); try { order.Duration = (int)(order.ETime - order.BTime).TotalMinutes; if (order.BTime.Minute != 0 && order.BTime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定开始时间必须以半小时为间隔,如:12:00,12:30!"; } else if (order.ETime.Minute != 0 && order.ETime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定结束时间必须以半小时为间隔,如:14:00,14:30!"; } else if (order.Duration % 30 != 0) { resultMsg.code = 1; resultMsg.msg = "时长必须半小时为整"; } else { bool checkOrderTime = false; using (IT_Order repository = new T_OrderRepository()) { checkOrderTime = repository.CheckOrderTime(order); } if (order.OrderNo.Substring(0, 1) != "R" && checkOrderTime) { resultMsg.code = 1; resultMsg.msg = "预定时间段被占用,请重新选择预定时间"; } else { T_Shop shop = null; using (IT_Shop repository = new T_ShopRepository()) { shop = repository.FindFirstOrDefault(o => o.ID == order.ShopID); } if (shop != null) { WK.Tea.Lock.ApiRequest.CreateCardRequest postEntity = new WK.Tea.Lock.ApiRequest.CreateCardRequest { communityNo = "1316882760", roomNo = shop.RoomNo, floorNo = shop.FloorNo, buildNo = shop.BuildNo, startTime = order.BTime.AddMinutes(-15).ToString("yyMMddHHmm"), endTime = order.ETime.AddMinutes(10).ToString("yyMMddHHmm"), mobile = string.IsNullOrWhiteSpace(order.Mobile) ? WK.Tea.Lock.ApiRequest.LockApiHelper.Mobile : order.Mobile }; WK.Tea.Lock.ApiRequest.CreateCardResponse result = WK.Tea.Lock.ApiRequest.LockApiHelper.WebApi.Post <WK.Tea.Lock.ApiRequest.CreateCardRequest, WK.Tea.Lock.ApiRequest.CreateCardResponse>("https://api.uclbrt.com/?c=Qrcode&a=getLink", postEntity); using (IT_Order repository = new T_OrderRepository()) { order.CardNo = result.cardNo; order.OP = null; repository.Update(order); } } else { resultMsg.code = 1; resultMsg.msg = "门店不存在"; } } } } catch (Exception ex) { resultMsg.code = (int)StatusCodeEnum.Error; resultMsg.msg = ex.Message; } return(resultMsg.toJson()); }
public HttpResponseMessage AddOrderAdmin([FromBody] T_Order order) { ResultMsg resultMsg = new ResultMsg(); try { order.Duration = (int)(order.ETime - order.BTime).TotalMinutes; if (order.BTime.Minute != 0 && order.BTime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定开始时间必须以半小时为间隔,如:12:00,12:30!"; } else if (order.ETime.Minute != 0 && order.ETime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定结束时间必须以半小时为间隔,如:14:00,14:30!"; } else if (order.Duration < 120 || order.Duration % 30 != 0) { resultMsg.code = 1; resultMsg.msg = "预定时长至少2小时,时长必须半小时为整"; } else { bool checkOrderTime = false; using (IT_Order repository = new T_OrderRepository()) { checkOrderTime = repository.CheckOrderTime(order); } if (checkOrderTime) { resultMsg.code = 1; resultMsg.msg = "预定时间段被占用,请重新选择预定时间"; } else { T_Shop shop = null; using (IT_Shop repository = new T_ShopRepository()) { shop = repository.FindFirstOrDefault(o => o.ID == order.ShopID); } if (shop != null) { WK.Tea.Lock.ApiRequest.CreateCardRequest postEntity = new WK.Tea.Lock.ApiRequest.CreateCardRequest { communityNo = "1316882760", roomNo = shop.RoomNo, floorNo = shop.FloorNo, buildNo = shop.BuildNo, startTime = order.BTime.AddMinutes(-15).ToString("yyMMddHHmm"), endTime = order.ETime.AddMinutes(10).ToString("yyMMddHHmm"), mobile = string.IsNullOrWhiteSpace(order.Mobile) ? WK.Tea.Lock.ApiRequest.LockApiHelper.Mobile : order.Mobile }; WK.Tea.Lock.ApiRequest.CreateCardResponse result = WK.Tea.Lock.ApiRequest.LockApiHelper.WebApi.Post <WK.Tea.Lock.ApiRequest.CreateCardRequest, WK.Tea.Lock.ApiRequest.CreateCardResponse>("https://api.uclbrt.com/?c=Qrcode&a=getLink", postEntity); using (IT_Order repository = new T_OrderRepository()) { order.CardNo = result.cardNo; order.Flag = 0; order.OP = User.Identity.Name; order.CTime = DateTime.Now; repository.Insert(order); string url = "http://dc.orangenet.com.cn/Door/Qrcode?orderId=" + order.ID; WeixinTempMsg.SendManagerOrderMsg(url, shop.ShopAddress, order.BTime, order.ETime, order.FeeCode.Value); //WeixinTempMsg.SendCleanMsg(shop.ShopAddress, order.OrderNo, order.BTime, order.ETime); } } else { resultMsg.code = 1; resultMsg.msg = "门店不存在"; } } } } catch (Exception ex) { resultMsg.code = (int)StatusCodeEnum.Error; resultMsg.msg = ex.Message; } return(resultMsg.toJson()); }
public HttpResponseMessage AddOrderWX([FromBody] T_Order order) { ResultMsg resultMsg = new ResultMsg(); try { order.ETime = order.BTime.AddMinutes(order.Duration); if (order.BTime.Minute != 0 && order.BTime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定开始时间必须以半小时为间隔,如:12:00,12:30!"; } else if (order.ETime.Minute != 0 && order.ETime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定结束时间必须以半小时为间隔,如:14:00,14:30!"; } else if (order.Duration < 120 || order.Duration % 30 != 0) { resultMsg.code = 1; resultMsg.msg = "预定时长至少2小时,时长必须半小时为整"; } else { bool checkOrderTime = false; using (IT_Order repository = new T_OrderRepository()) { checkOrderTime = repository.CheckOrderTime(order); } if (checkOrderTime) { resultMsg.code = 1; resultMsg.msg = "预定时间段被占用,请重新选择预定时间"; } else { T_Shop shop = null; using (IT_Shop repository = new T_ShopRepository()) { shop = repository.FindFirstOrDefault(o => o.ID == order.ShopID); } if (shop != null) { using (IT_Order repository = new T_OrderRepository()) { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); order.OrderNo = "DCWX" + Convert.ToInt64(ts.TotalMilliseconds).ToString(); order.ReMarks = 1; order.PayStatus = 0; order.Flag = 0; order.FeeCode = 288; var t = order.Duration - 120; if (t > 0) { order.FeeCode += t / 30 * 50; } order.OpenID = User.Identity.Name; order.CTime = DateTime.Now; order = repository.Insert(order); resultMsg.data = order; } } else { resultMsg.code = 1; resultMsg.msg = "门店不存在"; } } } } catch (Exception ex) { resultMsg.code = (int)StatusCodeEnum.Error; resultMsg.msg = ex.Message; } return(resultMsg.toJson()); }
public virtual int C_Shop_Add(T_Shop shop) { var shopNameParameter = shop.ShopName != null ? new SqlParameter("ShopName", shop.ShopName) : new SqlParameter("ShopName", Convert.DBNull); var provinceIDParameter = shop.ProvinceID.HasValue ? new SqlParameter("ProvinceID", shop.ProvinceID) : new SqlParameter("ProvinceID", Convert.DBNull); var cityIDParameter = shop.CityID.HasValue ? new SqlParameter("CityID", shop.CityID) : new SqlParameter("CityID", Convert.DBNull); var areaIDParameter = shop.AreaID.HasValue ? new SqlParameter("AreaID", shop.AreaID) : new SqlParameter("AreaID", Convert.DBNull); var shopAddressParameter = shop.ShopAddress != null ? new SqlParameter("ShopAddress", shop.ShopAddress) : new SqlParameter("ShopAddress", Convert.DBNull); var lNGParameter = shop.LNG != null ? new SqlParameter("LNG", shop.LNG) : new SqlParameter("LNG", Convert.DBNull); var lATParameter = shop.LAT != null ? new SqlParameter("LAT", shop.LAT) : new SqlParameter("LAT", Convert.DBNull); var shopPhoneNumParameter = shop.ShopPhoneNum != null ? new SqlParameter("ShopPhoneNum", shop.ShopPhoneNum) : new SqlParameter("ShopPhoneNum", Convert.DBNull); var shopContactsParameter = shop.ShopContacts != null ? new SqlParameter("ShopContacts", shop.ShopContacts) : new SqlParameter("ShopContacts", Convert.DBNull); var buildNoParameter = shop.BuildNo != null ? new SqlParameter("BuildNo", shop.BuildNo) : new SqlParameter("BuildNo", Convert.DBNull); var floorNoParameter = shop.FloorNo != null ? new SqlParameter("FloorNo", shop.FloorNo) : new SqlParameter("FloorNo", Convert.DBNull); var roomNoParameter = shop.RoomNo != null ? new SqlParameter("RoomNo", shop.RoomNo) : new SqlParameter("RoomNo", Convert.DBNull); var flagParameter = shop.Flag.HasValue ? new SqlParameter("Flag", shop.Flag) : new SqlParameter("Flag", Convert.DBNull); var cTimeParameter = shop.CTime.HasValue ? new SqlParameter("CTime", shop.CTime) : new SqlParameter("CTime", Convert.DBNull); return(((IObjectContextAdapter)this).ObjectContext.ExecuteStoreCommand("C_Shop_Add @ShopName,@ProvinceID,@CityID,@AreaID,@ShopAddress,@LNG,@LAT,@ShopPhoneNum,@ShopContacts,@BuildNo,@FloorNo,@RoomNo,@Flag,@CTime", shopNameParameter, provinceIDParameter, cityIDParameter, areaIDParameter, shopAddressParameter, lNGParameter, lATParameter, shopPhoneNumParameter, shopContactsParameter, buildNoParameter, floorNoParameter, roomNoParameter, flagParameter, cTimeParameter)); }
public HttpResponseMessage RenewOrderWX([FromBody] T_Order order) { ResultMsg resultMsg = new ResultMsg(); try { order.Duration = (int)(order.ETime - order.BTime).TotalMinutes; if (order.BTime.Minute != 0 && order.BTime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定开始时间必须以半小时为间隔,如:12:00,12:30!"; } else if (order.ETime.Minute != 0 && order.ETime.Minute != 30) { resultMsg.code = 1; resultMsg.msg = "预定结束时间必须以半小时为间隔,如:14:00,14:30!"; } else if (order.Duration < 30 || order.Duration % 30 != 0) { resultMsg.code = 1; resultMsg.msg = "预定时长至少半小时,时长必须半小时为整"; } else { bool checkOrderTime = false; using (IT_Order repository = new T_OrderRepository()) { checkOrderTime = repository.CheckOrderTime(order); } if (checkOrderTime) { resultMsg.code = 1; resultMsg.msg = "预定时间段被占用,请重新选择预定时间"; } else { T_Order porder = null; using (IT_Order repository = new T_OrderRepository()) { porder = repository.FindFirstOrDefault(o => o.OrderNo == order.ParentNo); } if (porder != null) { order.ShopID = porder.ShopID; order.Mobile = porder.Mobile; order.ReMarks = 0; order.Flag = 1; T_Shop shop = null; using (IT_Shop repository = new T_ShopRepository()) { shop = repository.FindFirstOrDefault(o => o.ID == order.ShopID); } if (shop != null) { string cardNo = string.Empty; var code = new Random().Next(1000, 9999).ToString(); if (shop.LockType != 1) { WK.Tea.Lock.ApiRequest.CreateCardRequest postEntity = new WK.Tea.Lock.ApiRequest.CreateCardRequest { communityNo = "1316882760", roomNo = shop.RoomNo, floorNo = shop.FloorNo, buildNo = shop.BuildNo, startTime = order.BTime.AddMinutes(-15).ToString("yyMMddHHmm"), endTime = order.ETime.AddMinutes(10).ToString("yyMMddHHmm"), mobile = string.IsNullOrWhiteSpace(order.Mobile) ? WK.Tea.Lock.ApiRequest.LockApiHelper.Mobile : order.Mobile }; WK.Tea.Lock.ApiRequest.CreateCardResponse result = WK.Tea.Lock.ApiRequest.LockApiHelper.WebApi.Post <WK.Tea.Lock.ApiRequest.CreateCardRequest, WK.Tea.Lock.ApiRequest.CreateCardResponse>("https://api.uclbrt.com/?c=Qrcode&a=getLink", postEntity); cardNo = result.cardNo; } else { var startTime = order.BTime.AddMinutes(-15).ToString("yyMMddHHmm"); var endTime = order.ETime.AddMinutes(10).ToString("yyMMddHHmm"); WebApiHelper.CreateInstance().AddLockKey(code, shop.LockID, startTime, endTime); } using (IT_Order repository = new T_OrderRepository()) { order.CardNo = cardNo; order.LockPW = code; order.Flag = 0; order.OP = User.Identity.Name; repository.Insert(order); string url = "http://dc.orangenet.com.cn/Door/Qrcode?orderId=" + order.ID; WeixinTempMsg.SendManagerOrderMsg(url, shop.ShopAddress, order.BTime, order.ETime, order.FeeCode.Value, order.OrderNo, 1); WeixinTempMsg.SendCleanMsg(shop.ShopAddress, order.OrderNo, order.BTime, order.ETime, shop.CleanerOpenID, 1); WeixinTempMsg.SendSMS(shop.ShopAddress, order.Mobile, shop.ShopPhoneNum, order.BTime, order.ETime, url); } } else { resultMsg.code = 1; resultMsg.msg = "门店不存在"; } } else { resultMsg.code = 1; resultMsg.msg = "主订单不存在"; } } } } catch (Exception ex) { resultMsg.code = (int)StatusCodeEnum.Error; resultMsg.msg = ex.Message; } return(resultMsg.toJson()); }
/// <summary> /// 获取房卡示例 /// </summary> public ActionResult Qrcode(int orderId) { using (IT_Order repository = new T_OrderRepository()) { T_Order order = repository.FindFirstOrDefault(o => o.ID == orderId); if (order == null) { ViewBag.Message = "订单不存在"; } else { T_Shop shop = null; using (IT_Shop repositoryShop = new T_ShopRepository()) { shop = repositoryShop.FindFirstOrDefault(o => o.ID == order.ShopID); } if (shop != null && shop.LockType == 1) { Dictionary <string, string> sortedParams = new Dictionary <string, string>() { { "APPID", "6005BAFEA0C54011B6602D7A70C36E6C" }, { "AT", WebApiHelper.CreateInstance().GetTimeStamp() }, { "NONCESTR", WebApiHelper.CreateInstance().GetRandom() }, { "USERID", "13311237111" }, { "TOKEN", WebApiHelper.CreateInstance().GetToken() }, { "KEYLOCKID", shop.LockID }, { "VALIDMINUTE", "30" } }; DateTime nowTime1 = DateTime.Now; if (nowTime1 > order.BTime.AddMinutes(-15) && nowTime1 < order.ETime.AddMinutes(10)) { sortedParams.Add("STARTDATE", order.BTime.AddMinutes(-15).ToString("yyyyMMddHHmmss")); sortedParams.Add("ENDDATE", order.ETime.AddMinutes(10).ToString("yyyyMMddHHmmss")); var sign = WebApiHelper.CreateInstance().GetSignature(sortedParams); sortedParams.Add("SIGN", sign); var result = WebApiHelper.CreateInstance().Get("https://yylock.eeun.cn/dms/app/getLockQRCode", sortedParams); var qcode = JsonConvert.DeserializeObject <QCodeRespinse>(result).data; ViewBag.qcode = "data:image/png;base64," + qcode; ViewBag.pwd = order.LockPW; LogWriter.Default.WriteWarning(string.Format("uclbrt lock url: {0}", ViewBag.qcode)); } else if (nowTime1 <= order.BTime.AddMinutes(-15)) { ViewBag.Message = string.Format("您的预定的时间为:\n{0} - {1}\n门锁二维码可以提前15分钟获取!" , order.BTime.ToString("MM/dd HH:mm"), order.ETime.ToString("MM/dd HH:mm")); } else { ViewBag.Message = string.Format("预定已过期!"); } return(View()); } DateTime nowTime = DateTime.Now; if (nowTime > order.BTime.AddMinutes(-15) && nowTime < order.ETime.AddMinutes(10)) { string mobile = string.IsNullOrWhiteSpace(order.Mobile) ? LockApiHelper.Mobile : order.Mobile; string data = LockApiHelper.WebApi.GetCardDataParams("1316882760", mobile, "86", order.CardNo); ViewBag.Url = "http://cz.uclbrt.com/apiLogin?data=" + data; LogWriter.Default.WriteWarning(string.Format("uclbrt lock url: {0}", ViewBag.Url)); return(Redirect(ViewBag.Url)); } else if (nowTime <= order.BTime.AddMinutes(-15)) { ViewBag.Message = string.Format("您的预定的时间为:\n{0} - {1}\n门锁二维码可以提前15分钟获取!" , order.BTime.ToString("MM/dd HH:mm"), order.ETime.ToString("MM/dd HH:mm")); } else { ViewBag.Message = string.Format("预定已过期!"); } } } return(View()); }
/// <summary> /// 商品新增 /// </summary> /// <param name="shop"></param> /// <returns></returns> public static bool shopAdd(T_Shop shop) { return(shopDal.shopAdd(shop)); }
/// <summary> /// 商品信息修改 /// </summary> /// <param name="shop"></param> /// <returns></returns> public static bool shopEdit(T_Shop shop) { return(shopDal.shopEdit(shop)); }
public ActionResult Notify() { var doc = XDocument.Load(Request.InputStream); var sPara = doc.Root.Descendants().ToDictionary(x => x.Name.LocalName, x => x.Value); if (sPara.Count <= 0) { throw new ArgumentNullException(); } LogWriter.Default.WriteError("Notify Parameters:" + sPara.ToString());//记录请求关键信息到日志中去 if (sPara["return_code"] == "SUCCESS" && sPara["result_code"] == "SUCCESS") { var sign = sPara["sign"]; var signValue = WxPayAPI.Sign(sPara, WeixinConfig.PartnerKey); bool isVerify = sign == signValue; LogWriter.Default.WriteError("Verify:" + isVerify + "|sign/signValue:" + sign + "," + signValue); if (isVerify) { string out_trade_no = sPara["out_trade_no"]; //商户订单ID: 1.注意交易单不要重复处理;2.注意判断返回金额 string transaction_id = sPara["transaction_id"]; //微信支付订单号 string time_end = sPara["time_end"]; //支付完成时间 int total_fee = int.Parse(sPara["total_fee"]); //总金额 string bank_type = sPara["bank_type"]; //付款银行 var openid = sPara["openid"]; //**************************************************************************************** //TODO 商户处理订单逻辑: 1.注意交易单不要重复处理;2.注意判断返回金额 T_Order order = null; using (IT_Order repository = new T_OrderRepository()) { order = repository.FindFirstOrDefault(o => o.OrderNo == out_trade_no); } if (order != null) { order.PayStatus = 1; T_Shop shop = null; using (IT_Shop repository = new T_ShopRepository()) { shop = repository.FindFirstOrDefault(o => o.ID == order.ShopID); } if (shop != null) { string cardNo = string.Empty; var code = new Random().Next(1000, 9999).ToString(); if (shop.LockType != 1) { WK.Tea.Lock.ApiRequest.CreateCardRequest postEntity = new WK.Tea.Lock.ApiRequest.CreateCardRequest { communityNo = "1316882760", roomNo = shop.RoomNo, floorNo = shop.FloorNo, buildNo = shop.BuildNo, startTime = order.BTime.AddMinutes(-15).ToString("yyMMddHHmm"), endTime = order.ETime.AddMinutes(10).ToString("yyMMddHHmm"), mobile = string.IsNullOrWhiteSpace(order.Mobile) ? WK.Tea.Lock.ApiRequest.LockApiHelper.Mobile : order.Mobile }; WK.Tea.Lock.ApiRequest.CreateCardResponse result = WK.Tea.Lock.ApiRequest.LockApiHelper.WebApi.Post <WK.Tea.Lock.ApiRequest.CreateCardRequest, WK.Tea.Lock.ApiRequest.CreateCardResponse>("https://api.uclbrt.com/?c=Qrcode&a=getLink", postEntity); cardNo = result.cardNo; } else { var startTime = order.BTime.AddMinutes(-15).ToString("yyMMddHHmm"); var endTime = order.ETime.AddMinutes(10).ToString("yyMMddHHmm"); WebApiHelper.CreateInstance().AddLockKey(code, shop.LockID, startTime, endTime); } order.CardNo = cardNo; order.LockPW = code; using (IT_Order repository = new T_OrderRepository()) { repository.Update(order); } //TODO:postData中携带该次支付的用户相关信息,这将便于商家拿到openid,以便后续提供更好的售后服务,譬如:微信公众好通知用户付款成功。如果不提供服务则可以删除此代码 string url = "http://dc.orangenet.com.cn/Door/Qrcode?orderId=" + order.ID; WeixinTempMsg.SendOrderPaySuccessMsg(openid, url, shop.ShopAddress, order.BTime, order.ETime, order.FeeCode.Value, order.OrderNo); WeixinTempMsg.SendManagerOrderMsg(url, shop.ShopAddress, order.BTime, order.ETime, order.FeeCode.Value, order.OrderNo); WeixinTempMsg.SendSMS(shop.ShopAddress, order.Mobile, shop.ShopPhoneNum, order.BTime, order.ETime, url); //WeixinTempMsg.SendCleanMsg(shop.ShopAddress, order.OrderNo, order.BTime, order.ETime); } else { LogWriter.Default.WriteError("Shop Error, out_trade_no:" + out_trade_no + ", shop is null"); } } else { LogWriter.Default.WriteError("Order Error, out_trade_no:" + out_trade_no + ", order is null"); } LogWriter.Default.WriteError("Notify Success, out_trade_no:" + out_trade_no + ",transaction_id" + transaction_id + ",time_end:" + time_end + ",total_fee:" + total_fee + ",bank_type:" + bank_type + ",openid:" + openid); return(Content(string.Format("<xml><return_code><![CDATA[{0}]]></return_code><return_msg><![CDATA[{1}]]></return_msg></xml>", "SUCCESS", "OK"))); } } return(Content(string.Format("<xml><return_code><![CDATA[{0}]]></return_code></xml>", "FAIL"))); }
/// <summary> /// 新增商品信息 /// </summary> /// <param name="shop"></param> /// <returns></returns> public static bool shopAdd(T_Shop shop) { string sql = string.Format("insert T_Shop(ShopCode,Name,SupplierID,CostPrice,SalePrice,ShelfLife,ShopTypeID) values('{0}','{1}',{2},{3},{4},{5},{6})", shop.ShopCode, shop.Name, shop.Supplier.SupplierID, shop.CostPrice, shop.SalePrice, shop.ShelfLife, shop.ShopType.TypeID); return(DBHelper.Write(sql)); }
/// <summary> /// 商品信息修改 /// </summary> /// <param name="shop"></param> /// <returns></returns> public static bool shopEdit(T_Shop shop) { string sql = string.Format("update T_Shop set ShopCode='{0}', Name='{1}', SupplierID={2},CostPrice={3},SalePrice={4},ShelfLife={5},ShopTypeID={6} where ShopID={7}", shop.ShopCode, shop.Name, shop.Supplier.SupplierID, shop.CostPrice, shop.SalePrice, shop.ShelfLife, shop.ShopType.TypeID, shop.ShopID); return(DBHelper.Write(sql)); }