private void Termin_Load(object sender, EventArgs e) { List <Veterinar> veterinari = kontroler.vratiSveVeterinare(); List <Sala> sale = kontroler.vratiSveSale(); foreach (Veterinar v in veterinari) { cmbVeterinar.Items.Add(v); } foreach (Sala s in sale) { cmbSala.Items.Add(s); } cmbVeterinar.SelectedIndex = cmbVeterinar.FindStringExact(kontroler.vratiUlogovanogVeterinara().ToString()); if (btnSacuvaj.Text == "Izmeni") { groupBox1.Text = "Izmeni termin"; txtLjubimac.Text = t.Ljubimac.ToString(); cmbVeterinar.SelectedIndex = cmbVeterinar.FindStringExact(t.Veterinar.ToString()); string datumIVreme = t.DatumIvreme.ToString("dd.MM.yyyy. HH:mm"); dateTimePicker1.Value = t.DatumIvreme; cmbSati.SelectedIndex = cmbSati.FindStringExact(datumIVreme.Split(' ')[1].Split(':')[0]); cmbMinuti.SelectedIndex = cmbMinuti.FindStringExact(datumIVreme.Split(' ')[1].Split(':')[1]); cmbSala.SelectedIndex = cmbSala.FindStringExact(t.Sala.ToString()); txtOpis.Text = t.Opis; txtVrsta.Text = t.VrstaTermina; if (t.DatumIvreme < DateTime.Now) { dateTimePicker1.Enabled = false; txtLjubimac.ReadOnly = true; cmbVeterinar.Enabled = false; cmbSati.Enabled = false; cmbMinuti.Enabled = false; cmbSala.Enabled = false; txtVrsta.ReadOnly = true; } else { } } }