private void newButton_Click(object sender, EventArgs e) { Form d2060Form = new D2060RForm(canWrite, userName); d2060Form.ShowDialog(); }
private void viewEditButton_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count < 1) return; string idNumber = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); Form D260Form; if (!canWrite) D260Form = new D2060RForm(idNumber, false, userName); else if (isAdmin) D260Form = new D2060RForm(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.MagD2060RProcessControlLog\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); D260Form = new D2060RForm(idNumber, isOwner, userName); } } D260Form.ShowDialog(); }