/// <summary> /// Method to GET WareHouseAddress details by WareHouseId /// </summary> public void GetAddressByWareHouseID() { bool check = false; do { try { WriteLine("You chose to Get the Address details byWareHouseId"); //Created an object for WarehouseAddress Business class and is stored in a reference variable WareHouseAddressBusinessLogicLayer wabl = new WareHouseAddressBusinessLogicLayer(); WriteLine("Enter the existing WareHouse Id"); WriteLine("The Warehouse Id should start with WHID and of length 6.It shouldn't contain special characters"); //Reads the WareHouseId and is stored in a reference variable string warehouseid = ReadLine(); //Calls the GetAddressByAddressID methof of WareHouseAddressBusinessLogicLayer WareHouseAddress add = wabl.GetAddressByWareHouseID(warehouseid); //Condition to check whether the address id exists or not if (add != null) { check = true; WriteLine("WareHouseID" + " " + "AddressID" + " " + "Door Number" + " " + "LocationName" + " " + "State" + " " + "Pincode"); WriteLine(add.WareHouseId + " " + add.AddressId + " " + add.DoorNumber + " " + add.LocationName + " " + add.State + " " + add.Pincode); } } catch (WareHouseException ex) { WriteLine(ex.Message); } } while (check == false); }
/// <summary> /// Method to REMOVE an address of the Warehouse /// </summary> public void RemoveWareHouseAddress() { WareHouseAddress w = new WareHouseAddress(); // creating the object for Warehouse class WareHouseAddressBusinessLogicLayer wabl = new WareHouseAddressBusinessLogicLayer(); // Creating thhe object for WareHouseBusinessLogic class WriteLine("select on which type you want to remove the WareHouse Address"); WriteLine("1.on WareHouseId"); WriteLine("2.on AddressId"); int Option; bool a; a = int.TryParse(ReadLine(), out Option); if (a == true) { switch (Option) { case 1: RemoveAddressByWareHouseID(); break; case 2: RemoveAddressByAddressID(); break; default: WriteLine("Please Choose enter correct Option"); break; } } else { WriteLine("Please Enter Correct Option"); } //Local function to REMOVE an address of the Warehouse by wareHouseID void RemoveAddressByWareHouseID() { bool check = false; do { WriteLine("You chose to Remove the Address by WareHouseId"); Write("Enter the WarehouseID of the Address to be Deleted:"); WriteLine("The WareHouse Id should start with WHID and of length 6.It shouldn't contain special characters"); //Reads the WarehouseID and is stored in a reference variable string whID = ReadLine(); try { WareHouseAddress addr = wabl.GetAddressByWareHouseID(whID); // Condition to check whether WarHouseId exists or not if (addr != null) { check = true; //Calls the RemoveAddressByWareHouseID method of WareHouseAddressBusinessLogicLayer wabl.RemoveAddressByWareHouseID(whID); WriteLine("Warehouse Removed"); } } catch (WareHouseException ex) { WriteLine(ex.Message); } } while (check == false); } //Local function to REMOVE an address of the Warehouse by addressID void RemoveAddressByAddressID() { bool check = false; do { WriteLine("You chose to Remove the Address by AddressId"); Write("Enter the AddressId to be Deleted:"); WriteLine("The Address Id should start with W and of length 4.It shouldn't contain special characters"); //Reads the entered AddressId string addressId = ReadLine(); try { WareHouseAddress addr = wabl.GetAddressByAddressID(addressId); // Condition to check whether AddressId exists or not if (addr != null) { check = true; //Calls the RemoveAddressByAddressID method of WareHouseAddressBusinessLogicLayer wabl.RemoveAddressByAddressID(addressId); WriteLine("Warehouse Removed"); } } catch (WareHouseException ex) { WriteLine(ex.Message); } } while (check == false); } }