private void Add_button_Click(object sender, EventArgs e) { Update_button.Hide(); Delete_button.Hide(); Add_button.Hide(); Update_Form UF = Configurate.OptimalView_Form("Add", Update_DGV, RowToEdit, UpdateTable_CB.Text); UF.ShowDialog(); Presenter.GetDGV(Update_DGV, UpdateTable_CB.Text, (int)OperationOption.UpdateRoutes); }
private void Delete_button_Click(object sender, EventArgs e) { DialogResult DR = new DialogResult(); DR = MessageBox.Show("Строка будет удалена. Продолжить?", "Внимание!", MessageBoxButtons.OKCancel); if (DR == DialogResult.OK) { Presenter.DeleteRow(UpdateTable_CB.Text, Convert.ToInt32(Update_DGV.Rows[RowToEdit].Cells[0].Value)); Presenter.GetDGV(Update_DGV, UpdateTable_CB.Text, (int)OperationOption.UpdateRoutes); Add_button.Hide(); Update_button.Hide(); Delete_button.Hide(); } }
private void UpdateTable_CB_SelectedIndexChanged(object sender, EventArgs e) { Add_button.Hide(); Update_button.Hide(); Delete_button.Hide(); if (UpdateTable_CB.SelectedIndex == (int)TableNames.NotSelected) { Update_DGV.Hide(); } else { Presenter.GetDGV(Update_DGV, UpdateTable_CB.Text, (int)OperationOption.UpdateRoutes); Update_DGV.Show(); } }
private void Update_DGV_CellClick(object sender, DataGridViewCellEventArgs e) { int row = e.RowIndex; if (row >= 0) { RowToEdit = row; Update_button.Show(); Add_button.Show(); Delete_button.Show(); } else { RowToEdit = new int(); Add_button.Hide(); Update_button.Hide(); Delete_button.Hide(); } }