public void loadProfile() { try { txtFirstName.Text = emp.getPersonalInformation().getFirstName(); txtMiddleName.Text = emp.getPersonalInformation().getMiddleName(); txtLastName.Text = emp.getPersonalInformation().getLastName(); txtCNIC.Text = emp.getPersonalInformation().getCNIC(); txtQualification.Text = emp.getQualification(); txtRank.Text = emp.getRank(); txtSalary.Text = emp.getSalary().ToString(); txtEmail.Text = emp.getPersonalInformation().getEmail(); txtDesignation.Text = emp.getDesignation(); txtPassword.Text = emp.getPassword(); if (emp.getPersonalInformation().getGender().Equals("male")) { rdoMale.Checked = true; } else { rdoFemale.Checked = true; } dateTimePickerDob.Text = emp.getPersonalInformation().getDateOfBirth().Date.ToString(); dateTimePickerDoh.Text = emp.getDateOfHire().Date.ToString(); txtCountry.Text = emp.getAddress().getCountry(); txtCity.Text = emp.getAddress().getCity(); txtProvince.Text = emp.getAddress().getProvince(); txtStreet.Text = emp.getAddress().getStreet(); txtHouseNo.Text = emp.getAddress().getHouseNo(); txtZipCode.Text = emp.getAddress().getZipCode().ToString(); Database db = new Database(); txtID.Text = "" + emp.getEmp_id(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSearch_Click(object sender, EventArgs e) { Database db = new Database(); Employee emp = db.searchEmployee(txtSearchEmployeeID.Text); try { txtFirstName.Text = emp.getPersonalInformation().getFirstName(); txtMiddleName.Text = emp.getPersonalInformation().getMiddleName(); txtLastName.Text = emp.getPersonalInformation().getLastName(); txtCNIC.Text = emp.getPersonalInformation().getCNIC(); txtQualification.Text = emp.getQualification(); txtRank.Text = emp.getRank(); txtSalary.Text = emp.getSalary().ToString(); txtEmail.Text = emp.getPersonalInformation().getEmail(); txtDesignation.Text = emp.getDesignation(); txtPassword.Text = emp.getPassword(); txtAllowedSignin.Text = emp.getAllowedSignIn(); if (emp.getPersonalInformation().getGender().Equals("male")) { rdoMale.Checked = true; } else { rdoFemale.Checked = true; } dateTimePickerDob.Text = emp.getPersonalInformation().getDateOfBirth().Date.ToString(); dateTimePickerDoh.Text = emp.getDateOfHire().Date.ToString(); txtCountry.Text = emp.getAddress().getCountry(); txtCity.Text = emp.getAddress().getCity(); txtProvince.Text = emp.getAddress().getProvince(); txtStreet.Text = emp.getAddress().getStreet(); txtHouseNo.Text = emp.getAddress().getHouseNo(); txtZipCode.Text = emp.getAddress().getZipCode().ToString(); int i = 0, j = 0; while (i < emp.getPersonalInformation().getPhoneNo().Length || j < emp.getPersonalInformation().getCellNo().Length) { if (i < emp.getPersonalInformation().getPhoneNo().Length) { if (i == 0) { txtPhoneNo1.Text = emp.getPersonalInformation().getPhoneNo()[i]; } else if (i == 1) { txtPhoneNo2.Text = emp.getPersonalInformation().getPhoneNo()[i]; } else if (i == 2) { txtPhoneNo3.Text = emp.getPersonalInformation().getPhoneNo()[i]; } i++; } if (j < emp.getPersonalInformation().getCellNo().Length) { if (j == 0) { txtCellNo1.Text = emp.getPersonalInformation().getCellNo()[j]; } else if (j == 1) { txtCellNo2.Text = emp.getPersonalInformation().getCellNo()[j]; } else if (j == 2) { txtCellNo3.Text = emp.getPersonalInformation().getCellNo()[j]; } j++; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }