private void timer1_Tick(object sender, EventArgs e)
        {
            progressBar.Increment(2);
            if (progressBar.Value == 100)
            {
                timer1.Stop();
                var user = log.Get(1);

                if (user.IsLogedIn)
                {
                    if (user.Role == "Manager" || user.Role == "Select Role")
                    {
                        var adminMenu = new AdminMenu();
                        this.Hide();
                        adminMenu.Show();
                    }
                    else
                    {
                        var employeeJob = new EmployeeJob(user.Name, user.Password);
                        this.Hide();
                        employeeJob.Show();
                    }
                }
                else
                {
                    var login = new Login();
                    this.Hide();
                    login.Show();
                }
            }
        }
Esempio 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      = "";
        }
Esempio n. 4
0
        public void LastLogGet()
        {
            var name = lastLogBusiness.Get(1).Name;

            Assert.AreEqual(name, lastLogBusiness.Get(1).Name, "Names must be equal");
        }