private void buttonAdd_Click(object sender, EventArgs e) { PersonalSet personalSet = new PersonalSet(); personalSet.PersonalName = textBoxName.Text; personalSet.PersonalPhone = textBoxPhone.Text; personalSet.PersonalEmail = textBoxEmail.Text; Program.dinamoDB.PersonalSet.Add(personalSet); Program.dinamoDB.SaveChanges(); ShowPersonal(); }
private void buttonEdit_Click(object sender, EventArgs e) { if (listViewPersonal.SelectedItems.Count == 1) { PersonalSet personalSet = listViewPersonal.SelectedItems[0].Tag as PersonalSet; personalSet.PersonalName = textBoxName.Text; personalSet.PersonalPhone = textBoxPhone.Text; personalSet.PersonalEmail = textBoxEmail.Text; Program.dinamoDB.SaveChanges(); ShowPersonal(); } }
private void buttonDelete_Click(object sender, EventArgs e) { try { if (listViewPersonal.SelectedItems.Count == 1) { PersonalSet personalSet = listViewPersonal.SelectedItems[0].Tag as PersonalSet; Program.dinamoDB.PersonalSet.Remove(personalSet); Program.dinamoDB.SaveChanges(); ShowPersonal(); } textBoxName.Text = ""; textBoxPhone.Text = ""; textBoxEmail.Text = ""; } catch { MessageBox.Show("невозможно удалить, эта запись используется", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }