Example #1
0
        /// <summary>
        /// This method finds a  'Notification' object.
        /// This method uses the 'Notification_Find' procedure.
        /// </summary>
        /// <returns>A 'Notification' object.</returns>
        /// </summary>
        public Notification FindNotification(FindNotificationStoredProcedure findNotificationProc, DataConnector databaseConnector)
        {
            // Initial Value
            Notification notification = null;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // First Get Dataset
                DataSet notificationDataSet = this.DataHelper.LoadDataSet(findNotificationProc, databaseConnector);

                // Verify DataSet Exists
                if (notificationDataSet != null)
                {
                    // Get DataTable From DataSet
                    DataRow row = this.DataHelper.ReturnFirstRow(notificationDataSet);

                    // if row exists
                    if (row != null)
                    {
                        // Load Notification
                        notification = NotificationReader.Load(row);
                    }
                }
            }

            // return value
            return(notification);
        }
        /// <summary>
        /// This method finds a 'Notification' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'Notification' to delete.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject FindNotification(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 Find StoredProcedure
                FindNotificationStoredProcedure findNotificationProc = null;

                // verify the first parameters is a 'Notification'.
                if (parameters[0].ObjectValue as Notification != null)
                {
                    // Get NotificationParameter
                    Notification paramNotification = (Notification)parameters[0].ObjectValue;

                    // verify paramNotification exists
                    if (paramNotification != null)
                    {
                        // Now create findNotificationProc from NotificationWriter
                        // The DataWriter converts the 'Notification'
                        // to the SqlParameter[] array needed to find a 'Notification'.
                        findNotificationProc = NotificationWriter.CreateFindNotificationStoredProcedure(paramNotification);
                    }

                    // Verify findNotificationProc exists
                    if (findNotificationProc != null)
                    {
                        // Execute Find Stored Procedure
                        notification = this.DataManager.NotificationManager.FindNotification(findNotificationProc, dataConnector);

                        // if dataObject exists
                        if (notification != null)
                        {
                            // set returnObject.ObjectValue
                            returnObject.ObjectValue = notification;
                        }
                    }
                }
                else
                {
                    // Raise Error Data Connection Not Available
                    throw new Exception("The database connection is not available.");
                }
            }

            // return value
            return(returnObject);
        }
Example #3
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FindNotificationStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Notification_Find'.
        /// </summary>
        /// <param name="notification">The 'Notification' to use to
        /// get the primary key parameter.</param>
        /// <returns>An instance of an FetchUserStoredProcedure</returns>
        public static FindNotificationStoredProcedure CreateFindNotificationStoredProcedure(Notification notification)
        {
            // Initial Value
            FindNotificationStoredProcedure findNotificationStoredProcedure = null;

            // verify notification exists
            if (notification != null)
            {
                // Instanciate findNotificationStoredProcedure
                findNotificationStoredProcedure = new FindNotificationStoredProcedure();

                // Now create parameters for this procedure
                findNotificationStoredProcedure.Parameters = CreatePrimaryKeyParameter(notification);
            }

            // return value
            return(findNotificationStoredProcedure);
        }
Example #4
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FindNotificationStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Notification_Find'.
        /// </summary>
        /// <param name="notification">The 'Notification' to use to
        /// get the primary key parameter.</param>
        /// <returns>An instance of an FetchUserStoredProcedure</returns>
        public static new FindNotificationStoredProcedure CreateFindNotificationStoredProcedure(Notification notification)
        {
            // Initial Value
            FindNotificationStoredProcedure findNotificationStoredProcedure = null;

            // verify notification exists
            if (notification != null)
            {
                // Instanciate findNotificationStoredProcedure
                findNotificationStoredProcedure = new FindNotificationStoredProcedure();

                // if notification.FindBy is true
                if (notification.FindBy)
                {
                    // Change the procedure name
                    findNotificationStoredProcedure.ProcedureName = "Notification_FindBy";

                    // Create the @EmailAddress parameter
                    findNotificationStoredProcedure.Parameters = SqlParameterHelper.CreateSqlParameters("@EmailAddress", notification.EmailAddress);
                }
                // if notification.FindByEmailAddress is true
                else if (notification.FindByEmailAddress)
                {
                    // Change the procedure name
                    findNotificationStoredProcedure.ProcedureName = "Notification_FindByEmailAddress";

                    // Create the @EmailAddress parameter
                    findNotificationStoredProcedure.Parameters = SqlParameterHelper.CreateSqlParameters("@EmailAddress", notification.EmailAddress);
                }
                else
                {
                    // Now create parameters for this procedure
                    findNotificationStoredProcedure.Parameters = CreatePrimaryKeyParameter(notification);
                }
            }

            // return value
            return(findNotificationStoredProcedure);
        }