/// <summary> /// Method to GET WareHouseAddress details by AddressId /// </summary> public void GetAddressByAddressID() { bool check = false; do { try { WriteLine("You chose to Get the Address details by AddressId"); //Created an object for WareHouseAddressBusinessLogicLayer and is stored in a reference variable WareHouseAddressBusinessLogicLayer wabl = new WareHouseAddressBusinessLogicLayer(); WriteLine("Enter the existing WareHouse Address Id"); WriteLine("The Address Id should start with W and of length 4.It shouldn't contain special characters"); //Reads the AddressId and is stored in a reference variable string addressid = ReadLine(); //Calls the GetAddressByAddressID methof of WareHouseAddressBusinessLogicLayer WareHouseAddress add = wabl.GetAddressByAddressID(addressid); //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); } }
/// <summary> /// Method to UPDATE the details of WareHouse Address /// </summary> public void UpdateWareHouseAddress() { //Created an object for WareHouseAddress Business class and stored it in a reference variable WareHouseAddressBusinessLogicLayer wabl = new WareHouseAddressBusinessLogicLayer(); WriteLine("1. Update Door Number "); WriteLine("2. Update Location Name"); WriteLine("3. Update State"); WriteLine("4. Update Pincode"); int Option; bool a; a = int.TryParse(ReadLine(), out Option); if (a == true) { switch (Option) { case 1: UpdateDoorNumber(); break; case 2: UpdateLocationName(); break; case 3: UpdateState(); break; case 4: UpdatePincode(); break; default: WriteLine("Enter correct option"); break; } } //Local Function to UPDATE Door Number of WareHouse void UpdateDoorNumber() { bool check = false; do { try { WriteLine("You chose to Update the Door Number of a WareHouse Address"); WriteLine("Enter Existing Address ID"); WriteLine("The Address Id should start with W and of length 4.It shouldn't contain special characters"); //Reads the AddressId and is stored in a reference variable string adId = ReadLine(); //Calls the GetAddressByAddressID methof of WareHouseAddressBusinessLogicLayer WareHouseAddress wadd = wabl.GetAddressByAddressID(adId); //Condition to check whether AddressId is null or not if (wadd != null) { check = true; WriteLine("Enter the new Door Number for the WareHouse"); WriteLine("Door Number shouldn't be null or empty"); //Reads the DoorNumber and is stored in reference variable wadd.DoorNumber = ReadLine(); //Calls the UpdateDoorNumber method of WareHouseAddressBusiess Logic wabl.UpdateDoorNumber(wadd); WriteLine("Door Number Updated Sucessfully!!!"); } else { WriteLine("Address id doesn't exist"); } } catch (WareHouseException ex) { WriteLine(ex.Message); } } while (check == false); } //Local Function to UPDATE the Location Name of WareHouse void UpdateLocationName() { bool check = false; do { try { WriteLine("You chose to Update the LocationName of a WareHouse Address"); WriteLine("Enter Existing Address ID"); WriteLine("The Address Id should start with W and of length 4.It shouldn't contain special characters"); //Reads the AddressId and is stored in a reference variable string adId = ReadLine(); //Calls the GetAddressByAddressID methof of WareHouseAddressBusinessLogicLayer WareHouseAddress wadd = wabl.GetAddressByAddressID(adId); //Condition to check whether AddressId is null or not if (wadd != null) { check = true; WriteLine("Enter the new Location Name for the WareHouse"); WriteLine("Location name shouldn't be null or empty and special characters are not allowed "); //Reads the LocationName and is stored in reference variable wadd.LocationName = ReadLine(); //Calls the UpdateLocationName method of WareHouseAddressBusiess Logic wabl.UpdateLocationName(wadd); WriteLine("Door Number Updated Sucessfully!!!"); } else { WriteLine("Address id doesn't exist"); } } catch (WareHouseException ex) { WriteLine(ex.Message); } } while (check == false); } //Local Function to UPDATE the State of WareHouse void UpdateState() { bool check = false; do { try { WriteLine("You chose to Update the State of a WareHouse Address"); WriteLine("Enter Existing Address ID"); WriteLine("The Address Id should start with W and of length 4.It shouldn't contain special characters"); //Reads the AddressId and is stored in a reference variable string adId = ReadLine(); //Calls the GetAddressByAddressID method of WareHouseAddressBusinessLogicLayer WareHouseAddress wadd = wabl.GetAddressByAddressID(adId); //Condition to check whether AddressId is null or not if (wadd != null) { check = true; WriteLine("Enter the new State for the WareHouse"); WriteLine("State shouldn't be null or empty and special characters are not allowed "); //Reads the State and is stored in an reference variable wadd.State = ReadLine(); //Calls the UpdateState method of WareHouseAddressBusinessLogicLayer wabl.UpdateState(wadd); WriteLine("Door Number Updated Sucessfully!!!"); } else { WriteLine("Address id doesn't exist"); } } catch (WareHouseException ex) { WriteLine(ex.Message); } } while (check == false); } //Local Function to UPDATE the Pincode of WareHouse void UpdatePincode() { bool check = false; do { try { WriteLine("You chose to Update the Pincode of a WareHouse Address"); WriteLine("Enter Existing Address ID"); WriteLine("The Address Id should start with W and of length 4.It shouldn't contain special characters"); //Reads the AddressId and is stored in a reference variable string adId = ReadLine(); //Calls the GetAddressByAddressID method of WareHouseAddressBusinessLogicLayer WareHouseAddress wadd = wabl.GetAddressByAddressID(adId); //Condition to check whether AddressId is null or not if (wadd != null) { check = true; WriteLine("Enter the new Pincode for the WareHouse"); WriteLine("Numeric values with length 6 are only allowed"); //Reads the Pincode and is stored in a reference variable wadd.Pincode = ReadLine(); //Calls the UpdatePincode method of WareHouseAddressBusinessLogicLayer wabl.UpdatePincode(wadd); WriteLine("Door Number Updated Sucessfully!!!"); } else { WriteLine("Address id doesn't exist"); } } catch (WareHouseException ex) { WriteLine(ex.Message); } } while (check == false); } }