コード例 #1
0
        /// <summary>
        /// This method inserts a 'UserInterface' object.
        /// This method uses the 'UserInterface_Insert' procedure.
        /// </summary>
        /// <returns>The identity value of the new record.</returns>
        /// </summary>
        public int InsertUserInterface(InsertUserInterfaceStoredProcedure insertUserInterfaceProc, DataConnector databaseConnector)
        {
            // Initial Value
            int newIdentity = -1;

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

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

            // locals
            UserInterface userInterface = null;

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

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

                    // verify userInterface exists
                    if (userInterface != null)
                    {
                        // Now create insertUserInterfaceProc from UserInterfaceWriter
                        // The DataWriter converts the 'UserInterface'
                        // to the SqlParameter[] array needed to insert a 'UserInterface'.
                        insertUserInterfaceProc = UserInterfaceWriter.CreateInsertUserInterfaceStoredProcedure(userInterface);
                    }

                    // Verify insertUserInterfaceProc exists
                    if (insertUserInterfaceProc != null)
                    {
                        // Execute Insert Stored Procedure
                        returnObject.IntegerValue = this.DataManager.UserInterfaceManager.InsertUserInterface(insertUserInterfaceProc, dataConnector);
                    }
                }
                else
                {
                    // Raise Error Data Connection Not Available
                    throw new Exception("The database connection is not available.");
                }
            }

            // return value
            return(returnObject);
        }
コード例 #3
0
        /// <summary>
        /// This method creates an instance of an
        /// 'InsertUserInterfaceStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'UserInterface_Insert'.
        /// </summary>
        /// <param name="userInterface"The 'UserInterface' object to insert</param>
        /// <returns>An instance of a 'InsertUserInterfaceStoredProcedure' object.</returns>
        public static InsertUserInterfaceStoredProcedure CreateInsertUserInterfaceStoredProcedure(UserInterface userInterface)
        {
            // Initial Value
            InsertUserInterfaceStoredProcedure insertUserInterfaceStoredProcedure = null;

            // verify userInterface exists
            if (userInterface != null)
            {
                // Instanciate insertUserInterfaceStoredProcedure
                insertUserInterfaceStoredProcedure = new InsertUserInterfaceStoredProcedure();

                // Now create parameters for this procedure
                insertUserInterfaceStoredProcedure.Parameters = CreateInsertParameters(userInterface);
            }

            // return value
            return(insertUserInterfaceStoredProcedure);
        }