/// <summary>
        /// Returns a list of all companies sorted by name
        /// </summary>
        /// <returns></returns>
        internal static List <company> GetSortedList()
        {
            List <company> toReturn       = new List <company>();
            company        workingCompany = new company();

            DataTable allData = workingCompany.GetAllData("name");

            foreach (DataRow aRow in allData.Rows)
            {
                workingCompany = new company();
                workingCompany.Load(aRow);

                toReturn.Add(workingCompany);
            }

            return(toReturn);
        }
Example #2
0
        private void InitializeInsuranceDropdown()
        {
            clbInsuranceCompanies.Items.Add("All");

            company c = new company();

            foreach (DataRow aRow in c.GetAllData("name").Rows)
            {
                c = new company();
                c.Load(aRow);

                clbInsuranceCompanies.Items.Add(c);
            }

            DataTable matches = c.Search("SELECT * FROM question_insurance_companies WHERE question_id = " + _formQuestion.id);

            if (matches.Rows.Count > 0)
            {
                foreach (DataRow aMatch in matches.Rows)
                {
                    for (int i = 1; i < clbInsuranceCompanies.Items.Count; i++)
                    {
                        if (((company)clbInsuranceCompanies.Items[i]).id == (int)aMatch["insurance_id"])
                        {
                            clbInsuranceCompanies.SetItemChecked(i, true);

                            break;
                        }
                    }
                }
            }
            else
            {
                clbInsuranceCompanies.SetItemChecked(0, true);
            }
        }