/// <summary> /// This method deletes a 'Member' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'Member' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject DeleteMember(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 DeleteMemberStoredProcedure deleteMemberProc = null; // verify the first parameters is a(n) 'Member'. if (parameters[0].ObjectValue as Member != null) { // Create Member Member member = (Member)parameters[0].ObjectValue; // verify member exists if (member != null) { // Now create deleteMemberProc from MemberWriter // The DataWriter converts the 'Member' // to the SqlParameter[] array needed to delete a 'Member'. deleteMemberProc = MemberWriter.CreateDeleteMemberStoredProcedure(member); } } // Verify deleteMemberProc exists if (deleteMemberProc != null) { // Execute Delete Stored Procedure bool deleted = this.DataManager.MemberManager.DeleteMember(deleteMemberProc, 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 creates an instance of an /// 'DeleteMember'StoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'Member_Delete'. /// </summary> /// <param name="member">The 'Member' to Delete.</param> /// <returns>An instance of a 'DeleteMemberStoredProcedure' object.</returns> public static DeleteMemberStoredProcedure CreateDeleteMemberStoredProcedure(Member member) { // Initial Value DeleteMemberStoredProcedure deleteMemberStoredProcedure = new DeleteMemberStoredProcedure(); // Now Create Parameters For The DeleteProc deleteMemberStoredProcedure.Parameters = CreatePrimaryKeyParameter(member); // return value return(deleteMemberStoredProcedure); }
/// <summary> /// This method deletes a 'Member' object. /// </summary> /// <returns>True if successful false if not.</returns> /// </summary> public bool DeleteMember(DeleteMemberStoredProcedure deleteMemberProc, DataConnector databaseConnector) { // Initial Value bool deleted = false; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // Execute Non Query deleted = this.DataHelper.DeleteRecord(deleteMemberProc, databaseConnector); } // return value return(deleted); }