public MainWindow(Models.users nuser)
        {
            InitializeComponent();
            user = nuser;
            switch (user.user_type)
            {
            case 1:
                services_btn.Visibility  = Visibility.Visible;
                customers_btn.Visibility = Visibility.Visible;
                brands_btn.Visibility    = Visibility.Visible;
                users_btn.Visibility     = Visibility.Visible;
                break;

            case 2:
                services_btn.Visibility  = Visibility.Visible;
                customers_btn.Visibility = Visibility.Visible;
                brands_btn.Visibility    = Visibility.Visible;
                users_btn.Visibility     = Visibility.Hidden;
                break;

            case 3:
                services_btn.Visibility  = Visibility.Visible;
                customers_btn.Visibility = Visibility.Hidden;
                brands_btn.Visibility    = Visibility.Hidden;
                users_btn.Visibility     = Visibility.Hidden;
                break;
            }
        }
Beispiel #2
0
        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            string hash        = GetSHA1(txtPassword.Password);
            var    login_query = from user in context.users where user.user == txtusername.Text && user.password == hash select user;

            if (login_query.Any())
            {
                Models.users user = new Models.users();
                user = login_query.First();
                MainWindow mainwin = new MainWindow(user);
                mainwin.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Usuario o contraseña son incorrectos");
            }
        }