private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (e.ColumnIndex == dtGrid.Columns["Select"].Index && e.RowIndex >= 0) { if (selectedIDs.Contains(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString())) { selectedIDs.Remove(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString()); } else { selectedIDs.Add(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString()); } } if (e.ColumnIndex == dtGrid.Columns["View"].Index && e.RowIndex >= 0) { using (NewCase form = new NewCase(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString())) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { //LoadData(); } } } if (e.ColumnIndex == dtGrid.Columns["Order Intake"].Index && e.RowIndex >= 0) { using (OrderIntakeForm form = new OrderIntakeForm(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString())) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { //LoadData(); } } } try { if (e.ColumnIndex == dtGrid.Columns["Delete"].Index && e.RowIndex >= 0) { if (MessageBox.Show("YES or No?", "Are you sure you want to delete this Order? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { string Query = "DELETE from orders WHERE id ='" + dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString() + "'"; MySQL.Query(Query); Queries q = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(MySQL.Insert(Query)), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID); MySQL.Insert(q); MessageBox.Show("Information deleted"); LoadData(); } } } catch { } }
private void toolStripButton2_Click(object sender, EventArgs e) { NewCase o = new NewCase(null); o.Show(); }