private void btnSaveChanges_Click(object sender, EventArgs e) { String gender = null; if (rdoMale.Checked && !rdoFemale.Checked) { gender = "male"; } else if (!rdoMale.Checked && rdoFemale.Checked) { gender = "female"; } else { MessageBox.Show("Please Select a gender!"); return; } Person person = new Person(); EmployeeAddress address = new EmployeeAddress(); person.setFirstName(txtFirstName.Text); person.setMiddleName(txtMiddleName.Text); person.setLastName(txtLastName.Text); person.setCNIC(txtCNIC.Text); person.setGender(gender); person.setEmail(txtEmail.Text); person.setDateOfBirth(dateTimePickerDob.Value); address.setCity(txtCity.Text); address.setCountry(txtCountry.Text); address.setHouseNo(txtHouseNo.Text); address.setStreet(txtStreet.Text); address.setZipCode(int.Parse(txtZipCode.Text)); address.setProvince(txtProvince.Text); Employee emp = new Employee(); emp.setPersonalInformation(person); emp.setAddress(address); emp.setDesignation(txtDesignation.Text); emp.setRank(txtRank.Text); emp.setQualification(txtQualification.Text); emp.setPassword(txtPassword.Text); emp.setSalary(int.Parse(txtSalary.Text)); emp.setDateOfHire(dateTimePickerDoh.Value); emp.setEmp_id(int.Parse(txtID.Text)); Database db = new Database(); if (db.editProfile(emp)) { MessageBox.Show("Employee Successfully Registered!"); } else { MessageBox.Show("Unable to register employee!"); } }