Beispiel #1
0
        private void Win_eliminaruser_Loaded(object sender, RoutedEventArgs e)
        {
            usuarioBLL ub = new usuarioBLL();
            DataTable  dt = ub.AllUserList();

            dtg_eliminar.ItemsSource = dt.DefaultView;
        }
        private void Btn_listartodos_Click(object sender, RoutedEventArgs e)
        {
            cbb_listarusuarios.SelectedIndex = -1;
            txt_rut.Text = "";
            usuarioBLL ub = new usuarioBLL();

            System.Data.DataTable dt = ub.AllUserList();
            dtg_Usuarios.ItemsSource = dt.DefaultView;
            lb1.Content = "";
        }
Beispiel #3
0
        private void Btn_delete_Click(object sender, RoutedEventArgs e)
        {
            Generic gen = new Generic();

            gen.ACCION.Content    = "eliminar";
            gen.ACCION.Visibility = Visibility.Hidden;
            usuarioBLL us = new usuarioBLL();

            bool rute = true;

            if (txt_rut.Text.Trim() == "")
            {
                rute        = false;
                lb1.Content = "Ingrese un rut o seleccione el que desea desde la lista";
            }

            if (rute == true)
            {
                int  rut    = Int32.Parse(txt_rut.Text);
                bool existe = us.GetUserByRut(rut);
                if (existe)
                {
                    try
                    {
                        DataTable da     = us.userList(rut);
                        DataRow   row    = da.Rows[0];
                        string    rutt   = row[0].ToString();
                        string    Nombre = row[1].ToString() + " " + row[2].ToString();
                        string    rol    = row[4].ToString();
                        gen.lb_titulo.FontSize       = 18;
                        gen.lb_confirmacion.FontSize = 16;
                        gen.lb_contenido.FontSize    = 16;
                        gen.lb_titulo.Content        = "¿Desea deshabilitar a este usuario?";
                        gen.lb_confirmacion.Content  = "Al realizar esta accion, se deshabilitará al usuario:";
                        gen.lb_contenido.Content     = "Rut : " + rut + "\n" +
                                                       "Nombre: " + Nombre + "\n" +
                                                       "Rol: " + rol;
                        gen.Title = "Confirmación";
                        gen.btn_Cancelar.Content  = "Volver";
                        gen.btn_Confirmar.Content = "Eliminar";
                        gen.lb_rut.Content        = txt_rut.Text;
                        gen.Owner = this;
                        gen.ShowDialog();

                        usuarioBLL ub = new usuarioBLL();
                        DataTable  dt = ub.AllUserList();
                        dtg_eliminar.ItemsSource = dt.DefaultView;
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show("" + ex);
                    }
                }
                else
                {
                    lb1.Content = "El rut no esta ingresado en el sistema";
                }
            }
            else
            {
                lb1.Content = "Ingrese un rut o seleccione el que desea desde la lista";
            }
        }