Beispiel #1
0
        private void SetDefaults()
        {
            var weekData = AppointmentDao.GetAppointmentsInCurrentWeek()
                           .Select(a => new { a.Title, Start = a.Start.ToLocalTime(), End = a.End.ToLocalTime() });
            var week = new BindingSource();

            week.DataSource = weekData;

            var monthData = AppointmentDao.GetAppointmentsInCurrentMonth()
                            .Select(a => new { a.Title, Start = a.Start.ToLocalTime(), End = a.End.ToLocalTime() });
            var month = new BindingSource();

            month.DataSource = monthData;

            EditAddressComboBox.DataSource = AddressDao.GetAddresses();
            RenameTextBox.Text             = "";
            ApptInCurrentWeek.DataSource   = week;
            ApptInCurrentMonth.DataSource  = month;

            Dictionary <string, int> cities = AddressDao.GetAllCities();

            CitySelectBox.DataSource    = new BindingSource(cities, null);
            CitySelectBox.DisplayMember = "Key";
            CitySelectBox.ValueMember   = "Value";

            Dictionary <string, int> customers = CustomerDao.GetAllCustomers();

            EditCustomerComboBox.DataSource    = new BindingSource(customers, null);
            EditCustomerComboBox.DisplayMember = "Key";
            EditCustomerComboBox.ValueMember   = "Value";

            CustomerAptComboBox.DataSource    = new BindingSource(customers, null);
            CustomerAptComboBox.DisplayMember = "Key";
            CustomerAptComboBox.ValueMember   = "Value";

            CustomerUpdateComboBox.DataSource    = new BindingSource(customers, null);
            CustomerUpdateComboBox.DisplayMember = "Key";
            CustomerUpdateComboBox.ValueMember   = "Value";

            Dictionary <string, int> appts = AppointmentDao.GetAllAppointments();

            if (appts.Count > 0)
            {
                AppointmentsComboBox.DataSource    = new BindingSource(appts, null);
                AppointmentsComboBox.DisplayMember = "Key";
                AppointmentsComboBox.ValueMember   = "Value";
            }
        }
Beispiel #2
0
 public void GetAllCitiesTest()
 {
     System.Collections.Generic.Dictionary <string, int> cities = AddressDao.GetAllCities();
     Assert.IsTrue(cities.Count >= 1);
 }