/// <summary>
        /// This method finds a  'Project' object.
        /// This method uses the 'Project_Find' procedure.
        /// </summary>
        /// <returns>A 'Project' object.</returns>
        /// </summary>
        public Project FindProject(FindProjectStoredProcedure findProjectProc, DataConnector databaseConnector)
        {
            // Initial Value
            Project project = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load Project
                        project = ProjectReader.Load(row);
                    }
                }
            }

            // return value
            return(project);
        }
示例#2
0
        /// <summary>
        /// This method finds a  'Noun' object.
        /// This method uses the 'Noun_Find' procedure.
        /// </summary>
        /// <returns>A 'Noun' object.</returns>
        /// </summary>
        public Noun FindNoun(FindNounStoredProcedure findNounProc, DataConnector databaseConnector)
        {
            // Initial Value
            Noun noun = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load Noun
                        noun = NounReader.Load(row);
                    }
                }
            }

            // return value
            return(noun);
        }
        /// <summary>
        /// This method finds a  'Adverb' object.
        /// This method uses the 'Adverb_Find' procedure.
        /// </summary>
        /// <returns>A 'Adverb' object.</returns>
        /// </summary>
        public Adverb FindAdverb(FindAdverbStoredProcedure findAdverbProc, DataConnector databaseConnector)
        {
            // Initial Value
            Adverb adverb = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load Adverb
                        adverb = AdverbReader.Load(row);
                    }
                }
            }

            // return value
            return(adverb);
        }
示例#4
0
        /// <summary>
        /// This method finds a  'Image' object.
        /// This method uses the 'Image_Find' procedure.
        /// </summary>
        /// <returns>A 'Image' object.</returns>
        /// </summary>
        public Image FindImage(FindImageStoredProcedure findImageProc, DataConnector databaseConnector)
        {
            // Initial Value
            Image image = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load Image
                        image = ImageReader.Load(row);
                    }
                }
            }

            // return value
            return(image);
        }
示例#5
0
        /// <summary>
        /// This method finds a  'User' object.
        /// This method uses the 'User_Find' procedure.
        /// </summary>
        /// <returns>A 'User' object.</returns>
        /// </summary>
        public User FindUser(FindUserStoredProcedure findUserProc, DataConnector databaseConnector)
        {
            // Initial Value
            User user = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load User
                        user = UserReader.Load(row);
                    }
                }
            }

            // return value
            return(user);
        }
示例#6
0
        /// <summary>
        /// This method finds a  'ToDo' object.
        /// This method uses the 'ToDo_Find' procedure.
        /// </summary>
        /// <returns>A 'ToDo' object.</returns>
        /// </summary>
        public ToDo FindToDo(FindToDoStoredProcedure findToDoProc, DataConnector databaseConnector)
        {
            // Initial Value
            ToDo toDo = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load ToDo
                        toDo = ToDoReader.Load(row);
                    }
                }
            }

            // return value
            return(toDo);
        }
示例#7
0
        /// <summary>
        /// This method finds a  'Method' object.
        /// This method uses the 'Method_Find' procedure.
        /// </summary>
        /// <returns>A 'Method' object.</returns>
        /// </summary>
        public Method FindMethod(FindMethodStoredProcedure findMethodProc, DataConnector databaseConnector)
        {
            // Initial Value
            Method method = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load Method
                        method = MethodReader.Load(row);
                    }
                }
            }

            // return value
            return(method);
        }
        /// <summary>
        /// This method finds a  'DTNField' object.
        /// This method uses the 'DTNField_Find' procedure.
        /// </summary>
        /// <returns>A 'DTNField' object.</returns>
        /// </summary>
        public DTNField FindDTNField(FindDTNFieldStoredProcedure findDTNFieldProc, DataConnector databaseConnector)
        {
            // Initial Value
            DTNField dTNField = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load DTNField
                        dTNField = DTNFieldReader.Load(row);
                    }
                }
            }

            // return value
            return(dTNField);
        }
        /// <summary>
        /// This method finds a  'LastName' object.
        /// This method uses the 'LastName_Find' procedure.
        /// </summary>
        /// <returns>A 'LastName' object.</returns>
        /// </summary>
        public LastName FindLastName(FindLastNameStoredProcedure findLastNameProc, DataConnector databaseConnector)
        {
            // Initial Value
            LastName lastName = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load LastName
                        lastName = LastNameReader.Load(row);
                    }
                }
            }

            // return value
            return(lastName);
        }
示例#10
0
        /// <summary>
        /// This method uses the Microsoft.ApplicationBlocks.Data
        /// Method to insert a new record.
        /// </summary>
        /// <param name="storedProcedure">The 'StoredProcedure' to execute.</param>
        /// <returns>The identity value of the new record if successful or
        /// -1 if not.
        /// </returns>
        public int InsertRecord(StoredProcedure storedProcedure, DataConnector databaseConnector)
        {
            // initial value
            int identity = -1;

            // Execute StoredProcedure
            identity = Convert.ToInt32(SqlHelper.ExecuteScalar(databaseConnector.SqlConnector, CommandType.StoredProcedure, storedProcedure.ProcedureName, storedProcedure.Parameters));

            // return value
            return(identity);
        }
示例#11
0
        /// <summary>
        /// This method uses the Microsoft.ApplicationBlocks.Data
        /// Method to fill a DataSet.
        /// </summary>
        /// <param name="storedProcedure">The 'StoredProcedure' to execute.</param>
        /// <returns>A DataSet if successful or null if not. Always test for null
        /// befure using the returned data set.</returns>
        public DataSet LoadDataSet(StoredProcedure storedProcedure, DataConnector databaseConnector)
        {
            // initial value
            DataSet dataSet = null;

            // Execute StoredProcedure
            dataSet = SqlHelper.ExecuteDataset(databaseConnector.SqlConnector, CommandType.StoredProcedure, storedProcedure.ProcedureName, storedProcedure.Parameters);

            // return value
            return(dataSet);
        }
