private void newToolStripMenuItem_Click(object sender, EventArgs e) { using (DeductionDialog form = new DeductionDialog(null, null)) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { viewToolStripMenuItem1_Click(null, null); } } }
private void button6_Click_1(object sender, EventArgs e) { using (DeductionDialog form = new DeductionDialog(noLbl.Text, UserID)) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { LoadDed(noLbl.Text); } } }
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 (DeductionDialog form = new DeductionDialog(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString(), dtGrid.Rows[e.RowIndex].Cells["userID"].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 Deduction? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { string Query = "DELETE from deduction 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 { } }