Example #1
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            String username = "******";
            String password = "******";

            if ((Username.Text == username) && (Pass.Text == password))
            {
                Docente _docente = new Docente();

                _docente.StyleManager = this.StyleManager;
                this.Hide();
                _docente.ShowDialog();
                _docente.Dispose();

                Username.Clear();
                Pass.Clear();
            }

            else if ((string.IsNullOrWhiteSpace(Username.Text)) || (string.IsNullOrWhiteSpace(Pass.Text)))
            {
                MetroFramework.MetroMessageBox.Show(this, "\r\n" + "Campo(s) Vazios", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            else if ((Username.Text != username) && (Pass.Text != password))
            {
                MetroFramework.MetroMessageBox.Show(this, "\r\n" + "E-mail ou Password incorrectos", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
 private void ClearProps()
 {
     NewName     = string.Empty;
     Description = string.Empty;
     Pass.Clear();
     Testnet = false;
 }
Example #3
0
        private void enter_Button_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxButton button = MessageBoxButton.OK;
            MessageBoxImage  icon   = MessageBoxImage.Warning;

            SqlConnection  conn      = new SqlConnection($@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename={Environment.CurrentDirectory}\LOGINDB.MDF;Integrated Security=True");
            string         query     = "Select * from AdminLogin where username = '******' and password = '******'";
            SqlDataAdapter sda       = new SqlDataAdapter(query, conn);
            DataTable      dataTable = new DataTable();

            sda.Fill(dataTable);
            if (dataTable.Rows.Count == 1)
            {
                AddNewUser MS = new AddNewUser();
                MS.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show(this, "The username or password is incorrect.", "Error", button, icon);//, MessageBoxButtons.OK,
                // MessageBoxIcon.Information);
                userName.Clear();
                Pass.Clear();
                userName.Focus();
            }
        }
Example #4
0
 private void btn_ingresar_Click(object sender, EventArgs e)
 {
     if (User.Text == "1")
     {
         if (Pass.Text == "1")
         {
             central_admin v1 = new central_admin();
             this.Hide();
             v1.Show();
         }
         else
         {
             MessageBox.Show("Clave incorrecta intente de nuevo");
             User.Clear();
             Pass.Clear();
         }
     }
     if (User.Text == "2")
     {
         if (Pass.Text == "2")
         {
             central_user v1 = new central_user();
             this.Hide();
             v1.Show();
         }
         else
         {
             MessageBox.Show("Clave incorrecta intente de nuevo");
             User.Clear();
             Pass.Clear();
         }
     }
 }
Example #5
0
 //clear textbox when tab is pressed
 private void Pass_PreviewKeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Tab)
     {
         //my code here
         Pass.Clear();
     }
 }
Example #6
0
        private void ClearDataproduct2()
        {
            ID.Clear();
            name.Clear();
            Lname.Clear();

            Ass.Clear();
            Email.Clear();
            Tal.Clear();
            number.Clear();
            Pass.Clear();
        }
Example #7
0
        /*Button Click login*/

        private void button_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxButton button = MessageBoxButton.OK;
            MessageBoxImage  icon   = MessageBoxImage.Warning;

            //database funtionality for user login credentials

            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); //or set executing Assembly location path in param


            UserName.Focus();
            SqlConnection  conn      = new SqlConnection($@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename={Environment.CurrentDirectory}\LOGINDB.MDF;Integrated Security=True");
            string         query     = "Select * from UserLogin where username = '******' and password = '******'";
            SqlDataAdapter sda       = new SqlDataAdapter(query, conn);
            DataTable      dataTable = new DataTable();

            sda.Fill(dataTable);
            if (dataTable.Rows.Count == 1)
            {
                MainWindow MS = new MainWindow();
                MS.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show(this, "The username or password is incorrect.", "Error", button, icon);//, MessageBoxButtons.OK,
                // MessageBoxIcon.Information);
                UserName.Clear();
                Pass.Clear();
                UserName.Focus();
            }



            /* CODE USED FOR TESTING
             * if (UserName.Text == "leaplog" && Pass.Password == "leaplog")
             * {
             *   MainWindow MS = new MainWindow();
             *   MS.Show();
             *   this.Hide();
             * }
             * else
             * {
             *   MessageBox.Show(this, "Wrong User Name or Password", "Information");//, MessageBoxButtons.OK,
             *  // MessageBoxIcon.Information);
             *   UserName.Clear();
             *   Pass.Clear();
             *   UserName.Focus();
             * }*/
        }
Example #8
0
        private void btnaut_Click(object sender, RoutedEventArgs e)
        {
            chanel.Login(Logintext.Text, Pass.Password);

            Login log = new Login();

            log.Close();
            Logintext.Clear();
            Pass.Clear();
            MainWindow win = new MainWindow();

            win.Show();
            win.name.Content = Logintext.Text;
        }
 public void MakeUser()
 {
     Navigate();
     YourAmazon.Click();
     NewUser.Click();
     Assert.Contains("Create account", CreateText.Text);
     Name.Clear();
     Name.SendKeys("TestUser");
     Email.Clear();
     Email.SendKeys("*****@*****.**");
     Pass.Clear();
     Pass.SendKeys("123123123");
     PassConf.Clear();
     PassConf.SendKeys("123123123");
 }
Example #10
0
 private void bt_Shifr_Click(object sender, RoutedEventArgs e)
 {
     if (Pass.Text.ToString() == "12345")
     {
         string Familiya_Klient = tb_Familiya_Klient.Text.ToString();
         tb_Familiya_Klient.Text = Class1.Code_Message(Familiya_Klient);
         string Name_Klient = tb_Name_Klient.Text.ToString();
         tb_Name_Klient.Text = Class1.Code_Message(Name_Klient);
         string Otchestvo_Klient = tb_Otchestvo_Klient.Text.ToString();
         tb_Otchestvo_Klient.Text = Class1.Code_Message(Otchestvo_Klient);
         MessageBox.Show("Данные расшифрованны");
         Pass.Clear();
     }
     else
     {
         MessageBox.Show("Пароль расшифровки неверный!");
     }
 }
Example #11
0
 private void Login_Click(object sender, EventArgs e)
 {
     if (user.Text == "user" && Pass.Text == "123")
     {
         new Form2().Show();
         this.Hide();
     }
     if (user.Text == "admin" && Pass.Text == "1234")
     {
         new Form3().Show();
         this.Hide();
     }
     else
     {
         MessageBox.Show("The user name or password is incorrect");
         user.Clear();
         Pass.Clear();
         user.Focus();
     }
 }
Example #12
0
        private void btnlog_Click(object sender, RoutedEventArgs e)
        {
            MainWindow win = new MainWindow();

            if (chanel.GetListofFriends().ToString() == Logintext.Text && chanel.GetPassListofFriends().ToString() == Pass.Password)
            {
                chanel.Login(Logintext.Text, Pass.Password);
                win.Show();
                win.name.Content = Logintext.Text;
            }

            else
            {
                MessageBox.Show("Error", "Loginor password is faild", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            Login log = new Login();

            log.Close();
            Logintext.Clear();
            Pass.Clear();
        }
Example #13
0
        public bool PreencherCampos(Table table)
        {
            bool _result     = false;
            var  credentials = table.CreateInstance <ClassUtilities.Credentials>();

            string Class = Pass.GetAttribute("class");

            try
            {
                util.WaitForElementVisible(InputCpf, 45);
                if (InputCpf.Displayed)
                {
                    InputCpf.Clear();
                    Thread.Sleep(300);
                    InputCpf.SendKeys(credentials.Cpf);
                    Thread.Sleep(300);

                    if (Class == "input-padrao valid")
                    {
                        Pass.Clear();

                        Pass.SendKeys(credentials.Senha);
                        Thread.Sleep(300);

                        _result = true;
                    }
                    else
                    {
                        Pass.SendKeys(credentials.Senha);
                        Thread.Sleep(300);

                        _result = true;
                    }
                }
            }
            catch
            {
            }
            return(_result);
        }
 private void Admin_Click(object sender, RoutedEventArgs e) // при нажатии кнопки режима администратора
 {
     if (Admin.Content.ToString() == "Войти")
     {
         string TruePass = "";
         if (HASH(Pass.Password.ToString()) == TruePassword(TruePass)) // проверка текущего пароля с введённым
         {
             DATA.FileDBWayFromMainWindow = FileName;                  // отправление пути к БД в окно администратора
             Administration DS = new Administration();                 // открытие окна администратора
             DS.Show();
             CheckClose = false;
             this.Close(); // закрытие текущего окна
         }
         else // откат к предыдущему состоянию при не верном пароле
         {
             MessageBox.Show("Неверный пароль!", "Ошибка");
             Pass.Clear();
             ViewPass.Clear();
             Pass.Visibility     = Visibility.Hidden;
             Check.Visibility    = Visibility.Hidden;
             ViewPass.Visibility = Visibility.Hidden;
             Admin.Content       = "Администратор";
             Switch = false;
         }
     }
     if (Admin.Content.ToString() == "Администратор" && Switch) // показ элементов для ввода пароля
     {
         Pass.Visibility  = Visibility.Visible;
         Check.Visibility = Visibility.Visible;
         Check.IsEnabled  = true;
         Admin.Content    = "Войти";
         Switch           = false;
         Pass.Focus();
     }
     Switch = true;
 }
Example #15
0
 private void Clear_Click(object sender, EventArgs e)
 {
     user.Clear();
     Pass.Clear();
     user.Focus();
 }
 private void textBox2_Click(object sender, EventArgs e)
 {
     Pass.Clear();
     Pass.PasswordChar = '*';
     Pass.ForeColor    = Color.FromArgb(48, 184, 206);
 }
Example #17
0
        private void tbExit_Click(object sender, RoutedEventArgs e)
        {
            var User = context.Person.ToList().
                       Where(p => p.Name == this.Login.Text && p.Password == Pass.Password).FirstOrDefault();

            if (User != null)
            {
                var login = Convert.ToString(Login.Text);

                switch (User.IdRole)
                {
                case 1:
                    this.Hide();
                    Windows.AdminWindow adminWindow = new Windows.AdminWindow(login.ToString());
                    adminWindow.ShowDialog();
                    this.Close();
                    break;

                case 2:
                    this.Hide();
                    Windows.ManegerWindow manegerWindow = new Windows.ManegerWindow(login.ToString());
                    manegerWindow.ShowDialog();
                    this.Close();
                    break;

                case 3:
                    this.Hide();
                    Windows.UserWindow userWindow = new Windows.UserWindow(login.ToString());
                    userWindow.ShowDialog();
                    this.Close();
                    break;

                default:
                    break;
                }
            }
            else
            {
                MessageBox.Show("Вы ввели не правильно пароль или логин");

                InitializeComponent();
                Captcha1.Visibility   = Visibility.Visible;
                imgCaptcha.Visibility = Visibility.Visible;
                reload.Visibility     = Visibility.Visible;
                Captcha.Visibility    = Visibility.Visible;

                if ((User != null) && (Captcha1.Text == Captcha.Text))
                {
                    var login = Convert.ToString(Login.Text);

                    switch (User.IdRole)
                    {
                    case 1:
                        Windows.AdminWindow adminWindow = new Windows.AdminWindow(login.ToString());
                        this.Hide();
                        adminWindow.ShowDialog();
                        this.Close();
                        break;

                    case 2:
                        Windows.ManegerWindow manegerWindow = new Windows.ManegerWindow(login.ToString());
                        this.Hide();
                        manegerWindow.ShowDialog();
                        this.Close();
                        break;

                    case 3:
                        Windows.UserWindow userWindow = new Windows.UserWindow(login.ToString());
                        this.Hide();
                        userWindow.ShowDialog();
                        this.Close();
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    Captcha.Clear();
                    CaptchaMet();
                }
            }
            Login.Clear();
            Pass.Clear();
        }
Example #18
0
 //clear the box when mouse clicks
 private void Pass_PreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     Pass.Clear();
 }
Example #19
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(login.Text) || string.IsNullOrEmpty(Pass.Password) || Role.SelectedIndex < 0)
            {
                MessageBox.Show("Пустые поля", "Уведомление");
            }
            else
            {
                string  sql   = "EXEC sp_helprotect Null,Null;";
                bool    check = false;
                Connect conn  = new Connect();
                conn.connection();

                SqlCommand    command = new SqlCommand(sql, Connect.cnn);;
                SqlDataReader reader  = command.ExecuteReader();
                while (reader.Read())
                {
                    if (reader.GetValue(2).ToString() == login.Text)
                    {
                        check = true;
                        break;
                    }
                }
                conn.disconnection();

                if (check == true)
                {
                    MessageBox.Show("Пользователь существует", "Уведомление");
                }
                else
                {
                    sql = "CREATE LOGIN " + login.Text + " WITH PASSWORD = '******'; " +
                          "CREATE USER " + login.Text + " FOR LOGIN " + login.Text + "; " +
                          "ALTER LOGIN " + login.Text + " WITH PASSWORD = '******'; " +
                          "EXECUTE sp_addrolemember '" + Role.Text + "','" + login.Text + "'";
                    conn = new Connect();
                    conn.connection();
                    command = new SqlCommand(sql, Connect.cnn);;
                    command.ExecuteNonQuery();
                    conn.disconnection();
                    if (Role.Text == "Admin_BD")
                    {
                        sql = "GRANT SELECT ON dbo.Staff to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Staff to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Staff to " + login.Text + "; " +
                              "GRANT delete ON dbo.Staff to " + login.Text + "; " +
                              "GRANT Update ON dbo.Staff to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT delete ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT Update ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT delete ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT Update ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Services to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Services to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Services to " + login.Text + "; " +
                              "GRANT delete ON dbo.Services to " + login.Text + "; " +
                              "GRANT Update ON dbo.Services to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT delete ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT Update ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Clients to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Clients to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Clients to " + login.Text + "; " +
                              "GRANT delete ON dbo.Clients to " + login.Text + "; " +
                              "GRANT Update ON dbo.Clients to " + login.Text + "; ";
                        conn.connection();
                        command = new SqlCommand(sql, Connect.cnn);;
                        command.ExecuteNonQuery();
                        conn.disconnection();
                    }
                    if (Role.Text == "PR_Manager")
                    {
                        sql = "GRANT SELECT ON dbo.Staff to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Staff to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Staff to " + login.Text + "; " +
                              "GRANT delete ON dbo.Staff to " + login.Text + "; " +
                              "GRANT Update ON dbo.Staff to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT delete ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT Update ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Services to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Clients to " + login.Text + "; ";
                        conn.connection();
                        command = new SqlCommand(sql, Connect.cnn);;
                        command.ExecuteNonQuery();
                        conn.disconnection();
                    }
                    if (Role.Text == "ST_Manager")
                    {
                        sql = "GRANT SELECT ON dbo.Staff to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Positionen to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Clients to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT delete ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT Update ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Services to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Services to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Services to " + login.Text + "; " +
                              "GRANT delete ON dbo.Services to " + login.Text + "; " +
                              "GRANT Update ON dbo.Services to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.[Services provided to the client] to " + login.Text + "; ";
                        conn.connection();
                        command = new SqlCommand(sql, Connect.cnn);;
                        command.ExecuteNonQuery();
                        conn.disconnection();
                    }
                    if (Role.Text == "RP_Manager")
                    {
                        sql = "GRANT SELECT ON dbo.Clients to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.Clients to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.Clients to " + login.Text + "; " +
                              "GRANT delete ON dbo.Clients to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT INSERT ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT ALTER ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT delete ON dbo.[Services provided to the client] to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Rooms to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Services to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Clients to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Staff to " + login.Text + "; " +
                              "GRANT SELECT ON dbo.Positionen to " + login.Text + "; ";
                        conn.connection();
                        command = new SqlCommand(sql, Connect.cnn);;
                        command.ExecuteNonQuery();
                        conn.disconnection();
                    }
                    MessageBox.Show("Пользователь создан", "Уведомление");
                    login.Clear();
                    Pass.Clear();
                }
            }
        }
Example #20
0
 private void label5_Click(object sender, EventArgs e)
 {
     Uname.Clear();
     Pass.Clear();
 }