/// <summary author="Danielle Russo" created="2019/01/31"> /// Edits building details /// </summary> /// <param name="oldBuilding">The original Building obj to be updated</param> /// <param name="updatedBuilding">The updated Building obj</param> /// <exception cref="SQLException">Insert Fails (example of exception tag)</exception> /// <returns>True if Building was successfully updated, False if Building was not updated.</returns> public bool UpdateBuilding(Building oldBuilding, Building updatedBuilding) { bool result = false; try { LogicValidationExtensionMethods.ValdateMatchingIDs(oldBuilding.BuildingID, updatedBuilding.BuildingID); LogicValidationExtensionMethods.ValidateBuildingID(updatedBuilding.BuildingID); LogicValidationExtensionMethods.ValidateBuildingName(updatedBuilding.Name); LogicValidationExtensionMethods.ValidateBuildingAddress(updatedBuilding.Address); LogicValidationExtensionMethods.ValidateBuildngDescription(updatedBuilding.Description); LogicValidationExtensionMethods.ValidateBuildingStatusID(updatedBuilding.StatusID); result = (1 == buildingAccessor.UpdateBuilding(oldBuilding, updatedBuilding)); } catch (ArgumentNullException ane) { ExceptionLogManager.getInstance().LogException(ane); throw ane; } catch (ArgumentException ae) { ExceptionLogManager.getInstance().LogException(ae); throw ae; } catch (Exception ex) { ExceptionLogManager.getInstance().LogException(ex); throw ex; } return(result); }
/// <summary author="Danielle Russo" created="2019/01/21"> /// Adds a new Building obj. /// </summary> /// <updates> /// <update author="Danielle Russo" date="2019/02/28"> /// Changed 1 to 2 so that it will pass for now /// </update> /// <param name="newBuilding">The Building obj to be added</param> /// <exception cref="SQLException">Insert Fails (example of exception tag)</exception> /// <returns>True if Building was successfully added, False if Building was not added.</returns> public bool CreateBuilding(Building newBuilding) { bool result = false; try { LogicValidationExtensionMethods.ValidateBuildingID(newBuilding.BuildingID); LogicValidationExtensionMethods.ValidateBuildingName(newBuilding.Name); LogicValidationExtensionMethods.ValidateBuildingAddress(newBuilding.Address); LogicValidationExtensionMethods.ValidateBuildngDescription(newBuilding.Description); LogicValidationExtensionMethods.ValidateBuildingStatusID(newBuilding.StatusID); result = (2 == buildingAccessor.InsertBuilding(newBuilding)); } catch (ArgumentNullException ane) { ExceptionLogManager.getInstance().LogException(ane); throw ane; } catch (ArgumentException ae) { ExceptionLogManager.getInstance().LogException(ae); throw ae; } catch (Exception ex) { ExceptionLogManager.getInstance().LogException(ex); throw ex; } return(result); }