Ejemplo n.º 1
0
        /// <summary>
        /// 创建订单详情--小径平台
        /// </summary>
        /// <param name="order"></param>
        /// <param name="tbl_Order"></param>
        /// <returns></returns>
        public List <Tbl_OrderDetail> AddOrderDetail(XJ_Order order, Tbl_Order tbl_Order)
        {
            List <Tbl_OrderDetail> orderDetails = new List <Tbl_OrderDetail>();
            string  ticketNames = string.Empty;
            decimal TotalMoney  = 0;
            int     TotalCount  = 0;
            //企业Id
            int EnterpriseID = 0;
            int ScenicID     = 0;

            foreach (var te in order.TicketList)
            {
                var ticket     = _ticketService.GetTicket(order.VisitDate, te.ProductId);
                var ticketRule = _ticketRuleRepository.FirstOrDefault(a => a.Id == ticket.RuleId);
                //二维码票: 每种门票 一个订单详情,多个数量
                Tbl_OrderDetail tbl_OrderDetail = new Tbl_OrderDetail
                {
                    Number            = Guid.NewGuid(),
                    OrderNo           = tbl_Order.OrderNo,
                    OtaOrderDetailId  = te.OrderDetailId,
                    EnterpriseId      = ticket.EnterpriseId,
                    ScenicId          = ticket.ScenicId,
                    WindowId          = 0,
                    SellerId          = 0,
                    SellerType        = 1,
                    OrderSource       = (int)OrderSource.XiaoJing,
                    TicketSource      = (int)TicketSourceStatus.Ota,
                    TicketCategory    = (int)TicketCategoryStatus.QrCodeElectronTicket,
                    UsedQuantity      = 0,
                    TicketId          = te.ProductId,
                    TicketName        = ticket.TicketName,
                    Price             = ticket.SalePrice,
                    SettlementPrice   = ticket.SettlementPrice,
                    Quantity          = te.Quantity,
                    BarCode           = te.CodeStr,
                    Stub              = "",
                    CertificateNO     = "",
                    OrderStatus       = (int)OrderDetailsDataStatus.NoPay,
                    CreateTime        = DateTime.Now,
                    ValidityDateStart = order.VisitDate,
                    ValidityDateEnd   = order.VisitDate,
                    PrintCount        = 0,
                    QRcodeUrl         = "",
                    QRcode            = te.CodeStr,
                    Mobile            = order.ContactPerson.Mobile,
                    IDCard            = tbl_Order.IDCard,
                    Linkman           = order.ContactPerson.Name,
                    CanModify         = ticketRule.CanModify,
                    CanRefund         = ticketRule.CanRefund
                };
                UpdateOrderDetailRefundTimeAndModifyTime(order.VisitDate, ticket, tbl_OrderDetail, ticketRule);
                orderDetails.Add(tbl_OrderDetail);
                //有效的门票信息
                EnterpriseID = ticket.EnterpriseId;
                ScenicID     = ticket.ScenicId;
                ticketNames += ticket.TicketName + ",";
                TotalMoney  += (ticket.SalePrice * te.Quantity);
                TotalCount  += te.Quantity;
            }
            ticketNames = ticketNames.Substring(0, ticketNames.Length - 1);
            if (ticketNames.Length > 50)
            {
                ticketNames = ticketNames.Substring(0, 50);
            }
            tbl_Order.EnterpriseId = EnterpriseID;
            tbl_Order.ScenicId     = ScenicID;
            tbl_Order.TicketName   = ticketNames;
            tbl_Order.TotalAmount  = TotalMoney;
            tbl_Order.BookCount    = TotalCount;
            return(orderDetails);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建订单详情 - 二维码票
        /// </summary>
        /// <param name="order"></param>
        /// <param name="tbl_Order"></param>
        /// <returns></returns>
        public List <Tbl_OrderDetail> AddOrderDetails(OrderInfoCreateModel order, Tbl_Order tbl_Order)
        {
            if (order.TicketCategory == 1)
            {
                return(new List <Tbl_OrderDetail>());
            }
            List <Tbl_OrderDetail> orderDetails = new List <Tbl_OrderDetail>();
            string  ticketNames = string.Empty;
            decimal TotalMoney  = 0;
            int     TotalCount  = 0;
            //企业Id
            int EnterpriseID = 0;
            int ScenicID     = 0;

            foreach (var te in order.TicketItem)
            {
                var ticket     = _ticketService.GetTicket(order.ValidityDate, te.TicketId);
                var ticketRule = _ticketRuleRepository.FirstOrDefault(a => a.Id == ticket.RuleId);
                //二维码票: 每种门票 一个订单详情,多个数量
                Tbl_OrderDetail tbl_OrderDetail = new Tbl_OrderDetail
                {
                    Number            = Guid.NewGuid(),
                    OrderNo           = tbl_Order.OrderNo,
                    EnterpriseId      = ticket.EnterpriseId,
                    ScenicId          = ticket.ScenicId,
                    OrderType         = tbl_Order.OrderType,
                    WindowId          = 0,
                    SellerId          = tbl_Order.SellerId,
                    SellerType        = 1,
                    OtaOrderDetailId  = "",
                    OrderSource       = (int)OrderSource.My,
                    TicketSource      = order.TicketSource,
                    TicketCategory    = order.TicketCategory,
                    UsedQuantity      = 0,
                    TicketId          = te.TicketId,
                    TicketName        = ticket.TicketName,
                    Price             = ticket.SalePrice,
                    Quantity          = te.BookCount,
                    BarCode           = "",
                    Stub              = "",
                    CertificateNO     = "",
                    OrderStatus       = (int)OrderDetailsDataStatus.NoPay,
                    CreateTime        = DateTime.Now,
                    ValidityDateStart = order.ValidityDate,
                    ValidityDateEnd   = order.ValidityDate,
                    PrintCount        = 0,
                    QRcodeUrl         = "",
                    QRcode            = "",
                    Mobile            = tbl_Order.Mobile,
                    IDCard            = tbl_Order.IDCard,
                    Linkman           = tbl_Order.Linkman,
                    BuyUserId         = tbl_Order.BuyUserId,
                    CanModify         = ticketRule.CanModify,
                    CanRefund         = ticketRule.CanRefund
                };
                UpdateOrderDetailRefundTimeAndModifyTime(order.ValidityDate, ticket, tbl_OrderDetail, ticketRule);
                orderDetails.Add(tbl_OrderDetail);
                //有效的门票信息
                EnterpriseID = ticket.EnterpriseId;
                ScenicID     = ticket.ScenicId;
                ticketNames += ticket.TicketName + ",";
                TotalMoney  += (ticket.SalePrice * te.BookCount);
                TotalCount  += te.BookCount;
            }
            ticketNames = ticketNames.Substring(0, ticketNames.Length - 1);
            if (ticketNames.Length > 50)
            {
                ticketNames = ticketNames.Substring(0, 50);
            }
            tbl_Order.EnterpriseId = EnterpriseID;
            tbl_Order.ScenicId     = ScenicID;
            tbl_Order.TicketName   = ticketNames;
            tbl_Order.TotalAmount  = TotalMoney;
            tbl_Order.BookCount    = TotalCount;
            return(orderDetails);
        }