private void BackButton_Click(object sender, RoutedEventArgs e)
        {
            EmployeePnl employeePnl = new EmployeePnl();

            employeePnl.Show();
            this.Close();
        }
Exemplo n.º 2
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            ObservableCollection <Employee> employees = Employee.employeesList();
            ObservableCollection <Member>   members   = Member.membersList();

            string username = username_tb.Text.ToLower();
            string password = pass_tb.Password;
            bool   isMatch  = false;

            if (username == "admin" && password == "AdminLib123")
            {
                var admin = new AdminPnl();
                admin.Show();
                isMatch = true;
                this.Close();
            }
            if (!isMatch)
            {
                for (int i = 0; i < employees.Count; i++)
                {
                    if (employees[i].userName.ToLower() == username && employees[i].password == password)
                    {
                        var emp = new EmployeePnl(employees[i]);
                        emp.Show();
                        isMatch = true;
                        this.Close();
                    }
                }
                if (!isMatch)
                {
                    for (int i = 0; i < members.Count; i++)
                    {
                        if (members[i].userName.ToLower() == username && members[i].password == password)
                        {
                            var emp = new MemberPnl(members[i]);
                            emp.Show();
                            isMatch = true;
                            this.Close();
                        }
                    }
                }
            }
            if (!isMatch)
            {
                MessageBox.Show("Doesn't exist!");
            }
        }