private void btnToimiAdd_Click(object sender, EventArgs e) { try { Office o = new Office(tbToimiName.Text, tbToimiZip.Text, tbToimiCity.Text, tbToimiStreetAdress.Text, tbToimiEmail.Text, tbToimiPhone.Text); OfficeUtils.AddOffice(o); } catch (Exception ex) { ErrorUtils.AddErrorMessage(ex.Message); } }
private void refreshCmbOffice() { try { List <Office> offices = OfficeUtils.GetOffices(); List <string> names = new List <string>(); foreach (Office o in offices) { names.Add(o.Name); } cmbOffice.DataSource = names; } catch (Exception ex) { ErrorUtils.AddErrorMessage(ex.Message); //placeholder List <string> names = new List <string>(); names.Add("Kuopio"); names.Add("Joensuu"); names.Add("Varkaus"); cmbOffice.DataSource = names; } }