/// <summary>
        /// This method inserts a 'ProjectReference' object.
        /// This method uses the 'ProjectReference_Insert' procedure.
        /// </summary>
        /// <returns>The identity value of the new record.</returns>
        /// </summary>
        public int InsertProjectReference(InsertProjectReferenceStoredProcedure insertProjectReferenceProc, DataConnector databaseConnector)
        {
            // Initial Value
            int newIdentity = -1;

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

            // return value
            return(newIdentity);
        }
Example #2
0
        /// <summary>
        /// This method inserts a 'ProjectReference' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'ProjectReference' to insert.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject InsertProjectReference(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            ProjectReference projectReference = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Create Insert StoredProcedure
                InsertProjectReferenceStoredProcedure insertProjectReferenceProc = null;

                // verify the first parameters is a(n) 'ProjectReference'.
                if (parameters[0].ObjectValue as ProjectReference != null)
                {
                    // Create ProjectReference Parameter
                    projectReference = (ProjectReference)parameters[0].ObjectValue;

                    // verify projectReference exists
                    if (projectReference != null)
                    {
                        // Now create insertProjectReferenceProc from ProjectReferenceWriter
                        // The DataWriter converts the 'ProjectReference'
                        // to the SqlParameter[] array needed to insert a 'ProjectReference'.
                        insertProjectReferenceProc = ProjectReferenceWriter.CreateInsertProjectReferenceStoredProcedure(projectReference);
                    }

                    // Verify insertProjectReferenceProc exists
                    if (insertProjectReferenceProc != null)
                    {
                        // Execute Insert Stored Procedure
                        returnObject.IntegerValue = this.DataManager.ProjectReferenceManager.InsertProjectReference(insertProjectReferenceProc, dataConnector);
                    }
                }
                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 an
        /// 'InsertProjectReferenceStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'ProjectReference_Insert'.
        /// </summary>
        /// <param name="projectReference"The 'ProjectReference' object to insert</param>
        /// <returns>An instance of a 'InsertProjectReferenceStoredProcedure' object.</returns>
        public static InsertProjectReferenceStoredProcedure CreateInsertProjectReferenceStoredProcedure(ProjectReference projectReference)
        {
            // Initial Value
            InsertProjectReferenceStoredProcedure insertProjectReferenceStoredProcedure = null;

            // verify projectReference exists
            if (projectReference != null)
            {
                // Instanciate insertProjectReferenceStoredProcedure
                insertProjectReferenceStoredProcedure = new InsertProjectReferenceStoredProcedure();

                // Now create parameters for this procedure
                insertProjectReferenceStoredProcedure.Parameters = CreateInsertParameters(projectReference);
            }

            // return value
            return(insertProjectReferenceStoredProcedure);
        }