/// <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); }
public static void Admin() { System.Console.Write("UserName:"******"PassWord:"******"Admin" && passWord == "Admin123") { MenuPrensentor wareHousePresntation = new MenuPrensentor(); ProductPresentation productPresentation = new ProductPresentation(); RawMaterialPresentationLayer rawMaterialPresentation = new RawMaterialPresentationLayer(); StockPresentationLayer stockPresentationLayer = new StockPresentationLayer(); ProductRawMaterialPresentation productRawMaterialPresentation = new ProductRawMaterialPresentation(); int option; do { System.Console.WriteLine("1. WareHouse"); System.Console.WriteLine("2. Add Product"); System.Console.WriteLine("3. RawMaterialsDetails"); System.Console.WriteLine("4. Stock"); System.Console.WriteLine("5. Add Product RawMaterial"); System.Console.WriteLine("6. Exit"); bool b = int.TryParse(System.Console.ReadLine(), out option); if (b == true) { try { switch (option) { case 1: wareHousePresntation.WareHouseMenu(); break; case 2: productPresentation.menu(); break; case 3: rawMaterialPresentation.RawMaterialMenu(); break; case 4: stockPresentationLayer.menu(); break; case 5: productRawMaterialPresentation.ProductRawMaterialMenu(); break; default: System.Console.WriteLine("Please Enter the Correct Option"); break; } } catch (Exception e) { Console.WriteLine(e.Message); } } else { System.Console.WriteLine("Please Enter the only digits"); } } while (option != 6); } else { System.Console.WriteLine("Entered UserName/password is invalid (Username contains only Alphabets,password is combination of alphabets & digits and starting letter should be uppercase)"); } }
/// <summary> /// Local Function to Add Stock /// </summary> public static void AddStock() { ProductBusiness productBusinessLogic = new ProductBusiness(); MenuPrensentor wareHousePresentation = new MenuPrensentor(); StockBusinessLogicLayer stockBusinessLogicLayer = new StockBusinessLogicLayer(); // creation stockBusinessLogic object Stock stock = new Stock(); //creation of stock object of entite Layer bool check = false; try { System.Console.WriteLine("Enter StockID"); stock.StockID = System.Console.ReadLine(); do { try { bool check1 = false; 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) == true)//checking whether the Warehouse Id is present in the list of warehouse { do { try { check = true; 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 { bool check2 = false; check1 = true; do { try { System.Console.WriteLine("Enter Product ID"); System.Console.WriteLine("Product ID Should not NULL and ProductID Should Start with PID and 0-9 number and length should be 6"); stock.ProductID = System.Console.ReadLine(); if (productBusinessLogic.CheckProductID(stock.ProductID))//checking whether product is available in the list or not { check2 = true; System.Console.WriteLine("Enter no of Quantities u want to add"); stock.Quantity = System.Convert.ToInt32(System.Console.ReadLine()); stockBusinessLogicLayer.AddStock(stock); Console.WriteLine("Stock Added Sucessfully!!"); } } catch (StockException e) { System.Console.WriteLine(e.Message); } } while (check2 == false); } } catch (StockException e) { System.Console.WriteLine(e.Message); } } while (check1 == false); } } catch (StockException e) { System.Console.WriteLine(e.Message); } } while (check == false); } catch (StockException e) { System.Console.WriteLine(e.Message); } }
/// <summary> /// used to update the stock of the product /// </summary> public void UpdateStockQuantity() { StockBusinessLogicLayer stockBusinessLogicLayer = new StockBusinessLogicLayer(); Stock stock = new Stock(); ProductBusiness productBusinessLogic = new ProductBusiness(); MenuPrensentor wareHousePresentation = new MenuPrensentor(); bool check = false; do { try { System.Console.WriteLine("enter to which WarehouseId you want to update the quantity:"); 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 to which WarehouseAddress you want to update the quantity:"); 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 { bool check2 = false; check1 = true; do { try { System.Console.WriteLine("enter to which ProductID you want to update the quantity"); System.Console.WriteLine("Product ID Should not NULL and ProductID Should Start with PID and 0-9 number and length should be 6"); stock.ProductID = System.Console.ReadLine(); if (productBusinessLogic.CheckProductID(stock.ProductID))//checking whether product is available in the list or not { check2 = true; System.Console.WriteLine("enter the quantity to be updated:"); stock.Quantity = System.Convert.ToInt32(System.Console.ReadLine()); stockBusinessLogicLayer.UpdateStockQuantity(stock); System.Console.WriteLine("Stock quntity Updated Sucessfully"); } } catch (StockException e) { System.Console.WriteLine(e.Message); } } while (check2 == false); } } catch (StockException e) { System.Console.WriteLine(e.Message); } } while (check1 == false); } } catch (StockException e) { System.Console.WriteLine(e.Message); } } while (check == false); }