private void FormPDD_Load(object sender, EventArgs e) { List <FoulType> ftList = dbContext.GetFoulsType(""); foreach (var item in ftList) { cbTypeFoul.Items.Add(item); } if (IdTypeFoul == 0) { cbTypeFoul.SelectedIndex = -1; } else { for (var i = 0; i < cbTypeFoul.Items.Count; i++) { FoulType item = (FoulType)cbTypeFoul.Items[i]; if (IdTypeFoul == item.Id) { cbTypeFoul.SelectedIndex = i; break; } } } List <VRegistration> vreg = dbContext.GetVRegistrations(txtNumber.Text); if (vreg.Count == 1) { lblRegistration.Text = $"ТС: {vreg[0].Carmodel} [{vreg[0].Caryear}] владелец:{vreg[0].Owner}"; IdReg = vreg[0].Id; } }
private void cbTypeFoul_SelectedIndexChanged(object sender, EventArgs e) { if (cbTypeFoul.SelectedIndex >= 0) { FoulType foul = (FoulType)cbTypeFoul.SelectedItem; IdTypeFoul = foul.Id; } else { IdTypeFoul = 0; } CheckValid(); }
private void listBoxFT_DoubleClick(object sender, EventArgs e) { FoulType foulType = (FoulType)listBoxFT.SelectedItem; FormFT formFT = new FormFT(); formFT.IdFT = foulType.Id; formFT.txtFT.Text = foulType.Type; if (formFT.ShowDialog() == DialogResult.OK) { foulType.Type = formFT.txtFT.Text; dbContext.UpdateFoulType(foulType); listBoxFT.Items[listBoxFT.SelectedIndex] = foulType; } UpdateListFT(txtFindFT.Text); }