/// <summary> /// This method fetches a 'List<Notification>' object. /// This method uses the 'Notifications_FetchAll' procedure. /// </summary> /// <returns>A 'List<Notification>'</returns> /// </summary> public List <Notification> FetchAllNotifications(FetchAllNotificationsStoredProcedure fetchAllNotificationsProc, DataConnector databaseConnector) { // Initial Value List <Notification> notificationCollection = null; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // First Get Dataset DataSet allNotificationsDataSet = this.DataHelper.LoadDataSet(fetchAllNotificationsProc, databaseConnector); // Verify DataSet Exists if (allNotificationsDataSet != null) { // Get DataTable From DataSet DataTable table = this.DataHelper.ReturnFirstTable(allNotificationsDataSet); // if table exists if (table != null) { // Load Collection notificationCollection = NotificationReader.LoadCollection(table); } } } // return value return(notificationCollection); }
/// <summary> /// This method creates an instance of a /// 'FetchAllNotificationsStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'Notification_FetchAll'. /// </summary> /// <returns>An instance of a(n) 'FetchAllNotificationsStoredProcedure' object.</returns> public static FetchAllNotificationsStoredProcedure CreateFetchAllNotificationsStoredProcedure(Notification notification) { // Initial value FetchAllNotificationsStoredProcedure fetchAllNotificationsStoredProcedure = new FetchAllNotificationsStoredProcedure(); // return value return(fetchAllNotificationsStoredProcedure); }
/// <summary> /// This method fetches all 'Notification' objects. /// </summary> /// <param name='List<PolymorphicObject>'>The 'Notification' to delete. /// <returns>A PolymorphicObject object with all 'Notifications' objects. internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals List <Notification> notificationListCollection = null; // Create FetchAll StoredProcedure FetchAllNotificationsStoredProcedure fetchAllProc = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Get NotificationParameter // Declare Parameter Notification paramNotification = null; // verify the first parameters is a(n) 'Notification'. if (parameters[0].ObjectValue as Notification != null) { // Get NotificationParameter paramNotification = (Notification)parameters[0].ObjectValue; } // Now create FetchAllNotificationsProc from NotificationWriter fetchAllProc = NotificationWriter.CreateFetchAllNotificationsStoredProcedure(paramNotification); } // Verify fetchAllProc exists if (fetchAllProc != null) { // Execute FetchAll Stored Procedure notificationListCollection = this.DataManager.NotificationManager.FetchAllNotifications(fetchAllProc, dataConnector); // if dataObjectCollection exists if (notificationListCollection != null) { // set returnObject.ObjectValue returnObject.ObjectValue = notificationListCollection; } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } // return value return(returnObject); }