예제 #1
0
        /// <summary>
        /// 创建单个产品订单详情
        /// </summary>
        /// <param name="order"></param>
        /// <param name="tbl_Order"></param>
        /// <returns></returns>
        public Tbl_OrderDetail AddOrderDetail(OrderSingleInfo order, Tbl_Order tbl_Order, Tbl_Ticket tbl_Ticket)
        {
            var ticketRule = _ticketRuleRepository.FirstOrDefault(a => a.Id == tbl_Ticket.RuleId);
            //二维码票: 每种门票 一个订单详情,多个数量
            Tbl_OrderDetail tbl_OrderDetail = new Tbl_OrderDetail
            {
                Number            = Guid.NewGuid(),
                OrderNo           = tbl_Order.OrderNo,
                EnterpriseId      = tbl_Ticket.EnterpriseId,
                ScenicId          = tbl_Ticket.ScenicId,
                WindowId          = 0,
                SellerId          = 0,
                SellerType        = 1,
                OtaOrderDetailId  = 0,
                OrderSource       = (int)OrderSource.OTA,
                TicketSource      = (int)TicketSourceStatus.Ota,
                TicketCategory    = (int)TicketCategoryStatus.QrCodeElectronTicket,
                UsedQuantity      = 0,
                TicketId          = tbl_Ticket.TicketId,
                TicketName        = tbl_Ticket.TicketName,
                Price             = tbl_Ticket.SalePrice,
                SettlementPrice   = tbl_Ticket.SettlementPrice,
                Quantity          = order.Ticket.Quantity,
                BarCode           = "",
                Stub              = "",
                CertificateNO     = "",
                OrderStatus       = (int)OrderDetailsDataStatus.NoPay,
                CreateTime        = DateTime.Now,
                ValidityDateStart = order.VisitDate.ToDataTime(),
                ValidityDateEnd   = order.VisitDate.ToDataTime(),
                PrintCount        = 0,
                QRcodeUrl         = "",
                QRcode            = "",
                Mobile            = order.ContactPerson.Mobile,
                IDCard            = tbl_Order.IDCard,
                Linkman           = order.ContactPerson.Name,
                CanModify         = ticketRule.CanModify,
                CanRefund         = ticketRule.CanRefund
            };

            UpdateOrderDetailRefundTimeAndModifyTime(order.VisitDate.ToDataTime(), tbl_Ticket, tbl_OrderDetail, ticketRule);


            //修改订单信息
            tbl_Order.EnterpriseId = tbl_OrderDetail.EnterpriseId;
            tbl_Order.ScenicId     = tbl_OrderDetail.ScenicId;
            tbl_Order.TicketName   = tbl_OrderDetail.TicketName;
            tbl_Order.TotalAmount  = tbl_Ticket.SalePrice * order.Ticket.Quantity;
            tbl_Order.BookCount    = order.Ticket.Quantity;
            return(tbl_OrderDetail);
        }
예제 #2
0
        /// <summary>
        /// 创建单个产品订单
        /// </summary>
        /// <param name="orderInfo"></param>
        /// <returns></returns>
        public Tbl_Order AddOrder(OrderSingleInfo request, Tbl_OTABusiness business)
        {
            //创建订单号
            string orderNo = OrderHelper.GenerateOrderNo();
            var    order   = Get(orderNo);

            if (order != null)
            {
                orderNo = OrderHelper.GenerateOrderNo();
            }
            int idType = GetIdCardType(request.ContactPerson.CardType);

            //订单
            Tbl_Order tbl_Order = new Tbl_Order
            {
                OrderNo           = orderNo,
                OTABusinessId     = business.Id,
                OTAOrderNo        = request.OrderOtaId,
                TicketSource      = (int)TicketSourceStatus.Ota,
                PayType           = (int)PayStatus.NoPayStatus,
                PayAccount        = "",
                PayTradeNo        = "",
                SellerId          = 0,
                Price             = 0,
                Linkman           = request.ContactPerson.Name,
                Mobile            = request.ContactPerson.Mobile,
                OrderStatus       = (int)OrderDataStatus.NoPay,
                CreateTime        = DateTime.Now,
                ValidityDateStart = request.VisitDate.ToDataTime(),
                ValidityDateEnd   = request.VisitDate.ToDataTime(),
                UsedQuantity      = 0,
                Remark            = "",
                IDType            = idType,
                IDCard            = request.ContactPerson.CardNo,
                CreateUserId      = 0
            };

            return(tbl_Order);
        }