private void bNewFoul_Click(object sender, EventArgs e) { FormPDD formPDD = new FormPDD(); formPDD.dateTimePicker1.Value = DateTime.Now; formPDD.IdFoul = 0; formPDD.IdTypeFoul = 0; formPDD.txtNumber.Text = ""; formPDD.IdReg = 0; if (formPDD.ShowDialog() == DialogResult.OK) { Foul foul = new Foul(); foul.DtFoul = formPDD.dateTimePicker1.Value; foul.IdTypeFoul = formPDD.IdTypeFoul; foul.IdRegistr = formPDD.IdReg; dbContext.NewFoul(foul); UpdateListFouls(txtNumber.Text); } }
private void listBoxFouls_DoubleClick(object sender, EventArgs e) { VFoul vfoul = (VFoul)listBoxFouls.SelectedItem; FormPDD formPdd = new FormPDD(); formPdd.dateTimePicker1.Value = vfoul.Date; formPdd.IdFoul = vfoul.Id; formPdd.IdReg = vfoul.IdReg; formPdd.IdTypeFoul = vfoul.IdTypeFoul; formPdd.txtNumber.Text = vfoul.Number; if (formPdd.ShowDialog() == DialogResult.OK) { Foul foul = new Foul(); foul.Id = vfoul.Id; foul.DtFoul = formPdd.dateTimePicker1.Value; foul.IdTypeFoul = formPdd.IdTypeFoul; foul.IdRegistr = formPdd.IdReg; dbContext.UpdateFoul(foul); } UpdateListFouls(txtNumber1.Text); }