private void button1_Click(object sender, RoutedEventArgs e) { if (choose.Text == "Mobile_Number") { Edit_MobileNumberEmployee ee = new Edit_MobileNumberEmployee(); ee.Show(); this.Hide(); } else if (choose.Text == "Salary") { Edit_DepartmentSalaryBonus z = new Edit_DepartmentSalaryBonus(); z.Show(); this.Hide(); } else if (choose.Text == "Bonus") { for (int i = 0; i < Containers.Employee_list.Count(); i++) { float bonu = 0; if (Containers.Employee_list[i].getId() == Enter_ID_Employee.employeeeid) { int x = Containers.Employee_list[i].Working_year_calc(); float per = x / 5; if (x > 5) { bonu = (per * Containers.Employee_list[i].getSalary()) / 100; } } Containers.Employee_list[i].setbonus(bonu); } if (File.Exists("Employees.xml")) { File.Delete("Employees.xml"); } for (int i = 0; i < Containers.Employee_list.Count; i++) { Containers.write_Employee(Containers.Employee_list[i]); } MessageBox.Show("Changes Done"); } else if (choose.Text == "Department") { Edit_DepartmentSalaryBonus z = new Edit_DepartmentSalaryBonus(); z.Show(); this.Hide(); } else if (choose.Text == "Avaliable") { Edit_Avaliable g = new Edit_Avaliable(); g.Show(); this.Hide(); } else if (choose.Text == "Password") { Edit_EmployeePassword ee = new Edit_EmployeePassword(); ee.Show(); this.Hide(); } }
private void button2_Click_1(object sender, RoutedEventArgs e) { bool valid = false; loginid = login.Text; loginpass = passwordBox.Password; for (int i = 0; i < Containers.Employee_list.Count; i++) { if (Containers.Employee_list[i].getId() == login.Text) { if (Containers.Employee_list[i].GetDepartment() == "Coach") { empid = true; } } } bool x = false, y = false; for (int i = 0; i < Containers.Employee_list.Count; i++) { if (Containers.Employee_list[i].getId() == login.Text && Containers.Employee_list[i].Getpassword() == passwordBox.Password) { if (Containers.Employee_list[i].GetDepartment() == "Accounting") { if (Loginas.bu == "yes") { x = true; break; } } } } for (int i = 0; i < Containers.Employee_list.Count; i++) { if (Containers.Employee_list[i].GetDepartment() == "HR") { if (Containers.Employee_list[i].getId() == login.Text && Containers.Employee_list[i].Getpassword() == passwordBox.Password) { if (Loginas.au == "yes") { y = true; break; } } } } if (x == true || y == true) { MessageBox.Show("Wrong ID or Password"); } else { for (int i = 0; i < Containers.Employee_list.Count; i++) { if (Containers.Employee_list[i].getId() == login.Text && Containers.Employee_list[i].Getpassword() == passwordBox.Password) { Containers.Employee_list[i].setStatus("YES"); if (Containers.Employee_list[i].getMedicalReport() == "NO") { Notification = true; } if (Containers.Employee_list[i].getdepnot() == "YES") { depnoti = true; Containers.Employee_list[i].setdepnot("NO"); } if (Containers.Employee_list[i].getsalarynot() == "YES") { salnoti = true; Containers.Employee_list[i].setsalarynot("NO"); } if (Containers.Employee_list[i].GetDepartment() == "Coach") { break; } MessageBox.Show("Login Successfuly."); if (Containers.Employee_list[i].GetDepartment() == "HR") { if (login.Text == passwordBox.Password) { Edit_EmployeePassword eee = new Edit_EmployeePassword(); eee.Show(); } else { if (Notification == true || depnoti == true || salnoti == true) { adminoptionNotification oo = new adminoptionNotification(); hrid = true; oo.Show(); } else { adminoptions oo = new adminoptions(); hrid = true; oo.Show(); } } this.Close(); } else if (Containers.Employee_list[i].GetDepartment() == "Accounting") { if (login.Text == passwordBox.Password) { Edit_EmployeePassword eee = new Edit_EmployeePassword(); eee.Show(); } else { if (Notification == true || depnoti == true || salnoti == true) { AccountingoptionNotification af = new AccountingoptionNotification(); af.Show(); } else { AccountingOptionForm af = new AccountingOptionForm(); af.Show(); } } this.Close(); } valid = true; break; } } if (File.Exists("Employees.xml")) { File.Delete("Employees.xml"); } for (int i = 0; i < Containers.Employee_list.Count; i++) { Containers.write_Employee(Containers.Employee_list[i]); } if (!valid) { MessageBox.Show("Wrong ID or Password!"); } } }