Exemplo n.º 1
0
        private void accesar_Click(object sender, RoutedEventArgs e)
        {
            //NavigationService.Navigate(new Uri("/Menu.xaml", UriKind.RelativeOrAbsolute));

            if(user.Text.Equals("")){//SI USER ESTA VACIO
                MessageBoxResult r = MessageBox.Show("Identifiquese por favor", "Recuerde...", MessageBoxButton.OK, MessageBoxImage.Error);
                user.Focus();
            }
            else{
                if(pass.Password.Equals("")){
                    MessageBoxResult r = MessageBox.Show("Identifiquese por favor", "Recuerde...", MessageBoxButton.OK, MessageBoxImage.Error);
                    pass.Focus();
                }
                else{
                    var usuario = from em in con.Empleado
                               where em.Usuario == user.Text.Trim() &&
                                     em.Password == pass.Password.Trim()
                               select em;
                    try
                    {
                        int usuarioInt=usuario.SingleOrDefault().idEmpleado;
                        String nombre = usuario.SingleOrDefault().Nombre;
                        MenuIU m = new MenuIU(user.Text.Trim(),usuarioInt,nombre);
                        this.NavigationService.Navigate(m);
                    }
                    catch(System.NullReferenceException){
                        MessageBoxResult r = MessageBox.Show("No tiene permisos para acceder", "Advertencia...", MessageBoxButton.OK, MessageBoxImage.Stop);
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void btnSalirReqNew(object sender, System.Windows.RoutedEventArgs e)
 {
     MenuIU miu = new MenuIU();
     this.NavigationService.Navigate(miu);
 }