Example #1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (textBox.Text == "")
            {
                MessageBox.Show("Please fill the required information !");
            }
            else
            {
                for (int i = 0; i < Containers.Employee_list.Count; i++)
                {
                    if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                    {
                        Containers.Employee_list[i].setbonus(float.Parse(textBox.Text.ToString()));
                    }
                }
                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");
            }
        }
Example #2
0
        private void delete_Click(object sender, RoutedEventArgs e)
        {
            employeeeid = id.Text;

            bool find = false;

            for (int i = 0; i < Containers.Employee_list.Count; i++)
            {
                if (Containers.Employee_list[i].getId() == id.Text)
                {
                    Containers.Employee_list.Remove(Containers.Employee_list[i]);

                    find = true;
                }
            }
            if (find == false)
            {
                MessageBox.Show("Wrong ID");
            }
            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("Employee Successfuly Deleted");
            }
        }
Example #3
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            string med = "NO";

            if (yes.IsChecked == true)
            {
                med = "YES";
            }
            if ((yes.IsChecked == true) && (no.IsChecked == true))
            {
                MessageBox.Show("Please fill the required information !");
            }

            else
            {
                for (int i = 0; i < Containers.Employee_list.Count; i++)
                {
                    if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                    {
                        Containers.Employee_list[i].setMedicalReport(med);
                    }
                }
                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");
                this.Hide();
            }
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            string avail = "";

            if (yes.IsChecked == true)
            {
                avail = "Yes";
            }
            else
            {
                avail = "No";
            }
            if ((yes.IsChecked == false) && (no.IsChecked == false))
            {
                MessageBox.Show("Please fill the required information !");
            }

            else
            {
                for (int i = 0; i < Containers.Employee_list.Count; i++)
                {
                    if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                    {
                        Containers.Employee_list[i].setStatus(avail);
                    }
                }
                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 (Enter_ID_Employee.coaach == true)
                {
                    if (File.Exists("Coaches.xml"))
                    {
                        File.Delete("Coaches.xml");
                    }

                    for (int i = 0; i < Containers.Coach_list.Count; i++)
                    {
                        Containers.write_coach(Containers.Coach_list[i]);
                    }
                }
                MessageBox.Show("Changes Done");
            }
        }
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            if (comboBox.Text == "" || comboBox1.Text == "")
            {
                MessageBox.Show("Please fill the required information !");
            }
            else
            {
                for (int i = 0; i < Containers.Employee_list.Count(); i++)
                {
                    if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                    {
                        if (Containers.Employee_list[i].GetDepartment() == comboBox.Text)
                        {
                            dep = true;
                            break;
                        }
                    }
                }


                if (dep == false)
                {
                    MessageBox.Show("Wrong Old Department");
                }

                else
                {
                    for (int i = 0; i < Containers.Employee_list.Count; i++)
                    {
                        if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                        {
                            Containers.Employee_list[i].setDepartment(comboBox1.Text);
                            Containers.Employee_list[i].setdepnot("YES");
                            dep = true;
                        }
                    }
                    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");
                }
            }
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (salary.Text == "")
            {
                MessageBox.Show("Please fill the required information !");
            }
            else
            {
                for (int i = 0; i < Containers.Employee_list.Count; i++)
                {
                    if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                    {
                        Containers.Employee_list[i].setSalary(float.Parse(salary.Text));
                        Containers.Employee_list[i].setsalarynot("YES");
                    }
                }

                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 (Enter_ID_Employee.coaach == true)
                {
                    for (int i = 0; i < Containers.Coach_list.Count; i++)
                    {
                        if (Containers.Coach_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                        {
                            Containers.Coach_list[i].setSalary(float.Parse(salary.Text));
                        }
                    }
                    if (File.Exists("Coaches.xml"))
                    {
                        File.Delete("Coaches.xml");
                    }

                    for (int i = 0; i < Containers.Coach_list.Count; i++)
                    {
                        Containers.write_coach(Containers.Coach_list[i]);
                    }
                }
                MessageBox.Show("Changes Done");
            }
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            bool mobilee = false;

            for (int i = 0; i < Containers.Employee_list.Count(); i++)
            {
                if (Containers.Employee_list[i].getmobile() == textBox1.Text)
                {
                    mobilee = true;
                }
            }

            if (textBox1.Text == "" || mobile.Text == "")
            {
                MessageBox.Show("Please fill the required information !");
            }
            else if (mobilee == true)
            {
                MessageBox.Show("Mobile number is already registered !");
            }
            else if (textBox1.Text == mobile.Text)
            {
                MessageBox.Show("Please enter a diffrent Mobile Number!");
                textBox1.Clear();
                mobile.Clear();
            }
            else
            {
                for (int i = 0; i < Containers.Employee_list.Count; i++)
                {
                    if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                    {
                        Containers.Employee_list[i].setmobile(mobile.Text);
                    }
                }
                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");
                this.Hide();
            }
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < Containers.Employee_list.Count; i++)
            {
                if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                {
                    Containers.Employee_list[i].setSalary(float.Parse(salary.Text));
                }
            }
            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");
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            bool found = false;

            if (textBox.Text == "" || password.Text == "")
            {
                MessageBox.Show("Please fill the required information !");
            }
            for (int i = 0; i < Containers.Employee_list.Count; i++)
            {
                if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                {
                    if (Containers.Employee_list[i].Getpassword() == password.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");
                this.Hide();
            }
        }
Example #10
0
        private void delete_Click(object sender, RoutedEventArgs e)
        {
            if (id.Text == "")
            {
                MessageBox.Show("Please Enter ID");
            }
            else
            {
                employeeeid = id.Text;
                bool noo = false;
                for (int i = 0; i < Containers.Employee_list.Count; i++)
                {
                    if (Containers.Employee_list[i].getId() == id.Text)
                    {
                        if (Containers.Employee_list[i].GetDepartment() == "HR" && employeelogin.hrid == true || (Containers.Employee_list[i].GetDepartment() == "HR" && Edit_EmployeePassword.ggg == true))
                        {
                            MessageBox.Show("You are not allowed to edit or delete HR Employee");
                            noo = true;
                            break;
                        }
                        else if (Containers.Employee_list[i].GetDepartment() == "Coach")
                        {
                            coaach = true;
                        }
                    }
                }
                if (noo == false)
                {
                    bool find = false;
                    for (int i = 0; i < Containers.Employee_list.Count; i++)
                    {
                        if (Containers.Employee_list[i].getId() == id.Text)
                        {
                            Containers.Employee_list.Remove(Containers.Employee_list[i]);
                            find = true;
                        }
                    }
                    if (find == false)
                    {
                        MessageBox.Show("Wrong ID");
                    }
                    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("Employee Successfuly Deleted");
                        if (coaach == true)
                        {
                            for (int i = 0; i < Containers.Coach_list.Count; i++)
                            {
                                if (Containers.Coach_list[i].getId() == id.Text)
                                {
                                    Containers.Coach_list.Remove(Containers.Coach_list[i]);
                                }
                            }
                            if (File.Exists("Coaches.xml"))
                            {
                                File.Delete("Coaches.xml");
                            }

                            for (int i = 0; i < Containers.Coach_list.Count; i++)
                            {
                                Containers.write_coach(Containers.Coach_list[i]);
                            }
                            MessageBox.Show("Coach Successfuly Deleted");
                        }
                    }
                }
            }
        }
        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();
            }
        }
