private void buttonAdd_Click(object sender, EventArgs e) { ASYTP asytpSet = new ASYTP(); asytpSet.Name_ASYTP = textBoxASYTP.Text; Program.HaloPolymer.ASYTP.Add(asytpSet); Program.HaloPolymer.SaveChanges(); ShowASYTP(); }
private void buttonEdit_Click(object sender, EventArgs e) { if (listViewASYTP.SelectedItems.Count == 1) { ASYTP asytpSet = listViewASYTP.SelectedItems[0].Tag as ASYTP; asytpSet.Name_ASYTP = textBoxASYTP.Text; Program.HaloPolymer.SaveChanges(); ShowASYTP(); } }
private void listViewASYTP_SelectedIndexChanged(object sender, EventArgs e) { if (listViewASYTP.SelectedItems.Count == 1) { ASYTP asytpSet = listViewASYTP.SelectedItems[0].Tag as ASYTP; textBoxASYTP.Text = asytpSet.Name_ASYTP; } else { textBoxASYTP.Text = ""; } }
private void buttonDel_Click(object sender, EventArgs e) { try { if (listViewASYTP.SelectedItems.Count == 1) { ASYTP asytpSet = listViewASYTP.SelectedItems[0].Tag as ASYTP; Program.HaloPolymer.ASYTP.Remove(asytpSet); Program.HaloPolymer.SaveChanges(); ShowASYTP(); } textBoxASYTP.Text = ""; } catch { MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }