Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
            ManageUsers mngUsers = new ManageUsers();

            mngUsers.Show();
        }
Пример #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            UsersRepository repo = new UsersRepository();

            AuthenticationService.AuthenticateUser(txtUsername.Text, txtPassword.Text);
            if (AuthenticationService.LoggedUser != null)
            {
                ManageUsers manageUsersForm = new ManageUsers();
                manageUsersForm.Show();
            }
            this.Hide();
        }
Пример #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            UsersRepository repo = new UsersRepository();

            if (txtUsername.Text == "")
            {
                MessageBox.Show("The textbox can't be empty!");
            }
            else
            {
                user.Username = txtUsername.Text.TrimEnd();
            }
            if (txtPassword.Text == "")
            {
                MessageBox.Show("The textbox can't be empty!");
            }
            else
            {
                user.Password = txtPassword.Text.TrimEnd();
            }
            if (txtFirstname.Text == "")
            {
                MessageBox.Show("The textbox can't be empty!");
            }
            else
            {
                user.Firstname = txtFirstname.Text.TrimEnd();
            }
            if (txtEmail.Text == "")
            {
                MessageBox.Show("The textbox can't be empty!");
            }
            else
            {
                user.Email = txtEmail.Text.TrimEnd();
            }
            if (txtLastname.Text == "")
            {
                MessageBox.Show("The textbox can't be empty!");
            }
            else
            {
                user.Lastname = txtLastname.Text.TrimEnd();
            }
            repo.Update(user);


            ManageUsers mngUsers = new ManageUsers();

            this.Hide();
            mngUsers.Show();
        }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ManageUsers     mngUsers = new ManageUsers();
            UsersRepository repo     = new UsersRepository();

            User user = new User();

            user.Username  = txtUsername.Text.TrimEnd();
            user.Password  = txtPassword.Text.TrimEnd();
            user.Email     = txtEmail.Text.TrimEnd();
            user.Firstname = txtFirstname.Text.TrimEnd();
            user.Lastname  = txtLastname.Text.TrimEnd();

            repo.Insert(user);

            this.Hide();

            mngUsers.Show();
        }
Пример #5
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            User user = (User)lbUsers.SelectedItem;

            UsersRepository usersRepo = new UsersRepository();

            if (user == null)
            {
                MessageBox.Show("Please select a user!");
            }
            else
            {
                DialogResult result = MessageBox.Show("Do you really want to delete this user?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                if (result == DialogResult.Yes)
                {
                    usersRepo.Delete(user);
                    this.Hide();
                    ManageUsers mngUsers = new ManageUsers();
                    mngUsers.Show();
                }
            }
        }