private void ClientDataGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { try { if (isAdmin) { String contractNumber = ClientDataGrid.Rows[e.RowIndex].Cells[3].Value.ToString(); EditByContract(contractNumber); } else { var PassCheckForm = new PassCheck(); if (PassCheckForm.ShowDialog() == DialogResult.OK) { isAdmin = true; ClientDataGrid_CellDoubleClick(sender, e); } } } catch (Exception exc) { System.Windows.MessageBox.Show(exc.Message); } } }
private void DeleteTool_Click(object sender, EventArgs e) { if (isAdmin) { var SearchForm = new SearchForm("delete"); if (SearchForm.ShowDialog() == DialogResult.OK) { switch (SearchForm.SearchOption) { case "Last Name": DeleteByLastName(SearchForm.SearchValue); break; case "Contract number": DeleteByContract(SearchForm.SearchValue); break; default: break; } } } else { var PassCheckForm = new PassCheck(); if (PassCheckForm.ShowDialog() == DialogResult.OK) { isAdmin = true; DeleteTool_Click(sender, e); } } }
private void EditTool_Click(object sender, EventArgs e) { if (isAdmin) { var SearchForm = new SearchForm("edit"); if (SearchForm.ShowDialog() == DialogResult.OK) { EditByContract(SearchForm.SearchValue); } } else { var PassCheckForm = new PassCheck(); if (PassCheckForm.ShowDialog() == DialogResult.OK) { isAdmin = true; EditTool_Click(sender, e); } } }