private void viewEditButton_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count < 1) return; string certNumber = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); Form magCert; if (!canWrite) magCert = new MagCert(certNumber, false, userName); else if (isAdmin) magCert = new MagCert(certNumber, true, userName); else { // check if owner of cert using (OdbcConnection conn = new OdbcConnection(connectionString)) { conn.Open(); string query = "SELECT owner\n" + "FROM ATIDelivery.dbo.MagListLog\n" + "WHERE cert_num = '" + certNumber.Trim() + "';"; OdbcCommand com = new OdbcCommand(query, conn); OdbcDataReader reader = com.ExecuteReader(); reader.Read(); bool isOwner = reader.IsDBNull(0) ? false : reader.GetString(0).Equals(userName); magCert = new MagCert(certNumber, isOwner, userName); } } magCert.ShowDialog(); }
private void newButton_Click(object sender, EventArgs e) { Form magProcessForm = new MagCert(canWrite, userName); magProcessForm.ShowDialog(); }