Exemple #1
0
        public TicketCommitResult MoveOrders(Ticket ticket, Order[] selectedOrders, int targetTicketId)
        {
            var clonedOrders = selectedOrders.Select(ObjectCloner.Clone2).ToList();
            ticket.RemoveOrders(selectedOrders);

            CloseTicket(ticket);
            ticket = OpenTicket(targetTicketId);

            foreach (var clonedOrder in clonedOrders)
            {
                clonedOrder.TicketId = 0;
                ticket.Orders.Add(clonedOrder);
            }

            //foreach (var template in from order in clonedOrders.GroupBy(x => x.AccountTransactionTypeId)
            //                         where ticket.TransactionDocument.AccountTransactions.All(x => x.AccountTransactionTypeId != order.Key)
            //                         select _cacheService.GetAccountTransactionTypeById(order.Key))
            //{
            //    ticket.TransactionDocument.AddNewTransaction(template, ticket.AccountTypeId, ticket.AccountId);
            //}

            RefreshAccountTransactions(ticket);

            ticket.LastOrderDate = DateTime.Now;
            return CloseTicket(ticket);
        }
Exemple #2
0
        public TicketCommitResult MoveOrders(Ticket ticket, Order[] selectedOrders, int targetTicketId)
        {
            _applicationState.NotifyEvent(RuleEventNames.TicketMoving, new { Ticket = ticket });

            var clonedOrders = selectedOrders.Select(ObjectCloner.Clone2).ToList();
            ticket.RemoveOrders(selectedOrders);

            CloseTicket(ticket);
            ticket = OpenTicket(targetTicketId);

            foreach (var clonedOrder in clonedOrders)
            {
                clonedOrder.TicketId = 0;
                ticket.Orders.Add(clonedOrder);
                _applicationState.NotifyEvent(RuleEventNames.OrderMoved, new { Ticket = ticket, Order = clonedOrder, clonedOrder.MenuItemName });
            }

            RefreshAccountTransactions(ticket);
            ticket.LastOrderDate = DateTime.Now;

            _applicationState.NotifyEvent(RuleEventNames.TicketMoved, new { Ticket = ticket });

            return CloseTicket(ticket);
        }
        public TicketCommitResult MoveOrders(Ticket ticket, Order[] selectedOrders, int targetTicketId)
        {
            var clonedOrders = selectedOrders.Select(ObjectCloner.Clone2).ToList();
            ticket.RemoveOrders(selectedOrders);

            CloseTicket(ticket);
            ticket = OpenTicket(targetTicketId);

            foreach (var clonedOrder in clonedOrders)
            {
                clonedOrder.TicketId = 0;
                ticket.Orders.Add(clonedOrder);
            }

            RefreshAccountTransactions(ticket);

            ticket.LastOrderDate = DateTime.Now;
            return CloseTicket(ticket);
        }