Ejemplo n.º 1
0
 private void createButton_Click(object sender, EventArgs e)
 {
     if ((loginTextBox.Text == "") || (passwordTextBox.Text == "") || (usernameTextBox.Text == ""))
     {
         MessageBox.Show("Please, fill all fields!");
     }
     else
     {
         if (registrationListBL.IsIRegistrationRecordExistsByLog(loginTextBox.Text) != 0)
         {
             Console.WriteLine("login exists");
             MessageBox.Show("This login is already exists!");
         }
         else if (userListBL.IsUserExistsByUsername(usernameTextBox.Text) != 0)
         {
             Console.WriteLine("username exists");
             MessageBox.Show("This username is already exists!");
         }
         else
         {
             Console.WriteLine("ok");
             userListBL.Add(new Entities.UserList(usernameTextBox.Text));
             registrationListBL.Add(new Entities.RegistrationList(userListBL.IsUserExistsByUsername(usernameTextBox.Text), loginTextBox.Text, passwordTextBox.Text));
             //go to lk
             MessageBox.Show("New account created succsessfully!");
             Form personalAreaForm = new PersonalAreaForm(registrationListBL.IsIRegistrationRecordExistsByLogAndPass(loginTextBox.Text, passwordTextBox.Text),
                                                          registrationListBL.IsIRegistrationRecordExistsByLog(loginTextBox.Text));
             personalAreaForm.ShowDialog();
             this.Close();
         }
     }
 }
        private void changeButton_Click(object sender, EventArgs e)
        {
            if ((newLoginTextBox.Text == ""))
            {
                MessageBox.Show("Please, fill the field!");
            }
            else
            {
                if (userListBL.IsUserExistsByUsername(newLoginTextBox.Text) != 0)
                {
                    Console.WriteLine("username exists");
                    MessageBox.Show("This username is already exists!");
                }
                else
                {
                    userListBL.UpdateByID(thisUserID, newLoginTextBox.Text);
                    MessageBox.Show("Username updated succsessfully!");

                    this.Close();
                }
            }
        }