Exemplo n.º 1
0
        public void LastLogUpdate()
        {
            var newName = "Works";
            var log     = lastLogBusiness.Get(1);

            log.Name = newName;
            lastLogBusiness.Update(log);

            Assert.AreEqual(newName, lastLogBusiness.Get(1).Name, "Element was not updated");
        }
Exemplo n.º 2
0
        private void btnLogout_Click(object sender, EventArgs e)
        {
            var lastLogBusiness = new LastLogBusiness();
            var log             = lastLogBusiness.Get(1);

            log.IsLogedIn = false;
            lastLogBusiness.Update(log);
            var logout = new Login();

            this.Hide();
            logout.Show();
        }
        private void loginBtn_Click(object sender, EventArgs e)
        {
            var username  = usernameBox;
            var password  = passwordBox;
            var role      = roleBox;
            var employees = employeeBusiness.GetAll();

            var log = lastLogBusiness.Get(1);

            log.Name      = username.Text;
            log.Password  = password.Text;
            log.Role      = role.Text;
            log.IsLogedIn = true;
            lastLogBusiness.Update(log);

            foreach (var employee in employees)
            {
                if (employee.Name == username.Text &&
                    employee.Password == password.Text &&
                    employee.Role == role.Text)
                {
                    this.Hide();

                    if (role.Text == "Manager" || role.Text == "Select Role")
                    {
                        var adminMenu = new AdminMenu();
                        adminMenu.Show();
                    }
                    else
                    {
                        var employeeJob = new EmployeeJob(employee.Name, employee.Password);
                        employeeJob.Show();
                    }
                }
            }

            wrongPassword.Text = "Wrong password!";
            password.Text      = "";
        }