private void dg_orders_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dg_orders.CurrentCell.ColumnIndex == 10) { metroProgressSpinner1.Visible = true; DialogResult dialogResult = MyMessageBox.Show(Owner, "Вы точно хотите удалить заказ №" + dg_orders.CurrentRow.Cells[0].Value + " из базы?", "Подтверждение удаления", MessageBoxButtons.YesNo, MessageBoxIcon.Question, 150, 400); metroProgressSpinner1.Visible = false; if (dialogResult == DialogResult.Yes) { Connect.Open(); MySqlCommand del_order = new MySqlCommand("delete from `orders` where id=" + dg_orders.CurrentRow.Cells[0].Value, Connect); del_order.ExecuteNonQuery(); Connect.Close(); gen.orders(dg_orders); metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Заказ удален из базы", "Сообщение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Information, 150, 400); metroProgressSpinner1.Visible = false; } } else if (dg_orders.CurrentCell.ColumnIndex == 9) { Update_order f = new Update_order(this, Convert.ToInt32(dg_orders.CurrentRow.Cells[0].Value)); f.ShowDialog(); } } catch (Exception ex) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); metroProgressSpinner1.Visible = false; } }
private void dg_orders_CellClick(object sender, DataGridViewCellEventArgs e) { if (dg_orders.CurrentCell.ColumnIndex == 8) { Update_order f = new Update_order(this, user, Convert.ToInt32(dg_orders.CurrentRow.Cells[0].Value)); f.ShowDialog(); } }