Esempio n. 1
0
        /// <summary>
        /// Retrieve a data table containing the application specified.
        /// </summary>
        /// <param name="appcode">string: Application code.</param>
        /// <returns>iCampaign.TACS.Data.ApplicationsDs.ApplicationsDataTable</returns>
        internal iCampaign.TACS.Data.ApplicationsDs.ApplicationsDataTable GetApplication(string appcode)
        {
            //  Instantiate the database objects
            ApplicationsDs.ApplicationsDataTable dataTable = new ApplicationsDs.ApplicationsDataTable();
            iCampaign.TACS.Data.ApplicationsDsTableAdapters.ApplicationsTableAdapter tableAdapter =
                new iCampaign.TACS.Data.ApplicationsDsTableAdapters.ApplicationsTableAdapter();
            tableAdapter.Connection = new SqlConnection(TacsSession.ConnectionString);

            //  Try and get the data from the TACS.NET database
            try
            {
                tableAdapter.Connection.Open();
                tableAdapter.FillByAppCode(dataTable, appcode);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                tableAdapter.Connection.Close();
            }

            return dataTable;
        }
Esempio n. 2
0
        /// <summary>
        /// Get the request application row from the database.
        /// </summary>
        /// <param name="appcode">string: Application code.</param>
        /// <returns>iCampaign.TACS.Data.ApplicationsDs.ApplicationsRow: object.</returns>
        private Data.ApplicationsDs.ApplicationsRow GetApplicationRow(string appcode)
        {
            //  Initialize ADO.NET objects
            Data.ApplicationsDs.ApplicationsDataTable appTable = new ApplicationsDs.ApplicationsDataTable();
            Data.ApplicationsDsTableAdapters.ApplicationsTableAdapter tableAdapter =
                new iCampaign.TACS.Data.ApplicationsDsTableAdapters.ApplicationsTableAdapter();
            Data.ApplicationsDs.ApplicationsRow appRow = null;
            tableAdapter.Connection = new SqlConnection(TacsSession.ConnectionString);

            //  Fetch the application information
            try
            {
                tableAdapter.Connection.Open();
                tableAdapter.FillByAppCode(appTable, appcode);
                if (appTable.Count != 0)
                    appRow = appTable[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                tableAdapter.Connection.Close();
            }
            return appRow;
        }