예제 #1
0
        private void Ayuda_Click(object sender, RoutedEventArgs e)
        {
            Window2 ventana = new Window2();

            ventana.Owner = this;
            ventana.Show(); //Abrimos ventana modal
        }
예제 #2
0
        private void Btn_Login_Click(object sender, RoutedEventArgs e)
        {
            string hash_input = TB_Password.Password;

            //string hash = BCrypt.Net.BCrypt.HashPassword(hash_input);

            int temp_id;

            var check = con.Query <Check>("SELECT * FROM TB_M_User WHERE @Email = Email",
                                          new { Email = TB_Email.Text }).SingleOrDefault();

            bool isValid = BCrypt.Net.BCrypt.Verify(hash_input, check.Password);

            if (isValid == true)
            {
                temp_id = check.Id;

                var role = con.QueryAsync <Check>("exec SP_Assign_Role @Id",
                                                  new { Id = temp_id }).Result.SingleOrDefault();

                var temp_employee = con.QueryAsync <Check>("SELECT Employee_Id FROM TB_M_User WHERE Id=@Id",
                                                           new { Id = temp_id }).Result.SingleOrDefault();

                MessageBox.Show("Berhasil Login role : " + role.Role_Id);

                var newwindow = new Window2(role.Role_Id, temp_employee.Employee_Id);
                newwindow.Show();

                Close();
            }
            else
            {
                MessageBox.Show("Gagal Login");


                var newwindow = new Window2(1, 5);
                newwindow.Show();

                Close();
            }
        }