Example #1
0
        private void AddCancelOrder(Order order)
        {
            List <Item>  processedItem         = new List <Item>();
            List <Item>  processedExistingItem = new List <Item>();
            List <Order> sourceOrders          = TotalOrders.Where(s => s.TableTabName == order.TableTabName).ToList();

            foreach (var sourceOrder in sourceOrders)
            {
                foreach (var newItem in order.Items)
                {
                    var existingItem = sourceOrder.Items.FirstOrDefault(s => s.OrderItemPosKey == newItem.OrderItemPosKey && !processedItem.Contains(s) &&
                                                                        !processedExistingItem.Contains(s));
                    if (existingItem != null)
                    {
                        processedExistingItem.Add(existingItem);
                        processedItem.Add(newItem);
                        if (!existingItem.DisplayAttributes.IsOriginalItem)
                        {
                            UpdateTransferProperty(existingItem);
                        }
                        existingItem.OrderStatus = OrderStatus.Canceled;
                        DbOrderItem.ItemBumped(existingItem.OrderItemKey, DateTime.Now);
                        DbOrderItem.UpdateOrderItemStatus(existingItem.OrderItemKey, OrderStatus.Canceled);
                    }
                }
            }
            order.Items.RemoveAll(s => processedItem.Contains(s));
            if (order.Items.Count > 0)
            {
                AddCreditOrder(order);
            }
        }
Example #2
0
        private void BumpItem(Item inItem, bool isBumbedFromGroup = false)
        {
            var item = inItem;

            if (!isBumbedFromGroup)
            {
                var order = ChefmateController.Instance.TotalOrders.FirstOrDefault(s => s.OrderKey == inItem.OrderKey);
                if (order != null)
                {
                    item = order.Items.FirstOrDefault(s => s.OrderItemKey == inItem.OrderItemKey);
                }
            }

            if (!item.DisplayAttributes.IsOriginalItem)
            {
                return;
            }

            ChangeItemStatus(item, OrderStatus.Bumped);
            foreach (var side in item.Sides)
            {
                side.ItemStatus = OrderStatus.Bumped;
            }
            foreach (var option in item.Options)
            {
                option.ItemStatus = OrderStatus.Bumped;
            }

            if (ChefmateController.Instance.CurrentSettings.OutputTime == OutputTime.ItemBumped)
            {
                OutputItem(item);
            }

            var group = ChefmateController.Instance.CurrentSettings.GroupType == GroupType.ServingCourse
                ? item.SCourseGroup
                : item.CourseGroup;

            if (group.Order.OrderState == OrderState.Complete && ChefmateController.Instance.CurrentSettings.OutputType != OutputType.KitchenTerminal &&
                item.OrderItemKey > 0)
            {
                DbOrderItem.ItemBumped(item.OrderItemKey, DateTime.Now);
            }

            if (!isBumbedFromGroup && group.Order.OrderStatus == OrderStatus.Bumped)
            {
                BumpOrder(group.Order);
            }
        }