public static void UpdateQuantityOfProduct() { ProductRawMaterial productRawMaterial = new ProductRawMaterial(); ProductRawMaterialBusinessLogicLayer prbl = new ProductRawMaterialBusinessLogicLayer();//creating object of businessLogicLayer class System.Console.WriteLine("enter ProductID (ProductID must Starts With *PID*)"); productRawMaterial.ProductID = System.Console.ReadLine(); System.Console.WriteLine("enter RawMaterialID (RawMaterialID must Starts With *RMID* and length should be *6*)"); productRawMaterial.RawMaterialID = System.Console.ReadLine(); ProductRawMaterial a = prbl.GetProductRawMaterialByID(productRawMaterial.ProductID, productRawMaterial.RawMaterialID); if (a != null) { productRawMaterial.RawMaterialName = a.RawMaterialName; System.Console.WriteLine(productRawMaterial.RawMaterialName); System.Console.WriteLine("Enter the Quantity"); productRawMaterial.Quantity = System.Convert.ToDouble(System.Console.ReadLine()); prbl.UpdateQuantityOfProduct(productRawMaterial); System.Console.WriteLine("******************* Successfully added RawMaterial Details to ProductID " + productRawMaterial.ProductID + " ************** "); } else { System.Console.WriteLine("**************entered ProductID " + productRawMaterial.ProductID + " and RawMaterialID " + productRawMaterial.RawMaterialID + " doesn't exists. Pls Try again*************"); } }
public static void GetDetailsUsingOrderBy() { ProductRawMaterial productRawMaterial = new ProductRawMaterial(); ProductRawMaterialBusinessLogicLayer prbl = new ProductRawMaterialBusinessLogicLayer(); //creating object of businessLogicLayer class List <ProductRawMaterial> rms = prbl.GetDetailsUsingOrderBy(); // call the GetRawMaterial method with no arguments in the BusinessLogicLayer by using Refernce Variable System.Console.WriteLine("**********************************************************************************"); foreach (ProductRawMaterial rm in rms)//to print the list { System.Console.WriteLine("ProductID:-" + rm.ProductID + " RawMaterialID:-" + rm.RawMaterialID + " RawMaterialName:-" + rm.RawMaterialName + " Quantity:-" + rm.Quantity + "" + rm.Units); } System.Console.WriteLine("**********************************************************************************"); }
public static void GetDetailsByProductID() { ProductRawMaterial productRawMaterial = new ProductRawMaterial(); System.Console.WriteLine("enter ProductID (ProductID must Starts With *PID*)"); productRawMaterial.ProductID = System.Console.ReadLine(); System.Console.WriteLine("ProductID:-" + productRawMaterial.ProductID); ProductRawMaterialBusinessLogicLayer prbl = new ProductRawMaterialBusinessLogicLayer();//creating object of businessLogicLayer class List <ProductRawMaterial> prm = prbl.GetDetailsByProductID(productRawMaterial); foreach (ProductRawMaterial rm in prm)//to print the list { System.Console.WriteLine("RawMaterialID:-" + rm.RawMaterialID + " RawMaterialName:-" + rm.RawMaterialName + " Quantity:-" + rm.Quantity + "" + rm.Units); } System.Console.WriteLine("**********************************************************************************"); }
public static void AddRawMaterialToProduct() { ProductRawMaterial productRawMaterial = new ProductRawMaterial(); ProductRawMaterialBusinessLogicLayer prbl = new ProductRawMaterialBusinessLogicLayer(); //creating object of businessLogicLayer class System.Console.WriteLine("enter ProductID (ProductID must Starts With *PID*)"); productRawMaterial.ProductID = System.Console.ReadLine(); Product a = prbl.GetProductByProductID(productRawMaterial.ProductID); if (a != null) { productRawMaterial.ProductID = a.ProductID; System.Console.WriteLine("enter RawMaterialID (RawMaterialID must Starts With *RMID* and length should be *6*)"); productRawMaterial.RawMaterialID = System.Console.ReadLine(); RawMaterial prm = prbl.GetRawMaterialByRawMaterialID(productRawMaterial.RawMaterialID); if (prm != null) { productRawMaterial.RawMaterialID = prm.RawMaterialID; productRawMaterial.RawMaterialName = prm.RawMaterialName; System.Console.WriteLine(productRawMaterial.RawMaterialName); if (prbl.GetDetailsByProductIDAndRawMaterialID(productRawMaterial) == null) { System.Console.WriteLine("Enter the Quantity"); productRawMaterial.Quantity = System.Convert.ToDouble(System.Console.ReadLine()); System.Console.WriteLine("Enter the Units"); productRawMaterial.Units = System.Console.ReadLine(); prbl.AddRawMaterialToProduct(productRawMaterial); System.Console.WriteLine("******************* Successfully added RawMaterial Details to ProductID " + productRawMaterial.ProductID + " ************** "); } else { System.Console.WriteLine("*************** Entered details all ready exits ********************"); } } else { System.Console.WriteLine("**************entered RawMaterialID " + productRawMaterial.RawMaterialID + " does not exists. Pls Try again*************"); } } else { throw new ProductRawMaterialException("**************entered ProductID " + productRawMaterial.ProductID + " doesn't exists. Pls Try again*************"); } }
public static void DeleteRawMaterialOfProduct() { ProductRawMaterial productRawMaterial = new ProductRawMaterial(); ProductRawMaterialBusinessLogicLayer prbl = new ProductRawMaterialBusinessLogicLayer();//creating object of businessLogicLayer class System.Console.WriteLine("enter ProductID (ProductID must Starts With *PID*)"); productRawMaterial.ProductID = System.Console.ReadLine(); System.Console.WriteLine("enter RawMaterialID (RawMaterialID must Starts With *RMID* and length should be *6*)"); productRawMaterial.RawMaterialID = System.Console.ReadLine(); if (prbl.GetProductRawMaterialByID(productRawMaterial.ProductID, productRawMaterial.RawMaterialID) != null) { prbl.DeleteRawMaterialOfProduct(productRawMaterial); System.Console.WriteLine("******************* Successfully deleted RawMaterial Details from ProductID " + productRawMaterial.ProductID + " ************** "); } else { System.Console.WriteLine("**************entered ProductID " + productRawMaterial.ProductID + " and RawMaterialID " + productRawMaterial.RawMaterialID + " doesn't exists. Pls Try again*************"); } }