Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="customerClass">Customer to send to</param>
 /// <param name="merchandise">Merchandise to send</param>
 /// <param name="orderDate">The date the order was placed.</param>
 /// <param name="qID">Place in queue, starts at 1</param>
 public QueuedOrder(CustomerClass customerClass, StockClass merchandise, DateTime orderDate, int qID) : base(customerClass, merchandise, orderDate)
 {
     base.Customer    = customerClass;
     base.Merchandise = merchandise;
     base.OrderDate   = orderDate.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
     this.qID         = qID;
 }
Пример #2
0
        public static void RemoveFromStock(StockClass merchandise, int stockToRemove)
        {
            foreach (var item in CurrentStockList)
            {
                if (item.ItemName == merchandise.ItemName)
                {
                    if (item.Qty - stockToRemove < 0)
                    {
                        ShowMessage("Not enough items in stock, order more from supplier");
                        break;
                    }
                    else
                    {
                        item.Qty -= stockToRemove;
                    }
                }
            }

            //foreach (var merch in CurrentStockList)
            //{
            //    if (merch.Merchandise.MerchandiseName == merchandise.MerchandiseName)
            //    {
            //        merch.Merchandise.MerchandiseStock -= stockToRemove;
            //    }
            //    else
            //    {
            //        throw new System.NotImplementedException();
            //    }
            //}
        }
Пример #3
0
        public static void AddToStock(StockClass merchandise, int stockToAdd)
        {
            int stockToRemove = stockToAdd;

            foreach (var item in CurrentStockList)
            {
                if (item.ItemName == merchandise.ItemName)
                {
                    item.Qty += stockToAdd;
                    RemoveFromDeliveryList(merchandise, stockToRemove);
                }
            }

            //foreach (var merch in CurrentStockList)
            //{
            //    if (merch.Merchandise.MerchandiseName == merchandise.MerchandiseName)
            //    {
            //        merch.Merchandise.MerchandiseStock += stockToAdd;
            //    }
            //    else
            //    {
            //        throw new System.NotImplementedException();
            //    }
            //}
        }
Пример #4
0
        public void CreateOrder(CustomerClass customer, StockClass merch)
        {
            CultureInfo myCultureInfo = new CultureInfo("sv-SV");
            DateTime    orderDate     = DateTime.UtcNow;

            CustomerOrderClass customerOrder = new CustomerOrderClass(customer, merch, orderDate);

            _app.GetDefaultCustomerOrdersList().Add(customerOrder);
        }
Пример #5
0
 // Remove from incoming deliveries.
 public static void RemoveFromDeliveryList(StockClass merchandise, int stockToRemove)
 {
     foreach (var item in CurrentDeliverysList)
     {
         if (item.ItemName == merchandise.ItemName)
         {
             item.Qty -= stockToRemove;
         }
     }
 }
Пример #6
0
        /// <summary>
        /// Overload to create a queued order.
        /// </summary>
        /// <param name="customer">A customer object, preferably of the customer who placed the order.</param>
        /// <param name="merch">The merchandise to be shipped</param>
        /// <param name="queueID">What place in line to place the order, generate from querying the ObsColl</param>
        public void CreateOrder(CustomerClass customer, StockClass merch, int amount, int queueID)
        {
            // Define CultureInfo
            CultureInfo cultureInfo     = new CultureInfo("sv-SV");
            DateTime    dateTimeOfOrder = DateTime.UtcNow;

            QueuedOrder order = new QueuedOrder(customer, new StockClass(merch.ItemName, merch.Supplier, amount), dateTimeOfOrder, queueID);

            _app.QueuedOrders.Add(order);
        }
Пример #7
0
 public async void RemoveFromDeliveryList(StockClass merchandise, int stockToRemove)
 {
     foreach (var item in _app.GetDefaultDeliverysList())
     {
         if (item.ItemName == merchandise.ItemName)
         {
             item.Qty -= stockToRemove;
             await _app.WriteToFile(App.IncomingDeliverysFileName, _app.GetDefaultDeliverysList());
         }
     }
 }
Пример #8
0
        // Add to current stock
        public static void AddToStock(StockClass merchandise, int stockToAdd)
        {
            int stockToRemove = stockToAdd;

            foreach (var item in CurrentStockList)
            {
                if (item.ItemName == merchandise.ItemName)
                {
                    item.Qty += stockToAdd;
                    RemoveFromDeliveryList(merchandise, stockToRemove);
                }
            }
        }
Пример #9
0
        private StockClass FindProduct(string merchName)
        {
            StockClass stock = null;

            foreach (var item in _app.GetDefaultStockList())
            {
                if (item.ItemName == merchName)
                {
                    stock = item;
                }
            }
            return(stock);
        }
Пример #10
0
        public async void AddToStock(StockClass merchandise, int stockToAdd)
        {
            int stockToRemove = stockToAdd;

            foreach (var item in _app.GetDefaultStockList())
            {
                if (item.ItemName == merchandise.ItemName)
                {
                    item.Qty += stockToAdd;
                    await _app.WriteToFile(App.StockFileName, _app.GetDefaultStockList());

                    RemoveFromDeliveryList(merchandise, stockToRemove);
                }
            }
        }
Пример #11
0
 public static void RemoveFromStock(StockClass merchandise, int stockToRemove)
 {
     foreach (var item in CurrentStockList)
     {
         if (item.ItemName == merchandise.ItemName)
         {
             if (item.Qty - stockToRemove < 0)
             {
                 ShowMessage("Not enough items in stock, order more from supplier");
                 break;
             }
             else
             {
                 item.Qty -= stockToRemove;
             }
         }
     }
 }
Пример #12
0
 public async void RemoveFromStock(StockClass merchandise, int stockToRemove)
 {
     foreach (var item in _app.GetDefaultStockList())
     {
         if (item.ItemName == merchandise.ItemName)
         {
             if (item.Qty - stockToRemove < 0)
             {
                 MessageToUser("Not enough items in stock, order more from supplier");
                 break;
             }
             else
             {
                 item.Qty -= stockToRemove;
                 await _app.WriteToFile(App.StockFileName, _app.GetDefaultStockList());
             }
         }
     }
 }
 public void AddToOrder(StockClass merch)
 {
     Merchandise.Add(merch);
 }
 public CustomerOrderClass(CustomerClass customerClass, StockClass merchandise, DateTime orderDate)
 {
     this.Customer    = customerClass;
     this.Merchandise = merchandise;
     this.OrderDate   = orderDate.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
 }