/// <summary> /// This method deletes a 'LastName' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'LastName' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject DeleteLastName(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Delete StoredProcedure DeleteLastNameStoredProcedure deleteLastNameProc = null; // verify the first parameters is a(n) 'LastName'. if (parameters[0].ObjectValue as LastName != null) { // Create LastName LastName lastName = (LastName)parameters[0].ObjectValue; // verify lastName exists if (lastName != null) { // Now create deleteLastNameProc from LastNameWriter // The DataWriter converts the 'LastName' // to the SqlParameter[] array needed to delete a 'LastName'. deleteLastNameProc = LastNameWriter.CreateDeleteLastNameStoredProcedure(lastName); } } // Verify deleteLastNameProc exists if (deleteLastNameProc != null) { // Execute Delete Stored Procedure bool deleted = this.DataManager.LastNameManager.DeleteLastName(deleteLastNameProc, dataConnector); // Create returnObject.Boolean returnObject.Boolean = new NullableBoolean(); // If delete was successful if (deleted) { // Set returnObject.Boolean.Value to true returnObject.Boolean.Value = NullableBooleanEnum.True; } else { // Set returnObject.Boolean.Value to false returnObject.Boolean.Value = NullableBooleanEnum.False; } } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } // return value return(returnObject); }
/// <summary> /// This method finds a 'LastName' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'LastName' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject FindLastName(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals LastName lastName = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Find StoredProcedure FindLastNameStoredProcedure findLastNameProc = null; // verify the first parameters is a 'LastName'. if (parameters[0].ObjectValue as LastName != null) { // Get LastNameParameter LastName paramLastName = (LastName)parameters[0].ObjectValue; // verify paramLastName exists if (paramLastName != null) { // Now create findLastNameProc from LastNameWriter // The DataWriter converts the 'LastName' // to the SqlParameter[] array needed to find a 'LastName'. findLastNameProc = LastNameWriter.CreateFindLastNameStoredProcedure(paramLastName); } // Verify findLastNameProc exists if (findLastNameProc != null) { // Execute Find Stored Procedure lastName = this.DataManager.LastNameManager.FindLastName(findLastNameProc, dataConnector); // if dataObject exists if (lastName != null) { // set returnObject.ObjectValue returnObject.ObjectValue = lastName; } } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } } // return value return(returnObject); }
/// <summary> /// This method fetches all 'LastName' objects. /// </summary> /// <param name='List<PolymorphicObject>'>The 'LastName' to delete. /// <returns>A PolymorphicObject object with all 'LastNames' objects. internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals List <LastName> lastNameListCollection = null; // Create FetchAll StoredProcedure FetchAllLastNamesStoredProcedure fetchAllProc = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Get LastNameParameter // Declare Parameter LastName paramLastName = null; // verify the first parameters is a(n) 'LastName'. if (parameters[0].ObjectValue as LastName != null) { // Get LastNameParameter paramLastName = (LastName)parameters[0].ObjectValue; } // Now create FetchAllLastNamesProc from LastNameWriter fetchAllProc = LastNameWriter.CreateFetchAllLastNamesStoredProcedure(paramLastName); } // Verify fetchAllProc exists if (fetchAllProc != null) { // Execute FetchAll Stored Procedure lastNameListCollection = this.DataManager.LastNameManager.FetchAllLastNames(fetchAllProc, dataConnector); // if dataObjectCollection exists if (lastNameListCollection != null) { // set returnObject.ObjectValue returnObject.ObjectValue = lastNameListCollection; } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } // return value return(returnObject); }