private void calendar1_ItemClick(object sender, CalendarItemEventArgs e) { //MessageBox.Show(e.Item.Text); using (StateDialog form = new StateDialog(e.Item.Tag.ToString())) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { } } }
private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (e.ColumnIndex == dtGrid.Columns["Select"].Index && e.RowIndex >= 0) { dtGrid.CurrentCell.Value = dtGrid.CurrentCell.FormattedValue.ToString() == "True" ? false : true; dtGrid.RefreshEdit(); 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()); } } try { if (dtGrid.Columns[e.ColumnIndex].Name.Contains("Status")) { using (StateDialog form = new StateDialog(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString())) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { } } } } catch { } if (e.ColumnIndex == dtGrid.Columns["Delete"].Index && e.RowIndex >= 0) { if (MessageBox.Show("YES or No?", "Are you sure you want to delete this Schedule? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { string Query = "DELETE from schedule WHERE id ='" + dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString() + "'"; MySQL.Query(Query); Helper.Log(Helper.UserName, "Deleted schedule " + dtGrid.Rows[e.RowIndex].Cells["customer"].Value.ToString() + " " + DateTime.Now); MessageBox.Show("Information deleted"); LoadData(fromDate, toDate); } } }
private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (Convert.ToInt32(Helper.Level) < 3) { MessageBox.Show("Access Denied !"); return; } } catch (Exception c) { //MessageBox.Show(c.Message.ToString()); Helper.Exceptions(c.Message, "Access level error "); //MessageBox.Show("You have an invalid entry !"); return; } if (e.ColumnIndex == dtGrid.Columns["Delete"].Index && e.RowIndex >= 0) { if (MessageBox.Show("YES or No?", "Are you sure you want to delete this Schedule? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { string Query = "DELETE from schedule WHERE id ='" + dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString() + "'"; MySQL.Query(Query); MessageBox.Show("Information deleted"); Helper.Log(Helper.UserName, "Deleted Schedule for " + userCbx.Text + " " + DateTime.Now); LoadData(fromDate, toDate, UserID); } } if (dtGrid.Columns[e.ColumnIndex].Name.Contains("Status")) { using (StateDialog form = new StateDialog(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString())) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { LoadData(fromDate, toDate, UserID); } } } }