Exemplo n.º 1
0
        /// <summary>
        /// This method finds a  'RawImport' object.
        /// This method uses the 'RawImport_Find' procedure.
        /// </summary>
        /// <returns>A 'RawImport' object.</returns>
        /// </summary>
        public RawImport FindRawImport(FindRawImportStoredProcedure findRawImportProc, DataConnector databaseConnector)
        {
            // Initial Value
            RawImport rawImport = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load RawImport
                        rawImport = RawImportReader.Load(row);
                    }
                }
            }

            // return value
            return(rawImport);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method finds a 'RawImport' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'RawImport' to delete.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject FindRawImport(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            RawImport rawImport = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Create Find StoredProcedure
                FindRawImportStoredProcedure findRawImportProc = null;

                // verify the first parameters is a 'RawImport'.
                if (parameters[0].ObjectValue as RawImport != null)
                {
                    // Get RawImportParameter
                    RawImport paramRawImport = (RawImport)parameters[0].ObjectValue;

                    // verify paramRawImport exists
                    if (paramRawImport != null)
                    {
                        // Now create findRawImportProc from RawImportWriter
                        // The DataWriter converts the 'RawImport'
                        // to the SqlParameter[] array needed to find a 'RawImport'.
                        findRawImportProc = RawImportWriter.CreateFindRawImportStoredProcedure(paramRawImport);
                    }

                    // Verify findRawImportProc exists
                    if (findRawImportProc != null)
                    {
                        // Execute Find Stored Procedure
                        rawImport = this.DataManager.RawImportManager.FindRawImport(findRawImportProc, dataConnector);

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

            // return value
            return(returnObject);
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FindRawImportStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'RawImport_Find'.
        /// </summary>
        /// <param name="rawImport">The 'RawImport' to use to
        /// get the primary key parameter.</param>
        /// <returns>An instance of an FetchUserStoredProcedure</returns>
        public static FindRawImportStoredProcedure CreateFindRawImportStoredProcedure(RawImport rawImport)
        {
            // Initial Value
            FindRawImportStoredProcedure findRawImportStoredProcedure = null;

            // verify rawImport exists
            if (rawImport != null)
            {
                // Instanciate findRawImportStoredProcedure
                findRawImportStoredProcedure = new FindRawImportStoredProcedure();

                // Now create parameters for this procedure
                findRawImportStoredProcedure.Parameters = CreatePrimaryKeyParameter(rawImport);
            }

            // return value
            return(findRawImportStoredProcedure);
        }