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