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!"); } }
public Employee(String password, Person personalInformation) { emp_id = 0; qualification = null; this.personalInformation = personalInformation; designation = null; rank = null; salary = 0; station_id = 0; reg_no = 0; this.password = password; this.address = new EmployeeAddress(); allowed_signin = null; }
public Employee() { emp_id = 0; qualification = null; personalInformation = null; designation = null; rank = null; salary = 0; station_id = 0; reg_no = 0; password = null; address = null; allowed_signin = null; }
public Employee(int emp_id, Person personalInformation, String qualification, String designation, String rank, int salary, String password) { this.emp_id = emp_id; this.qualification = qualification; this.personalInformation = personalInformation; this.designation = designation; this.rank = rank; this.salary = salary; this.station_id = 0; this.reg_no = 0; allowed_signin = null; this.password = password; this.address = new EmployeeAddress(); }
public Employee(int emp_id, Person personalInformation, String qualification, String designation, String rank, int salary, int station_id, int reg_no, String password, EmployeeAddress address, DateTime dateOfHire) { this.emp_id = emp_id; this.qualification = qualification; this.personalInformation = personalInformation; this.designation = designation; this.rank = rank; this.dateOfHire = dateOfHire; this.salary = salary; this.station_id = station_id; this.reg_no = reg_no; allowed_signin = null; this.address = address; this.password = password; }
private void btnSubmit_Click(object sender, EventArgs e) { String gender = null; if (rdoMale.Checked && !rdoFemale.Checked) { gender = "male"; } else if (!rdoMale.Checked && rdoFemale.Checked) { gender = "female"; } else if (rdoMale.Checked && rdoFemale.Checked) { MessageBox.Show("Error Invalid Selection: Select only one gender!"); return; } 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); String[] phoneNo = { txtPhoneNo1.Text, txtPhoneNo2.Text, txtPhoneNo3.Text }; String[] cellNo = { txtCellNo1.Text, txtCellNo2.Text, txtCellNo3.Text }; person.setPhoneNo(phoneNo); person.setCellNo(cellNo); 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); Database db = new Database(); if (db.insertEmployee(emp)) { MessageBox.Show("Employee Successfully Registered! Wait for approval"); this.Hide(); frmMainPanel mainPanel = new frmMainPanel(); mainPanel.Show(); } else { MessageBox.Show("Unable to register employee!"); } }
public void setAddress(EmployeeAddress address) { this.address = address; }