private void btnSearch_Click(object sender, EventArgs e) { try { frmSystemSearch myS = new frmSystemSearch(); myS.searchType = "students"; DialogResult access = myS.ShowDialog(); if (access == DialogResult.OK) { if (myS.searchedId != "") { this.txtEnId.Focus(); this.txtEnId.Text = myS.searchedId; this.txtTerm.Focus(); } else { MessageBox.Show("No student was selected please double click disired student", "System notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (Exception ex) { MessageBox.Show("No student was selected please double click disired student " + ex.Message); } }
private void metroButton1_Click(object sender, EventArgs e) { try { frmSystemSearch myS = new frmSystemSearch(); myS.searchType = "students"; DialogResult access = myS.ShowDialog(); if (access == DialogResult.OK) { if (myS.searchedId != "") { this.txtEnrolId.Focus(); this.txtEnrolId.Text = myS.searchedId; this.txtTranDetails.Focus(); } else { MessageBox.Show("No student was selected please double click disired student", "System notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Failed to open search form " + ex); } }
private void btnSearch_Click(object sender, EventArgs e) { try { frmSystemSearch mySearch = new frmSystemSearch(); mySearch.searchType = "employees"; DialogResult myD = mySearch.ShowDialog(); if (myD == DialogResult.OK) { this.txtempId.Text = mySearch.searchedId; this.txtempId.Enabled = false; manageEmployees myE = new manageEmployees(); myE.getEmpDetails(mySearch.searchedId); if (myE.dacFound == true) { this.txtEmail.Text = myE.Email; this.txtFname.Text = myE.Fname; this.txtLastName.Text = myE.Sname; this.txtUserName.Text = myE.Sname + myE.Fname; this.txtMobile.Text = myE.Mobile; this.txtMsg.Text = "SchWiz account created"; } else { MessageBox.Show("you cannot add non-employees as users", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show("failed in btnSearch_Click() " + ex.Message); } }