示例#1
0
        private void CargarDg()
        {
            PrevencionRiesgosWPF.PrevencionRiesgosWCF.PrevencionClient proxy = new PrevencionRiesgosWPF.PrevencionRiesgosWCF.PrevencionClient();

            List <Usuario> lu = UsuarioCollection.Deserializar(proxy.ReadUsuariosCollection());


            proxy.Close();

            dgUsuarios.ItemsSource = lu;
            dgUsuarios.Items.Refresh();
        }
示例#2
0
        private void btnSesion_Click(object sender, RoutedEventArgs e)
        {
            Usuario u = new Usuario();

            u.Rut  = txtUser.Text;
            u.Pass = boxPassword.Password;
            string xml1 = u.Serializar();

            PrevencionRiesgosWPF.PrevencionRiesgosWCF.PrevencionClient proxy = new PrevencionRiesgosWPF.PrevencionRiesgosWCF.PrevencionClient();

            bool valido = proxy.ValidarUsuario(xml1);


            proxy.Close();


            if (valido)
            {
                proxy = new PrevencionRiesgosWPF.PrevencionRiesgosWCF.PrevencionClient();
                string xml = proxy.ReadUsuario(u.Serializar());
                proxy.Close();
                u           = Usuario.Deserializar(xml);
                u.ULogueado = u;

                if (u.IdTipo == 1 || u.IdTipo == 2)
                {
                    MessageBox.Show("Usuario no permitido", "Alerta", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    if (u.DarBaja == true)
                    {
                        MessageBox.Show("Usuario dado de baja", "Alerta", MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }

                    MainWindow mw = new MainWindow();
                    mw.Show();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Usuario no registrado", "Alerta", MessageBoxButton.OK, MessageBoxImage.Warning);
                //lblInfo.Content = "Usuario no registrado";
            }
        }
示例#3
0
        private void CargarControles()
        {
            PrevencionRiesgosWPF.PrevencionRiesgosWCF.PrevencionClient proxy = new PrevencionRiesgosWPF.PrevencionRiesgosWCF.PrevencionClient();

            List <TipoUsuario> lu = TipoUsuarioCollection.Deserializar(proxy.ReadTipoUsuario());

            //List<ClienteEmpresa> lce = ClienteEmpresaCollection.Deserializar();

            proxy.Close();


            cbTipAgr.DisplayMemberPath = "Nombre";
            cbTipAgr.SelectedValuePath = "IdTipo";
            cbTipAgr.ItemsSource       = lu.Where(t => t.IdTipo == 1 || t.IdTipo == 2 || t.IdTipo == 3);
            cbTipAgr.SelectedValue     = "1";
            cbTipAgr.Items.Refresh();
            cbTipBusc.DisplayMemberPath = "Nombre";
            cbTipBusc.SelectedValuePath = "IdTipo";
            cbTipBusc.ItemsSource       = lu.Where(t => t.IdTipo == 1 || t.IdTipo == 2 || t.IdTipo == 3);;
            cbTipBusc.SelectedValue     = "1";
            cbTipBusc.Items.Refresh();
        }