public Order BuildOrderForQZ(TourMembership member, string assignName, string idcardno, Ticket currentTicket, int amount, string parnterName) { #region 开始出票 //1 为身份证号创建一个用户名 TicketAssign ta = new TicketAssign(); ta.IdCard = idcardno; ta.IsUsed = false; ta.Name = assignName; OrderDetail orderdetail = new OrderDetail(); orderdetail.Quantity = amount; orderdetail.Remark = "衢州新春门票派送活动自动创建订单,请票来源:" + parnterName; orderdetail.TicketAssignList.Add(ta); TicketPrice ticketPrice = currentTicket.GetTicketPrice(PriceType.PayOnline); orderdetail.TicketPrice = ticketPrice; Order order = new Order(); order.BuyTime = DateTime.Now; order.IsPaid = true; order.TourMembership = member; order.OrderDetail.Add(orderdetail); order.PayTime = DateTime.Now; order.PriceType = PriceType.PayOnline; order.PayTime = DateTime.Now; order.TradeNo = "QZFREE"; return order; #endregion }
public void TestGetOrder() { Checkout checkout = new Checkout(); // checkout.BuerId =new Guid("2D3455F8-C7B5-4949-814A-A02A00DE271E"); checkout.PriceType = PriceType.PayOnline; List<OrderDetail> details = new List<OrderDetail>(); OrderDetail detail = new OrderDetail(); detail.Quantity =5; Ticket t = new BLLTicket().GetTicket(1); TicketPrice tp = t.TicketPrice.Single<TicketPrice>(x => x.PriceType == PriceType.PayOnline); detail.TicketPrice = tp; for (int i = 0; i < detail.Quantity; i++) { TicketAssign ta = new TicketAssign(); ta.IdCard = "idcard1"; ta.IsUsed = false; ta.Name = "namei"; detail.TicketAssignList.Add(ta); } // new BLLOrderDetail().SaveOrUpdateOrderDetail(detail); details.Add(detail); checkout.Details = details; checkout.MakeOrder(); }