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