Example #12
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!");
                }
            }
        }
Example #14
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (textBox1.Text == "" || mobile.Text == "")
            {
                MessageBox.Show("Please fill the required information !");
            }
            else if (mobile.Text.Length != 11)
            {
                MessageBox.Show("Please Enter Valid Mobile Number!");
            }
            else
            {
                bool mobilee = false;
                for (int i = 0; i < Containers.Employee_list.Count(); i++)
                {
                    if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                    {
                        if (Containers.Employee_list[i].getmobile() == textBox1.Text)
                        {
                            mobilee = true;
                        }
                    }
                }
                bool mobiles = false;
                for (int i = 0; i < Containers.Employee_list.Count(); i++)
                {
                    if (Containers.Employee_list[i].getmobile() == mobile.Text)
                    {
                        mobiles = true;
                    }
                }
                for (int i = 0; i < Containers.Player_list.Count(); i++)
                {
                    if (Containers.Player_list[i].getmobile() == mobile.Text)
                    {
                        mobiles = true;
                    }
                }
                if (mobiles == true)
                {
                    MessageBox.Show("Please Re-enter Mobile Number !");
                }

                else if (mobilee == false)
                {
                    MessageBox.Show("Wrong Mobile Number");
                }
                else
                {
                    for (int i = 0; i < Containers.Employee_list.Count; i++)
                    {
                        if (Containers.Employee_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                        {
                            Containers.Employee_list[i].setmobile(mobile.Text);

                            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 (Enter_ID_Employee.coaach == true)
                    {
                        for (int i = 0; i < Containers.Coach_list.Count; i++)
                        {
                            if (Containers.Coach_list[i].getId().ToString() == Enter_ID_Employee.employeeeid)
                            {
                                Containers.Coach_list[i].setmobile(mobile.Text);

                                break;
                            }
                        }
                        if (File.Exists("Coaches.xml"))
                        {
                            File.Delete("Coaches.xml");
                        }

                        for (int i = 0; i < Containers.Coach_list.Count; i++)
                        {
                            Containers.write_coach(Containers.Coach_list[i]);
                        }
                    }
                    MessageBox.Show("Changes Done");
                }
            }
        }