示例#12
0
        /// <summary>
        /// This method uses the Microsoft.ApplicationBlocks.Data
        /// Method to update an existing record by executing
        /// a query that does not return anything. (ExecuteNonQuery).
        /// </summary>
        /// <param name="storedProcedure">The 'StoredProcedure' to execute.</param>
        /// <returns>True as long as there is not an error, false if there is.
        /// </returns>
        public bool UpdateRecord(StoredProcedure storedProcedure, DataConnector databaseConnector)
        {
            // initial value
            bool saved = false;

            // Execute StoredProcedure
            SqlHelper.ExecuteNonQuery(databaseConnector.SqlConnector, CommandType.StoredProcedure, storedProcedure.ProcedureName, storedProcedure.Parameters);

            // set saved to true
            saved = true;

            // return value
            return(saved);
        }
示例#13
0
        /// <summary>
        /// This method deletes a 'Noun' object.
        /// </summary>
        /// <returns>True if successful false if not.</returns>
        /// </summary>
        public bool DeleteNoun(DeleteNounStoredProcedure deleteNounProc, DataConnector databaseConnector)
        {
            // Initial Value
            bool deleted = false;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // Execute Non Query
                deleted = this.DataHelper.DeleteRecord(deleteNounProc, databaseConnector);
            }

            // return value
            return(deleted);
        }
示例#14
0
        /// <summary>
        /// This method updates a 'Noun'.
        /// This method uses the 'Noun_Update' procedure.
        /// </summary>
        /// <returns>True if successful false if not.</returns>
        /// </summary>
        public bool UpdateNoun(UpdateNounStoredProcedure updateNounProc, DataConnector databaseConnector)
        {
            // Initial Value
            bool saved = false;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // Execute Update.
                saved = this.DataHelper.UpdateRecord(updateNounProc, databaseConnector);
            }

            // return value
            return(saved);
        }
示例#15
0
        /// <summary>
        /// This method inserts a 'Noun' object.
        /// This method uses the 'Noun_Insert' procedure.
        /// </summary>
        /// <returns>The identity value of the new record.</returns>
        /// </summary>
        public int InsertNoun(InsertNounStoredProcedure insertNounProc, DataConnector databaseConnector)
        {
            // Initial Value
            int newIdentity = -1;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // Execute Non Query
                newIdentity = this.DataHelper.InsertRecord(insertNounProc, databaseConnector);
            }

            // return value
            return(newIdentity);
        }
        /// <summary>
        /// This method Executes a Non Query StoredProcedure
        /// </summary>
        public PolymorphicObject ExecuteNonQuery(string procedureName, SqlParameter[] sqlParameters)
        {
            // initial value
            PolymorphicObject returnValue = new PolymorphicObject();

            // locals
            List <PolymorphicObject> parameters = new List <PolymorphicObject>();

            // create the parameters
            PolymorphicObject procedureNameParameter = new PolymorphicObject();
            PolymorphicObject sqlParametersParameter = new PolymorphicObject();

            // if the procedureName exists
            if (!String.IsNullOrEmpty(procedureName))
            {
                // Create an instance of the SystemMethods object
                SystemMethods systemMethods = new SystemMethods();

                // setup procedureNameParameter
                procedureNameParameter.Name = "ProcedureName";
                procedureNameParameter.Text = procedureName;

                // setup sqlParametersParameter
                sqlParametersParameter.Name        = "SqlParameters";
                sqlParametersParameter.ObjectValue = sqlParameters;

                // Add these parameters to the parameters
                parameters.Add(procedureNameParameter);
                parameters.Add(sqlParametersParameter);

                // get the dataConnector
                DataAccessComponent.DataManager.DataConnector dataConnector = GetDataConnector();

                // Execute the query
                returnValue = systemMethods.ExecuteNonQuery(parameters, dataConnector);
            }

            // return value
            return(returnValue);
        }
示例#17
0
        /// <summary>
        /// This method fetches a  'List<Noun>' object.
        /// This method uses the 'Nouns_FetchAll' procedure.
        /// </summary>
        /// <returns>A 'List<Noun>'</returns>
        /// </summary>
        public List <Noun> FetchAllNouns(FetchAllNounsStoredProcedure fetchAllNounsProc, DataConnector databaseConnector)
        {
            // Initial Value
            List <Noun> nounCollection = null;

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

                // Verify DataSet Exists
                if (allNounsDataSet != null)
                {
                    // Get DataTable From DataSet
                    DataTable table = this.DataHelper.ReturnFirstTable(allNounsDataSet);

                    // if table exists
                    if (table != null)
                    {
                        // Load Collection
                        nounCollection = NounReader.LoadCollection(table);
                    }
                }
            }

            // return value
            return(nounCollection);
        }
示例#18
0
        /// <summary>
        /// This method finds a  'Enumeration' object.
        /// This method uses the 'Enumeration_Find' procedure.
        /// </summary>
        /// <returns>A 'Enumeration' object.</returns>
        /// </summary>
        public Enumeration FindEnumeration(FindEnumerationStoredProcedure findEnumerationProc, DataConnector databaseConnector)
        {
            // Initial Value
            Enumeration enumeration = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load Enumeration
                        enumeration = EnumerationReader.Load(row);
                    }
                }
            }

            // return value
            return(enumeration);
        }