private void btnSubmit_Click(object sender, EventArgs e) { switch (AddUpdate) { case 1: // add { var obj = new Software() { Software_ID = 1, SoftwareName = txtSoftwareName.Text, SystemName = txtSystemName.Text, Group = txtGroup.Text, Owner = txtOwner.Text, Classification = cmbClass.SelectedItem.ToString(), ResponsibleEngineer = txtResponsibleEngineer.Text, Description = txtSoftwareDescription.Text, DesignAuthority = txtDesignAuthority.Text }; // Add DB Code // break; } case 2: // update { var obj = new Software() { SoftwareName = txtSoftwareName.Text, SystemName = txtSystemName.Text, Group = txtGroup.Text, Owner = txtOwner.Text, Classification = cmbClass.SelectedItem.ToString(), ResponsibleEngineer = txtResponsibleEngineer.Text, Description = txtSoftwareDescription.Text, DesignAuthority = txtDesignAuthority.Text }; break; // Add DB Code // } default: break; } }
public SoftwareForm(Software aSoftware, int aAddUpdate) { InitializeComponent(); mSoftware = aSoftware; AddUpdate = aAddUpdate; }