public IActionResult Edit(int id, OrderSourceType orderSourceType) { if (id != orderSourceType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _orderSourceTypeRepository.Update(orderSourceType); } catch (DbUpdateConcurrencyException) { if (!_orderSourceTypeRepository.Exists(orderSourceType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(orderSourceType)); }
/// <summary> /// 生成课程编码 /// 规则: 来源(2位)-支付方式(2位)-时间戳(秒级)-属于用户当日订单数量+1(3位) /// </summary> /// <param name="sourceType">订单来源</param> /// <param name="time">属于用户当日订单数量</param> /// <returns></returns> public string GetCourseMaxCode(OrderSourceType sourceType, DateTime?time = null) { var precode = RandomHelper.GetRandom(1, 9) + Convert.ToInt32(sourceType).ToString(); var date = time ?? DateTime.Now; var codeStateWith = precode + date.ToString("yyyyMMdd"); //截取数据格式:年-月-日 20191021 var code = codeStateWith; var list = QueryAsNoTracking.Where(e => e.CourseCode.StartsWith(codeStateWith)) .ToList(); var model = list.Select(e => new { Number = e.CourseCode.Substring(code.Length).CastTo(0) }) .OrderByDescending(e => e.Number).FirstOrDefault(); //返回订单的最后一位 if (model != null) { code += (model.Number + 1).ToString().PadLeft(2, '0'); } else { code += "01"; } return(code); }
public IActionResult Create(OrderSourceType orderSourceType) { if (ModelState.IsValid) { _orderSourceTypeRepository.Add(orderSourceType); return(RedirectToAction(nameof(Index))); } return(View(orderSourceType)); }
public static OrderEntity Create(CustomerEntity customer, OrderSourceType orderSource) { Guard.NotNull(customer, nameof(customer)); return(new OrderEntity { Customer = customer, OrderSource = orderSource }); }
public AddOrderRecordCommand(string id, string salesOrderNo, string goodsId, string authRankId, string lotteryId, OrderSourceType orderSourceType, int count, double unitPrice, double originalCost, double orderCost, SellType amountType, string createBy) : base(id) { SalesOrderNo = salesOrderNo; GoodsId = goodsId; AuthRankId = authRankId; LotteryId = lotteryId; OrderSourceType = orderSourceType; Count = count; UnitPrice = unitPrice; OriginalCost = originalCost; OrderCost = orderCost; AmountType = amountType; CreateBy = createBy; }
/// <summary> /// TThostFtdcOrderSourceType枚举型转为OrderSourceType枚举型 /// </summary> /// <param name="tfost">TThostFtdcOrderSourceType枚举型</param> /// <returns></returns> public static OrderSourceType TThostFtdcOrderSourceType_To_OrderSourceType(TThostFtdcOrderSourceType tfost) { OrderSourceType ost = OrderSourceType.Participant; switch (tfost) { case TThostFtdcOrderSourceType.THOST_FTDC_OSRC_Participant: break; case TThostFtdcOrderSourceType.THOST_FTDC_OSRC_Administrator: ost = OrderSourceType.Administrator; break; default: break; } return(ost); }
public OrderRecord(string id, string salesOrderNo, string goodsId, string authRankId, string lotteryId, OrderSourceType orderSourceType, int count, double unitPrice, double originalCost, double orderCost, SellType amountType, string createBy) : base(id) { SalesOrderNo = salesOrderNo; GoodsId = goodsId; AuthRankId = authRankId; LotteryId = lotteryId; OrderSourceType = orderSourceType; Count = count; UnitPrice = unitPrice; OriginalCost = originalCost; OrderCost = orderCost; AmountType = amountType; CreateBy = createBy; CreateTime = DateTime.Now; Status = 0; ApplyEvent(new AddOrderRecordEvent(salesOrderNo, goodsId, authRankId, lotteryId, orderSourceType, count, unitPrice, originalCost, orderCost, amountType, createBy, Status)); }
public void Update(OrderSourceType orderSourceType) { _appDbContext.Update(orderSourceType); _appDbContext.SaveChanges(); }
public void Add(OrderSourceType orderSourceType) { _appDbContext.OrderSourceTypes.Add(orderSourceType); _appDbContext.SaveChanges(); }