Exemplo n.º 1
0
        public void GetItemListRound(out ItemsPool allDcpItems, out ItemsPool allAmrItems)
        {
            if (_customerOrder == null)
            {
                GetItemListAll(out allDcpItems, out allAmrItems);
                _customerOrder = (List<CustomerOrder>)DeepClone(customerOrder);
                return;
            }

            ItemsPool itemPool = new ItemsPool();
            ItemsPool itemPoolAmr = new ItemsPool();

            for (int i = 0; i < customerOrder.Count; i++)
            {
                var res = _customerOrder.Where(e => e.CustomerName == customerOrder[i].CustomerName).SingleOrDefault();

                if (customerOrder[i].IsSkip)
                    continue;

                ////// DCP
                List<OrderedItem> items = customerOrder[i].GetOrderedList();
                if (res == null)
                {
                    // Customer make an order
                    foreach (OrderedItem item in items)
                        itemPool.AddNewItem(item);
                }
                else
                {
                    // Check for addtional item
                    foreach (OrderedItem item in items)
                        if(!res.HasOrderedItem(item.Name, item.Note, item.Unit, item.Amount))
                            itemPool.AddNewItem(item);
                }

                ////// AMR
                items = customerOrder[i].GetOrderedListAmr();
                if (res == null)
                {
                    // Customer make an order
                    foreach (OrderedItem item in items)
                        itemPoolAmr.AddNewItem(item);
                }
                else
                {
                    // Check for addtional item
                    foreach (OrderedItem item in items)
                        if (!res.HasOrderedItemAmr(item.Name, item.Note, item.Unit, item.Amount))
                            itemPoolAmr.AddNewItem(item);
                }
            }

            ///// STAMP FOR CUSTOMER ORDER
            _customerOrder = (List<CustomerOrder>)DeepClone(customerOrder);

            allDcpItems = itemPool;
            allAmrItems = itemPoolAmr;
        }
Exemplo n.º 2
0
        public void GetItemListAll(out ItemsPool allDcpItems, out ItemsPool allAmrItems)
        {
            ItemsPool itemPool = new ItemsPool();
            ItemsPool itemPoolAmr = new ItemsPool();
            foreach (CustomerOrder cust in customerOrder)
            {
                if (cust.IsSkip)
                    continue;

                List<OrderedItem> items = cust.GetOrderedList();
                foreach (OrderedItem item in items)
                    itemPool.AddNewItem(item);

                items = cust.GetOrderedListAmr();
                foreach (OrderedItem item in items)
                    itemPoolAmr.AddNewItem(item);
            }

            allDcpItems = itemPool;
            allAmrItems = itemPoolAmr;
        }