Beispiel #1
0
        /// <summary>
        /// local static funtion that calculates product stock of particular warehouseid and warehouse addressid of a product and displays all products available and no of quantity
        /// </summary>
        public static void  GetAllStocks()
        {
            ProductBusiness         productBusinessLogic    = new ProductBusiness();
            MenuPrensentor          wareHousePresentation   = new MenuPrensentor();
            StockBusinessLogicLayer stockBusinessLogicLayer = new StockBusinessLogicLayer();
            Stock stock = new Stock();
            bool  check = false;

            do
            {
                try
                {
                    System.Console.WriteLine("Enter WareHouseID");
                    System.Console.WriteLine("It should not contain spaces and length be exactly 6");
                    stock.WareHouseID = System.Console.ReadLine();
                    if (wareHousePresentation.CheckWareHouseId(stock.WareHouseID)) //checking whether the Warehouse Id is present in the list of warehouse
                    {
                        bool check1 = false;
                        check = true;
                        do
                        {
                            try
                            {
                                System.Console.WriteLine("Enter Address ID");
                                System.Console.WriteLine("It should not contain spaces or Special Characters and length should be exactly 4");
                                stock.AddressID = System.Console.ReadLine();
                                if (wareHousePresentation.CheckAddressId(stock.AddressID))//checking whether the warehouse address is present in list of warehouse adress

                                {
                                    check1 = true;
                                    List <Stock> stocks = stockBusinessLogicLayer.GetAllStocks(stock.WareHouseID, stock.AddressID);

                                    System.Console.WriteLine("ProductID     " + "      " + "StockAvalibale");
                                    foreach (Stock item in stocks)
                                    {
                                        System.Console.WriteLine(item.ProductID + "  " + item.TotalQuantity);
                                    }
                                }
                            }
                            catch (StockException e)
                            {
                                System.Console.WriteLine(e.Message);
                            }
                        } while (check1 == false);
                    }
                }
                catch (StockException e)
                {
                    System.Console.WriteLine(e.Message);
                }
            } while (check == false);
        }
 /// <summary>
 /// Method for Getting All Stocks
 /// </summary>
 /// <param name="warehouseID"></param>
 /// <param name="addressID"></param>
 /// <returns></returns>
 public List<Stock> GetAllStocks(string warehouseID, string addressID)
 {
     return b.GetAllStocks(warehouseID, addressID);
 }