private void Submit_Click(object sender, RoutedEventArgs e)
        {
            var foundInDatabase = dbContext.ClinicUsers.Where(d => d.UserLogin == UserName.Text && d.UserPassword == UserPassword.Password).FirstOrDefault();

            if (foundInDatabase != null)
            {
                var profession = foundInDatabase.UserProfession;

                if (profession.Equals("Administrator"))
                {
                    adminWindow = new AdminWindow(UserName.Text, UserPassword.Password);
                    adminWindow.Show();
                }
                else
                {
                    userWindow = new UserWindow(UserName.Text, UserPassword.Password);
                    userWindow.Show();
                }


                this.Close();
            }
            else
            {
                MessageBox.Show("Nieudana próba logowania!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                UserName.Clear();
                UserPassword.Clear();
            }
        }
 public void LoginErrado()
 {
     MessageBox.Show(this, "User or Password incorrect!");
     txtUsername.Text = "";
     UserPassword.Clear();
     txtUsername.Focus();
 }
Exemple #3
0
 private void NewUserButton_Click(object sender, RoutedEventArgs e)
 {
     UserNameTextBox.Clear();
     UserLastNameTextBox.Clear();
     UserLoginTextBox.Clear();
     UserPassword.Clear();
     UserZoneCombo.SelectedItem             = null;
     IsAdminCheckBox.IsChecked              = false;
     ActiveCheckBox.IsChecked               = false;
     _mainWindowViewController.SelectedUser = null;
 }
        public void UserLogin(string email, string password)
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));

            wait.Until(ExpectedConditions.ElementToBeClickable(_typeEmail));
            UserEmail.Clear();
            UserEmail.SendKeys(email);
            Thread.Sleep(2000);
            wait.Until(ExpectedConditions.ElementToBeClickable(_typePassword));
            UserPassword.Clear();
            UserPassword.SendKeys(password);
        }
 public DashBoardPage Loging(string username, string pass)
 {
     Console.WriteLine("Find for the form to login");
     Utils.FindElementVisible(By.Id("txtUsername"));
     Console.WriteLine("Fill Login and password with values: " + username + " and " + pass);
     UserName.SendKeys(username);
     UserPassword.Clear();
     UserPassword.SendKeys(pass);
     Console.WriteLine("Click on Loging button");
     ButtonLogin.Click();
     return(new DashBoardPage());
 }
Exemple #6
0
        public void LogIn()
        {
            Browser.WaitForElements(new List <IWebElement>()
            {
                UserName, UserPassword, LogInButton
            });
            UserName.Clear();
            UserPassword.Clear();
            UserName.SendKeys(Browser.getUser());
            UserPassword.SendKeys(Browser.getPassword());

            LogInButton.Click();
        }
Exemple #7
0
 //Reset form data and visibility
 private void ResetForm()
 {
     //EditPermBT.IsEnabled = false;
     UserNameTX.Clear();
     UserRealTX.Clear();
     UserPassword.Clear();
     FormGrid.MaxHeight       = 230;
     CheckPassword.Visibility = Visibility.Collapsed;
     PasswordConfirm.Clear();
     SelectedIndex              = "";
     UserRolCB.SelectedIndex    = 0;
     UserBranchCB.SelectedIndex = 0;
     SaveBT.IsEnabled           = false;
 }
Exemple #8
0
 void RegisterUser(string login, string password, string role)
 {
     if (login == "" || password == "" || role == "")
     {
         MessageBox.Show("Введите данные в поля!");
     }
     else
     {
         if (role == "admin" || role == "user" || role == "dismissed")
         {
             string          Connect      = @"SERVER=localhost;User Id=root;DATABASE=MY;PORT=3306;password=vilkova199820";
             MySqlConnection myConnection = new MySqlConnection(Connect);
             using (myConnection)
             {
                 var addUserCmd = new MySqlCommand("INSERT INTO `my`.`user` (username,password,role) VALUES (@Login, @Password, @Role)", myConnection);
                 addUserCmd.Parameters.AddWithValue("@Login", login);
                 addUserCmd.Parameters.AddWithValue("@Password", password);
                 addUserCmd.Parameters.AddWithValue("@Role", role);
                 try
                 {
                     myConnection.Open();
                     addUserCmd.ExecuteNonQuery();
                     MessageBox.Show("Новый пользователь успешно добавлен в базу данных!");
                     UserName.Clear();
                     UserPassword.Clear();
                     UserRole.Clear();
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show("Ошибка: " + ex.Message);
                 }
             }
             myConnection.Close();
         }
         else
         {
             MessageBox.Show(role);
             MessageBox.Show("Несуществующая роль! Выберите между: admin или user или dismissed");
         }
     }
 }
Exemple #9
0
        //--------------------------------------КНОПОЧКА ВХОДА В САМУ ПРОГРАММУ--------------------------//

        private void Input_Click(object sender, EventArgs e)
        {
            bool result = false;

            try
            {
                result = service.Authorize(UserName.Text, UserPassword.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Неверный логин или пароль!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                UserName.Clear();
                UserPassword.Clear();
                result = false;
            }

            if (result)
            {
                this.Hide();
                FormChooser frm2 = new FormChooser(this);
                frm2.Show();
            }
        }