Exemplo n.º 1
0
 public void LogIn(string login, string password)
 {
     _driver.Navigate().GoToUrl(StringHelper.LogInPageUrl);
     TbLogin.Clear();
     TbLogin.SendKeys(login);
     TbPassword.Clear();
     TbPassword.SendKeys(password);
     BtnZaloguj.Click();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Metoda przycisku Zaloguj.Sprawdza podane wartości TbLogin i PbHasło z danymi zawartymi w bazie danaych [Numer Karty == Login i Pin == Hasło]
        /// oraz wartość zmiennej karta , jeśli podane dane są prawdziwe i wartość karta = true to pokazuje komunikat logowanie udane i wywołuje nowe okno
        /// jeśli któryś z warunków jest niepoprawny pokazuje się komunikat informujący o błędnym logowaniu jeśli niepoprawne logowanie powtarza się 3 razy
        /// to zarówno TbLogin jak i PbHasło zostają zablokowane.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BZaloguj_Click(object sender, RoutedEventArgs e)
        {
            string Login = TbLogin.Text;
            string Hasło = PbHasło.Password;

            SqlDataReader sprawdz = null;


            string        connectionString = @"Data source=.\SQLExpress;database=BazaBankomat;Trusted_Connection=True";
            SqlConnection connection       = new SqlConnection(connectionString);

            connection.Open();

            SqlCommand command = new SqlCommand();

            command.Connection  = connection;
            command.CommandType = CommandType.Text;



            string commandText = "Select * From[Dane Logowania] Where[Numer Karty]='" + Login + "' And Pin ='" + Hasło + "'";


            command.CommandText = commandText;
            sprawdz             = command.ExecuteReader();

            if (sprawdz.HasRows == true && karta == true)
            {
                MessageBox.Show("Logowanie udane");

                Okno pokaż = new Okno();
                pokaż.Show();
                this.Close();
            }
            else
            {
                liczLogowania++;
                int próba = 3;
                próba = próba - liczLogowania;
                MessageBox.Show("Logowanie nieudane.  Zostało prób : " + próba + "\nPo 3 nieudanych próbach możliwość logowania zostaje zablokowana.");
            }

            connection.Close();

            if (liczLogowania >= 3)
            {
                TbLogin.Clear();
                TbLogin.IsReadOnly = true;
                TbLogin.IsEnabled  = false;
                PbHasło.Clear();
                PbHasło.IsEnabled = false;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Metoda przycisku Zaloguj.Sprawdza wartości wpisane w textboxie i passwordboxie z danymi w bazie danych jeśli są poprawne otwiera nowe okno WybórPoczty
        /// A przy 3 błędnych logowaniach blokuje textboxa i possword boxa.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BLogin_Click(object sender, RoutedEventArgs e)
        {
            string Login = TbLogin.Text;
            string Hasło = PbHasło.Password;

            SqlDataReader sprawdz = null;


            string        connectionString = @"Data source=.\SQLExpress;database=BazaPoczta;Trusted_Connection=True";
            SqlConnection connection       = new SqlConnection(connectionString);

            connection.Open();

            SqlCommand command = new SqlCommand();

            command.Connection  = connection;
            command.CommandType = CommandType.Text;



            string commandText = "Select * From Logowanie Where Login ='******' And Hasło ='" + Hasło + "'";

            command.CommandText = commandText;
            sprawdz             = command.ExecuteReader();

            if (sprawdz.HasRows == true)
            {
                //MessageBox.Show("Logowanie udane");

                WybórPoczty pokaż = new WybórPoczty();
                pokaż.Show();
                this.Close();
            }
            else
            {
                int próba = 3;
                próba = próba - liczLogowania;
                liczLogowania++;
                MessageBox.Show("Logowanie nieudane.Zostało prób = " + próba);
            }

            connection.Close();

            if (liczLogowania >= 3)
            {
                TbLogin.Clear();
                TbLogin.IsReadOnly = true;
                TbLogin.IsEnabled  = false;
                PbHasło.Clear();
                PbHasło.IsEnabled = false;
            }
        }
Exemplo n.º 4
0
 private void BtnNext_Click(object sender, RoutedEventArgs e)
 {
     if (TbLogin.Text == RandomClass.Saver)
     {
         ActionWindowClass.MainFrame.NavigationService.RemoveBackEntry();
         ActionWindowClass.MainFrame.Navigate(new PageChangePassword());
     }
     else
     {
         TbLogin.BorderBrush = Brushes.OrangeRed;
         TbLogin.Clear();
     }
 }
Exemplo n.º 5
0
        private void SignIn(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TbLogin.Text))
            {
                MB.MessageBoxInfo("Введите логин");
                TbLogin.Focus();
            }
            else if (string.IsNullOrWhiteSpace(PbPassword.Password))
            {
                MB.MessageBoxInfo("Введите пароль");
                PbPassword.Focus();
            }
            else
            {
                var employee = DataService.GetContext().Employee.FirstOrDefault(u => u.User.Login == TbLogin.Text);

                if (employee == null)
                {
                    MB.MessageBoxInfo("Введен неверно логин/пароль");
                    TbLogin.Focus();
                    count++;
                }
                else
                {
                    if (employee.User.Password != PbPassword.Password)
                    {
                        MB.MessageBoxInfo("Введен неверно логин/пароль");
                        TbLogin.Clear();
                        PbPassword.Clear();
                        count++;
                    }
                    else
                    {
                        Entity.CurrentEmployee = employee;
                        switch (employee.User.IdRole)
                        {
                        case 1:
                            new WinManager().Show();
                            this.Close();
                            break;

                        case 2:
                            new WinEmployee().Show();
                            this.Close();
                            break;

                        case 3:
                            new WinAdmin().Show();
                            this.Close();
                            break;
                        }
                        count = 0;
                    }
                }
                if (count >= 3)
                {
                    TbLogin.Text           = string.Empty;
                    PbPassword.Password    = string.Empty;
                    GridSignIn.Visibility  = Visibility.Hidden;
                    GridCaptcha.Visibility = Visibility.Visible;
                    TbCaptcha.Text         = Captcha.GenerateString(5);
                    return;
                }
            }
        }
Exemplo n.º 6
0
        private void BtnJoin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(TbLogin.Text))
                {
                    Runtb.Text = null;
                    Runtb2.Inlines.Clear();
                    Runtb.Text += "Вы не ввели логин.";
                    Runtb2.Inlines.Add("Забыли пароль?");
                    TbLogin.BorderBrush    = Brushes.OrangeRed;
                    PBPassword.BorderBrush = Brushes.OrangeRed;
                    TbLogin.Clear();
                    PBPassword.Clear();
                }
                else if (string.IsNullOrWhiteSpace(PBPassword.Password))
                {
                    Runtb.Text = null;
                    Runtb2.Inlines.Clear();
                    Runtb.Text += "Вы не ввели пароль.";
                    Runtb2.Inlines.Add("Забыли пароль?");
                    PBPassword.BorderBrush = Brushes.OrangeRed;
                }
                else
                {
                    var user = DataClass.GetContext().User.FirstOrDefault(u => u.Login == TbLogin.Text);
                    if ((user == null) || (user.Password != PBPassword.Password))
                    {
                        Runtb.Text = null;
                        Runtb2.Inlines.Clear();
                        Runtb.Text += "Вы ввели неверный логин или пароль.";
                        Runtb2.Inlines.Add("Забыли пароль?");
                        TbLogin.BorderBrush    = Brushes.OrangeRed;
                        PBPassword.BorderBrush = Brushes.OrangeRed;
                        TbLogin.Clear();
                        PBPassword.Clear();
                    }
                    else
                    {
                        switch (user.IdRole)
                        {
                        case 1:
                            ActionWindowClass.staffUser = DataClass.GetContext().Staff.FirstOrDefault(s => s.IdUser == user.Id);
                            new WinAdmin().Show();
                            winAuth.Close();

                            break;

                        case 2:
                            ActionWindowClass.staffUser = DataClass.GetContext().Staff.FirstOrDefault(s => s.IdUser == user.Id);
                            new WinManager().Show();
                            winAuth.Close();

                            break;

                        case 3:
                            ActionWindowClass.staffUser = DataClass.GetContext().Staff.FirstOrDefault(s => s.IdUser == user.Id);
                            new WinStaff().Show();
                            winAuth.Close();

                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }