Ejemplo n.º 1
0
 private void RadButton1_Click(object sender, EventArgs e)
 {
     try
     {
         UserAccount userAccount = UserAccount.GetAccount(usernameBox.Text);
         if (userAccount.Password.Equals(Helpers.SecurityHelper.ConvertToMd5(passwordBox.Text)))
         {
             this.Hide();
             var homepageForm = new ApprenticeshipsForm(userAccount);
             homepageForm.Closed += (o, args) => this.Close();
             homepageForm.Show();
         }
         else
         {
             MessageBox.Show("Username or password is incorrect.");
         }
     }
     catch (UserNotFoundException)
     {
         MessageBox.Show("Username or password is incorrect.");
     }
 }
Ejemplo n.º 2
0
        private void RegisterButton_Click(object sender, EventArgs e)
        {
            var         hashedPassword = Helpers.SecurityHelper.ConvertToMd5(passwordBox.Text);
            UserAccount userAccount    = new UserAccount
            {
                DateOfBirth = birthdayBox.Value,
                FirstName   = firstNameBox.Text,
                LastName    = lastNameBox.Text,
                Password    = hashedPassword,
                Username    = usernameBox.Text,
                Points      = 0
            };

            int userId = UserAccount.CreateUserAccount(userAccount);

            userAccount.UserId = userId;

            this.Hide();
            var apprenticeshipForm = new ApprenticeshipsForm(userAccount);

            apprenticeshipForm.Closed += (o, args) => this.Close();
            apprenticeshipForm.Show();
        }
Ejemplo n.º 3
0
        private void ApprenticeshipButton_Click(object sender, EventArgs e)
        {
            var apprenticeshipsForm = new ApprenticeshipsForm(userAccount);

            apprenticeshipsForm.Show();
        }