private void btnAddSoftw_Click(object sender, EventArgs e) { Software aSoftware = new Software(); Form aNewSoftware = new SoftwareForm(aSoftware, _userInfo, 1, this); aNewSoftware.Show(); }
private void btnEditSoftw_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0 && cmbDataViews.SelectedIndex != 1) { int column = 0; switch (cmbDataViews.SelectedIndex) { case 0: column = 8; break; case 2: column = 7; break; default: break; } var aSoftware = new Software() { SoftwareName = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(), Classification = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(), DesignAuthority = dataGridView1.SelectedRows[0].Cells[3].Value.ToString(), Description = dataGridView1.SelectedRows[0].Cells[2].Value.ToString(), ResponsibleEngineer = dataGridView1.SelectedRows[0].Cells[4].Value.ToString(), SystemName = dataGridView1.SelectedRows[0].Cells[5].Value.ToString(), Owner = dataGridView1.SelectedRows[0].Cells[6].Value.ToString(), Group = cmbDataViews.SelectedIndex == 2 ? ddlGroups.SelectedText : dataGridView1.SelectedRows[0].Cells[7].Value.ToString(), Software_ID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[column].Value.ToString()) }; Form aNewSoftware = new SoftwareForm(aSoftware, _userInfo, 2, this); aNewSoftware.Show(); } else { MessageBox.Show("No Software Selected or Software View is selected", "Error", MessageBoxButtons.OK); } }