//订单主表详情 public OrderResponse OrderDetail(int id) { OrderResponse response = null; try { t_order order = _dbContext.Get <t_order>(id); if (order != null) { response = new OrderResponse { CreateTime = order.createtime, Id = order.id, IsNeedInvoice = order.isNeedInvoice, MainOrderId = order.mainOrderId, MemberId = order.memberId, Money = order.money, OrderStatus = order.orderStatus, OrderType = order.orderType, PayExpiryDate = order.payExpiryDate, Remark = order.remark, TotalCoupon = order.totalcoupon, TotalDiscount = order.totaldiscount, SourceId = order.sourceId, UpdateTime = order.updatetime }; } } catch (Exception ex) { LogUtils.LogError("OrderService.OrderDetail", ex); } return(response); }
//订单详情 (平台管理员和选手) public OrderDetailResponse Detail(int id) { OrderDetailResponse response = null; try { t_order order = _dbContext.Get <t_order>(id); if (order != null) { response = new OrderDetailResponse { CreateTime = order.createtime, Id = order.id, IsNeedInvoice = order.isNeedInvoice, MainOrderId = order.mainOrderId, MemberId = order.memberId, Money = order.money, OrderStatus = order.orderStatus, OrderType = order.orderType, PayExpiryDate = order.payExpiryDate, Remark = order.remark, TotalCoupon = order.totalcoupon, TotalDiscount = order.totaldiscount, SourceId = order.sourceId, UpdateTime = order.updatetime }; var data = _dbContext.Select <t_order_detail>(c => c.orderId == id).ToList(); if (data != null && data.Count > 0) { foreach (var item in data) { response.OrderDetail.Add(new OrderDetail { Id = item.id, Coupon = item.coupon, UpdateTime = item.updatetime, CreateTime = item.createtime, DiscountPrice = item.discountprice, MemberId = item.memberId, Money = item.money, Name = item.name, Number = item.number, OrderId = item.orderId, ProductId = item.productId, UnitPrice = item.unitprice }); } } } } catch (Exception ex) { LogUtils.LogError("OrderService.RefundList", ex); } return(response); }
private void btnAddOrder_Click(object sender, EventArgs e) { var odrs = gcOrder.GetDataSource<t_order>(); odrs = odrs ?? new List<t_order>(); var newodr = new t_order(); newodr.TradeGuid = this.GuidKey; newodr.CreateDate = TimeSync.Default.CurrentSyncTime; newodr.Creator = this.CurUser; odrs.Add(newodr); gcOrder.DataSource = odrs; gcOrder.RefreshDataSource(); }
//处理退款 public bool Process(int id, int sysUserId, out string msg) { bool flag = false; msg = string.Empty; try { t_order_operation order_operation = _dbContext.Get <t_order_operation>(id); if (order_operation != null) { if (order_operation.operationStatus == OperationStatusEm.待处理) { msg = "状态已改变请刷新页面后重试"; return(flag); } try { _dbContext.BeginTransaction(); order_operation.updatetime = DateTime.Now; order_operation.operationStatus = OperationStatusEm.已处理; _dbContext.Update(order_operation); t_order torder = _dbContext.Get <t_order>(order_operation.orderId); torder.updatetime = DateTime.Now; torder.orderStatus = OrderStatusEm.退款成功; _dbContext.Update(torder); _dbContext.CommitChanges(); flag = true; } catch (Exception ex) { _dbContext.Rollback(); flag = false; msg = "服务异常"; LogUtils.LogError("OrderService.ProcessTran", ex); } } else { msg = "未找到退款申请"; } } catch (Exception ex) { flag = false; msg = "服务异常"; LogUtils.LogError("OrderService.Process", ex); } return(flag); }
private void btnAdd_Click(object sender, EventArgs e) { var odrs = gcOrder.GetDataSource <t_order>(); odrs = odrs ?? new List <t_order>(); var newodr = new t_order(); newodr.TradeGuid = this.GuidKey; newodr.CreateDate = TimeSync.Default.CurrentSyncTime; newodr.Creator = this.CurUser; odrs.Add(newodr); gcOrder.DataSource = odrs; gcOrder.RefreshDataSource(); }
//修改订单状态 public void UpdateStatus(int id, OrderStatusEm orderStatus) { try { t_order order = _dbContext.Get <t_order>(id); if (order != null) { order.updatetime = DateTime.Now; order.orderStatus = orderStatus; _dbContext.Update(order); } } catch (Exception ex) { LogUtils.LogError("OrderService.UpdateStatus", ex); } }
public ActionResult Order(int orderCalendar, int category) { using (var db = new DatabaseContext()) { //ユーザ情報取得 var user = db.m_user .Find(int.Parse(User.Identity.Name)); //商品カテゴリが存在しているかどうか取得 var isExistCategory = db.m_item_category .Where(c => c.id == category) .Any(); //営業日であるかどうか取得 var isBusinessDay = db.t_order_calendar .Where(c => c.is_open == true) .Any(); //受付終了しているかどうか取得 var isClosed = db.t_order_close .Where(o => o.order_calendar_id == orderCalendar) .Any(); //営業日 & 受付終了していない & カテゴリが存在している とき注文を反映する if (isBusinessDay && !isClosed && isExistCategory) { var item = new t_order { user_id = user.id, order_calendar_id = orderCalendar, item_category_id = category }; db.t_order.Add(item); db.SaveChanges(); } } Response.Redirect("/", true); return(View()); }
//临时选手绑定 生成支付订单 public int BindTempPlayer(BindTempPlayerRequest request, out string msg) { int orderId = 0; msg = string.Empty; try { //校验数据的真实性 if (request.EventCode.IsEmpty()) { msg = "赛事编码不能为空"; return(orderId); } if (request.GroupNum.IsEmpty()) { msg = "队伍编码不能为空"; return(orderId); } if (request.PlayerName.IsEmpty()) { msg = "选手姓名不能为空"; return(orderId); } if (request.ContactMobile.IsEmpty()) { msg = "联系电话不能为空"; return(orderId); } var tevent = _dbContext.Select <t_event>(c => c.code == request.EventCode).FirstOrDefault(); if (tevent == null) { msg = "赛事编码有误"; return(orderId); } if (tevent.eventStatus != EventStatusEm.比赛完成) { msg = "赛事未完成不能进行绑定"; return(orderId); } var data = _dbContext.Select <t_member_temp>(c => c.name == request.PlayerName && c.contactmobile == request.ContactMobile && c.code == request.GroupNum && c.tempType == TempTypeEm.临时选手 && c.tempStatus == TempStatusEm.待绑定 && c.eventId == tevent.id).FirstOrDefault(); if (data == null) { msg = "数据不存在,请核对后再操作"; return(orderId); } //if (data.tomemberId != null && data.tomemberId > 0) //{ // if (data.tomemberId != request.MemberId) // { // msg = "此信息已绑定过"; // return orderId; // } //} t_order order = _dbContext.Select <t_order>(c => c.memberId == data.memberId && c.orderType == OrderTypeEm.临时选手绑定 && c.sourceId == data.id).FirstOrDefault(); if (order == null)//没创建过订单 { try { _dbContext.BeginTransaction(); //创建订单 var orderid = _dbContext.Insert(new t_order { isNeedInvoice = false, mainOrderId = null, memberId = data.memberId, money = tevent.signfee, orderStatus = OrderStatusEm.等待支付, orderType = OrderTypeEm.临时选手绑定, payExpiryDate = DateTime.Now.AddYears(3), remark = "临时选手绑定", sourceId = data.id, totalcoupon = 0, totaldiscount = 0 }).ToObjInt(); _dbContext.Insert(new t_order_detail { memberId = data.memberId, orderId = orderid, coupon = 0, discountprice = 0, money = tevent.signfee, productId = 0, name = $"{tevent.name}报名费", number = 1, unitprice = tevent.signfee }); //生成支付链接 data.tomemberId = request.MemberId; data.updatetime = DateTime.Now; _dbContext.Update(data); _dbContext.CommitChanges(); orderId = orderid; } catch (Exception ex) { msg = "服务异常"; _dbContext.Rollback(); LogUtils.LogError("MemberTempService.BindTempPlayerTran", ex); } } else//创建过订单 { if (order.orderStatus != OrderStatusEm.等待支付 && order.orderStatus != OrderStatusEm.支付失败) { orderId = order.id; } else { msg = "状态已改变"; } } } catch (Exception ex) { msg = "服务异常"; LogUtils.LogError("MemberTempService.BindTempPlayer", ex); } return(orderId); }