private void InitCourse(Kurz course) { COURSE_NAME.Text = course.Nazev; COURSE_DESC.Text = "Description: " + course.Popis; COURSE_CAPACITY.Text = "Capacity: " + course.Kapacita.ToString(); COURSE_SPECIALIZATION.Text = "Specialization: " + OborTable.SelectOne(course.IdObor).Nazev; AVG_MARK.Text = "Average mark: " + PisemkaTable.GetAvgMark(course.IdKurz).ToString(); ENDED.Text = "Ended: " + course.Ukoncen.ToString(); Collection <Pisemka> upcomingTests = PisemkaTable.SelectUpcomingTestsByCourse(course.IdKurz); Collection <Pisemka> pastTests = PisemkaTable.SelectPastTestsByCourse(course.IdKurz); UPCOMING_TESTS_LISTVIEW.Items.Clear(); PAST_TESTS_LISTVIEW.Items.Clear(); foreach (var t in pastTests) { ListViewItem i = new ListViewItem(t.IdPisemka.ToString()); i.SubItems.Add(t.DatumPisemky.ToShortDateString()); i.SubItems.Add(t.Znamka.ToString()); PAST_TESTS_LISTVIEW.Items.Add(i); } foreach (var t in upcomingTests) { ListViewItem i = new ListViewItem(t.IdPisemka.ToString()); i.SubItems.Add(t.DatumPisemky.ToShortDateString()); UPCOMING_TESTS_LISTVIEW.Items.Add(i); } }
private void InitCourse(ZapsanyKurz course) { Collection <Pisemka> upcomingTests = PisemkaTable.SelectUpcomingTests(course); Collection <Pisemka> pastTests = PisemkaTable.SelectPastTests(course); COURSE_NAME.Text = course.Kurz.Nazev; COURSE_DESC.Text = course.Kurz.Popis; UPCOMING_TESTS_LISTVIEW.Items.Clear(); PAST_TESTS_LISTVIEW.Items.Clear(); foreach (var t in pastTests) { ListViewItem i = new ListViewItem(t.IdPisemka.ToString()); i.SubItems.Add(t.DatumPisemky.ToShortDateString()); i.SubItems.Add(t.Znamka.ToString()); PAST_TESTS_LISTVIEW.Items.Add(i); } foreach (var t in upcomingTests) { ListViewItem i = new ListViewItem(t.IdPisemka.ToString()); i.SubItems.Add(t.DatumPisemky.ToShortDateString()); UPCOMING_TESTS_LISTVIEW.Items.Add(i); } InitStatus(course); InitMaterials(course); }
private void CREATE_TEST_Click(object sender, EventArgs e) { Pisemka p = new Pisemka(); p.ZapsanyKurz = new ZapsanyKurz(); p.ZapsanyKurz.IdKurz = this.idSelectedCourse; p.DatumPisemky = TEST_DP.Value; if (p.DatumPisemky > DateTime.Now) { PisemkaTable.Insert(p); } }