private void button4_Click(object sender, EventArgs e) { string hrac = hracListBox.SelectedItem.ToString(); string tym = tymyCombobox.SelectedItem.ToString(); DateTime zacatek = odDTPicker.Value; DateTime konec = doDTPicker.Value; TymHrac kontrakt = new TymHrac(); string[] hs = hrac.Split(' '); foreach (Tym t in tymy) { if (t.nazev == tym) { kontrakt.tym = t.kod; } } kontrakt.idHrac = int.Parse(hs[0]); kontrakt.zacatek = zacatek.Date; kontrakt.konec = konec.Date; TymHracTable.Insert(kontrakt); MessageBox.Show("Kontrakt úspěšně vložen.", "Upozornění"); Close(); }
private void button2_Click(object sender, EventArgs e) { TymHrac th = new TymHrac(); th.tym = "CZ01020300"; th.idHrac = 31; th.zacatek = new DateTime(2017, 4, 27).Date; Console.WriteLine(TymHracTable.Insert(th)); }