/// <summary> /// This method inserts a 'Notification' object. /// This method uses the 'Notification_Insert' procedure. /// </summary> /// <returns>The identity value of the new record.</returns> /// </summary> public int InsertNotification(InsertNotificationStoredProcedure insertNotificationProc, DataConnector databaseConnector) { // Initial Value int newIdentity = -1; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // Execute Non Query newIdentity = this.DataHelper.InsertRecord(insertNotificationProc, databaseConnector); } // return value return(newIdentity); }
/// <summary> /// This method inserts a 'Notification' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'Notification' to insert. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject InsertNotification(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals Notification notification = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Insert StoredProcedure InsertNotificationStoredProcedure insertNotificationProc = null; // verify the first parameters is a(n) 'Notification'. if (parameters[0].ObjectValue as Notification != null) { // Create Notification Parameter notification = (Notification)parameters[0].ObjectValue; // verify notification exists if (notification != null) { // Now create insertNotificationProc from NotificationWriter // The DataWriter converts the 'Notification' // to the SqlParameter[] array needed to insert a 'Notification'. insertNotificationProc = NotificationWriter.CreateInsertNotificationStoredProcedure(notification); } // Verify insertNotificationProc exists if (insertNotificationProc != null) { // Execute Insert Stored Procedure returnObject.IntegerValue = this.DataManager.NotificationManager.InsertNotification(insertNotificationProc, dataConnector); } } 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 /// 'InsertNotificationStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'Notification_Insert'. /// </summary> /// <param name="notification"The 'Notification' object to insert</param> /// <returns>An instance of a 'InsertNotificationStoredProcedure' object.</returns> public static InsertNotificationStoredProcedure CreateInsertNotificationStoredProcedure(Notification notification) { // Initial Value InsertNotificationStoredProcedure insertNotificationStoredProcedure = null; // verify notification exists if (notification != null) { // Instanciate insertNotificationStoredProcedure insertNotificationStoredProcedure = new InsertNotificationStoredProcedure(); // Now create parameters for this procedure insertNotificationStoredProcedure.Parameters = CreateInsertParameters(notification); } // return value return(insertNotificationStoredProcedure); }