Пример #1
0
        /// <summary>
        /// Gets all of the available agencies in the database.
        /// </summary>
        /// <param name="dataFactory">The data to use for testing.</param>
        /// <returns>AgencyData objects containing information about the agencies.</returns>
        public List <AgencyData> GetAgencies(DataFactory dataFactory)
        {
            List <AgencyData> result = new List <AgencyData>();

            DataFactory df = new DataFactory();

            if (dataFactory != null)
            {
                df = dataFactory;
            }

            agency = df.GetNewAgency();

            using (DataTable table = agency.GetAgencies())
            {
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        result.Add(new AgencyData(Convert.ToInt32(row["agency_id"]), row["agency_name"].ToString()));
                    }
                }
            }

            return(result);
        }