Ejemplo n.º 1
0
        public SaleLineItem AddSaleLineItem(Employee employee, Guid saleId, MenuProduct menuProduct)
        {
            var sale = GetSaleById(saleId);
            var sli  = sale.AddSaleLineItem(menuProduct, employee);

            return(sli);
        }
Ejemplo n.º 2
0
        public void ChangeQty(MenuProduct menuProduct, int qty, Employee employee)
        {
            var sli = findSaleLineItem(menuProduct);

            sli.ChangeQty(qty);
            var message = string.Format("Saleline item quantity changed\nProduct:{0}\nSold @ Price:{1:c}\nQty:{2}", menuProduct.ProductDescription, sli.EachPrice, sli.Quantity);

            saleUpdated(employee, message);
        }
Ejemplo n.º 3
0
        public bool RemoveSaleLineItem(MenuProduct menuProduct, Employee employee)
        {
            var sli = findSaleLineItem(menuProduct);

            if (sli != null)
            {
                var message = string.Format("Sale Line Item Removed\nProduct:{0}\nSold @ Price:{1:c}\nQty:{2}", menuProduct.ProductDescription, sli.EachPrice, sli.Quantity);
                saleUpdated(employee, message);
                return(this.SaleLineItems.Remove(sli));
            }
            return(false);
        }
Ejemplo n.º 4
0
        public MenuProduct AddMenuProduct(Guid categoryId, Guid pdId)
        {
            var productDesciprtion = FetchCategoryProductDescription(categoryId, pdId);

            if (productDesciprtion == null)
            {
                throw new Exception("invalid product description");
            }

            var menuProduct = new MenuProduct(this.Id, pdId);

            MenuProducts.Add(menuProduct);
            return(menuProduct);
        }
Ejemplo n.º 5
0
        public SaleLineItem AddSaleLineItem(MenuProduct menuProduct, Employee employee)
        {
            SaleLineItem sli = null;
            var          x   = this;

            var check = from item in this.SaleLineItems where item.MenuProduct.ProductDescription == menuProduct.ProductDescription select item;

            if (check.Count() == 0)
            {
                sli = new SaleLineItem(this, menuProduct);
                this.SaleLineItems.Add(sli);
            }
            else
            {
                sli = check.First();
                check.First().Quantity++;
            }

            var message = string.Format("Added Saleline Item\nProduct:{0}\nSold @ Price:{1:c}\nQty:{2}", menuProduct.ProductDescription, sli.EachPrice, sli.Quantity);

            saleUpdated(employee, message);
            return(sli);
        }
Ejemplo n.º 6
0
 private SaleLineItem findSaleLineItem(MenuProduct mp)
 {
     return((from item in SaleLineItems where item.MenuProduct == mp && item.SaleId == this.Id select item).First());
 }
Ejemplo n.º 7
0
        public void ChangeQty(Employee employee, Guid saleId, MenuProduct menuProduct, Guid terminalId, int qty)
        {
            var terminal = getTerminal(terminalId);

            terminal.ChangeQty(employee, saleId, menuProduct, qty);
        }
Ejemplo n.º 8
0
        public void DecrementQty(Employee employee, Guid saleId, MenuProduct menuProduct, Guid terminalId)
        {
            var terminal = getTerminal(terminalId);

            terminal.DecrementQty(employee, saleId, menuProduct);
        }
Ejemplo n.º 9
0
        public bool RemoveSaleLineItem(Employee employee, Guid saleId, MenuProduct menuProduct, Guid terminalId)
        {
            var terminal = getTerminal(terminalId);

            return(terminal.RemoveSaleLineItem(employee, saleId, menuProduct));
        }
Ejemplo n.º 10
0
 public SaleLineItem(Sale sale, MenuProduct menuProduct)
 {
     Sale        = sale;
     Quantity    = 1;
     MenuProduct = menuProduct;
 }
Ejemplo n.º 11
0
        public void ChangeQty(Employee employee, Guid saleId, MenuProduct menuProduct, int qty)
        {
            var sale = GetSaleById(saleId);

            sale.ChangeQty(menuProduct, qty, employee);
        }
Ejemplo n.º 12
0
        public void DecrementQty(Employee employee, Guid saleId, MenuProduct menuProduct)
        {
            var sale = GetSaleById(saleId);

            sale.DecrementQty(menuProduct, employee);
        }
Ejemplo n.º 13
0
        public bool RemoveSaleLineItem(Employee employee, Guid saleId, MenuProduct menuProduct)
        {
            var sale = GetSaleById(saleId);

            return(sale.RemoveSaleLineItem(menuProduct, employee));
        }