示例#1
0
        public void LoginAndCreateUser()
        {
            database.Users.Clear();
            authenticationLogic.CreateUser("Kees", "MyPassword123");

            Assert.IsTrue(authenticationLogic.Login("Kees", "MyPassword123"));
        }
示例#2
0
        /// <summary>
        /// A button click event that when triggered uses the information to add a new employee.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAddEmployee_Click(object sender, EventArgs e)
        {
            if (TxtEmployeeName.Text != "" && TxtEmployeeAddress.Text != "" && TxtEmployeePhone.Text != "" && (CheckCreateUserAccount.Checked ? (TxtUsername.Text != "" && TxtPassword.Text != "") : true))
            {
                employeeLogic.AddEmployee(new Employee()
                {
                    name = TxtEmployeeName.Text, age = (int)NudEmployeeAge.Value, gender = (Employee.Gender)Convert.ToInt32(!RadEmployeeMale.Checked), address = TxtEmployeeAddress.Text, phoneNumber = TxtEmployeePhone.Text
                });
                UpdateEmployeeList();
                SetComboBoxes();

                if (CheckCreateUserAccount.Checked)
                {
                    authenticationLogic.CreateUser(TxtUsername.Text, TxtPassword.Text);
                }

                MessageBox.Show("Vrijwilliger succesvol toegevoegd.", "Notice", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("Informatie is niet volledig ingevoerd.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }