Ejemplo n.º 1
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     if (Loginas.bu == "yes")
     {
         if (employeelogin.Notification == true || employeelogin.depnoti == true || employeelogin.salnoti == true)
         {
             ggg = true;
             adminoptionNotification s = new adminoptionNotification();
             s.Show();
             this.Close();
         }
         else
         {
             ggg = true;
             adminoptions s = new adminoptions();
             s.Show();
             this.Close();
         }
     }
     else
     {
         if (employeelogin.Notification == true || employeelogin.depnoti == true || employeelogin.salnoti == true)
         {
             AccountingoptionNotification aa = new AccountingoptionNotification();
             aa.Show();
             this.Close();
         }
         else
         {
             AccountingOptionForm aa = new AccountingOptionForm();
             aa.Show();
             this.Close();
         }
     }
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            bool found = false;

            if (textBox.Text == "" || password.Text == "")
            {
                MessageBox.Show("Please fill the required information !");
            }
            else if (password.Text.Length < 6)
            {
                MessageBox.Show("Password Is Too Short !");
            }
            else if (textBox.Text == password.Text)
            {
                MessageBox.Show("Enter Diffrent Password ");
            }
            else
            {
                for (int i = 0; i < Containers.Employee_list.Count; i++)
                {
                    if (Containers.Employee_list[i].getId().ToString() == employeelogin.loginid)
                    {
                        if (Containers.Employee_list[i].Getpassword() == textBox.Text)
                        {
                            found = true;
                            Containers.Employee_list[i].setpassword(password.Text);
                        }
                    }
                }

                if (found == false)
                {
                    MessageBox.Show("Wrong Password ");
                }
                else
                {
                    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");
                    if (Loginas.bu == "yes")
                    {
                        if (employeelogin.Notification == true || employeelogin.depnoti == true || employeelogin.salnoti == true)
                        {
                            ggg = true;
                            adminoptionNotification s = new adminoptionNotification();
                            s.Show();
                            this.Close();
                        }
                        else
                        {
                            ggg = true;
                            adminoptions s = new adminoptions();
                            s.Show();
                            this.Close();
                        }
                    }
                    else
                    {
                        if (employeelogin.Notification == true || employeelogin.depnoti == true || employeelogin.salnoti == true)
                        {
                            AccountingoptionNotification aa = new AccountingoptionNotification();
                            aa.Show();
                            this.Close();
                        }
                        else
                        {
                            AccountingOptionForm aa = new AccountingOptionForm();
                            aa.Show();
                            this.Close();
                        }
                    }
                }
            }
        }
        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!");
                }
            }
        }