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