private void OkBut_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Изменить запись?", "Редактирование", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.OK) { if (NM.Text != "" && PAG.Text != "" && BO.Text != "" && OPI.Text != "" && JA.Text != "") { foreach (DataGridViewRow row in Table.SelectedRows) { Bibl.edit(List_Text_Box, row); } Table.Refresh(); Bibl.data_update(this.Table, this.Objects); MessageBox.Show("Изменения внесены!"); } else { MessageBox.Show("Некорректный ввод! Поля пусты.", "Редактирование", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } }
private void Form1_Load(object sender, EventArgs e) { // TODO: данная строка кода позволяет загрузить данные в таблицу "kursDataSet.Bibl". При необходимости она может быть перемещена или удалена. this.biblTableAdapter2.Fill(this.kursDataSet.Bibl); // TODO: данная строка кода позволяет загрузить данные в таблицу "microsoft_Office_Access_2007_База_данныхDataSet1.Bibl". При необходимости она может быть перемещена или удалена. Bibl.data_recover(this.Table, this.Objects); Bibl.data_update(this.Table, this.Objects); }
private void biblBindingNavigatorSaveItem_Click(object sender, EventArgs e) { this.Validate(); this.biblBindingSource.EndEdit(); Bibl.data_recover(this.Table, this.Objects); Bibl.data_update(this.Table, this.Objects); }
public static void position_delete(DataGridView a, List <Information> l) { Information buf = new Information(); foreach (DataGridViewRow row in a.SelectedRows) { a.Rows.Remove(row); } Bibl.data_update(a, l); }
private void SaveBut_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Сохранить изменения?", "сохранение", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.OK) { this.Validate(); this.biblBindingSource.EndEdit(); biblTableAdapter2.Update(this.kursDataSet.Bibl); kursDataSet.Tables[0].AcceptChanges(); Bibl.data_update(this.Table, this.Objects); } }
private void AddBut_Click(object sender, EventArgs e) { if (NM.Text != "" && BO.Text != "" && OPI.Text != "" && JA.Text != "" && PAG.Text != "") { DialogResult dr = MessageBox.Show("Добавить запись?", "Добавление", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.OK) { bool flag = false; for (int i = 0; i < Objects.Count; i++) { if (NM.Text == Objects[i].Name && BO.Text == Objects[i].bookname && JA.Text == Objects[i].Janr && OPI.Text == Objects[i].opis || CO.Text == Objects[i].index.ToString()) { flag = true; } } if (!flag) { this.Validate(); this.biblBindingSource.EndEdit(); DataRow nRow = kursDataSet.Tables[0].NewRow(); nRow["Код"] = CO.Text.ToString(); nRow["Имя"] = NM.Text.ToString(); nRow["Книга"] = BO.Text.ToString(); nRow["Жанр"] = JA.Text.ToString(); nRow["Страницы"] = PAG.Text.ToString(); nRow["Описание"] = OPI.Text.ToString(); kursDataSet.Tables[0].Rows.Add(nRow); biblTableAdapter2.Update(kursDataSet.Bibl); kursDataSet.Tables[0].AcceptChanges(); Table.Refresh(); Bibl.data_update(this.Table, this.Objects); NM.Clear(); BO.Clear(); JA.Clear(); PAG.Clear(); OPI.Clear(); CO.Clear(); } if (flag) { DialogResult er = MessageBox.Show("Такая запись уже существует!", "Добавление", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } } } else { DialogResult dr = MessageBox.Show("Некорректный ввод! Поля пусты.", "Добавление", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } }