Beispiel #1
0
 private void btn_eliminar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //debemos rescatar la fila y la columna rut para luego utilizarla en el metodo
         int     fila = tbl_mantenedor.SelectedIndex;
         Boolean Eliminar;
         daoClienteCollection cl = new daoClienteCollection();
         //String rut = tbl_mantenedor.GetDetailsVisibilityForItem(fila).ToString();
         String           rut = tbl_mantenedor.ColumnFromDisplayIndex(0).GetCellContent(fila).ToString();
         MessageBoxResult respuesta;
         respuesta = MessageBox.Show("¿Desea continuar?", "Seleccione una Opcion", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (respuesta == MessageBoxResult.Yes)
         {
             Eliminar = cl.Eliminar(rut);
             if (Eliminar == true)
             {
                 MessageBox.Show("Cliente eliminado");
             }
             else
             {
                 MessageBox.Show("Cliente no se ha podido eliminar");
             }
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Error Eliminar");
         throw;
     }
 }
Beispiel #2
0
        private void btn_buscar_Click(object sender, RoutedEventArgs e)
        {
            //la logica seria la siguiente tomo el rut del buscar y desplego los datos en cada elemento , es decir les doy los valores a cada celda, luego aplico
            Cliente cli = new Cliente();

            cli.Rut = txt_buscar.Text;
            daoClienteCollection cl = new daoClienteCollection();
            String _rut             = cl.Buscar(cli.Rut).Columns.Contains("Rut").ToString();;

            txt_rut.Text = cli.Rut;
        }
Beispiel #3
0
 private void btn_Listar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         daoClienteCollection cl = new daoClienteCollection();
         tablita.Rows.Add(cl.Listar());
         tbl_mantenedor.IsItemItsOwnContainer(tablita);
     }
     catch (Exception)
     {
         MessageBox.Show("Error Listar");
     }
 }
Beispiel #4
0
 private void btn_buscar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Cliente cli = new Cliente();
         cli.Rut = txt_rut.Text;
         daoClienteCollection cl = new daoClienteCollection();
         tablita.Rows.Add(cl.Buscar(cli.Rut));
         tbl_mantenedor.IsItemItsOwnContainer(tablita);
     }
     catch (Exception)
     {
         MessageBox.Show("Error Buscar");
     }
 }
Beispiel #5
0
        private void btn_aceptar_Click(object sender, RoutedEventArgs e)
        {
            daoClienteCollection cl = new daoClienteCollection();


            String usuario     = txt_usuario.Text;
            String contrasenna = txt_pass.Text;
            var    contador    = 3;
            int    result      = cl.loggearse(usuario, contrasenna);

            if (result >= 1)
            {
                Inicio ventana = new Inicio();
                ventana.Show();
            }
            else
            {
                if (contador != 0)
                {
                    contador--;
                    MessageBox.Show("Le quedan " + contador + " intentos");
                }
            }
        }
Beispiel #6
0
        private void btn_actualizar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //revisar
                Cliente cli = new Cliente();

                cli.Nombre    = txt_nombre.Text;
                cli.Apellidos = txt_apellidos.Text;
                cli.FechaNaci = (DateTime)dpk_fechanaci.SelectedDate;
                string sexo   = cbo_sexo.SelectedValue.ToString();
                string estado = cbo_estado.SelectedValue.ToString();
                char   sex;
                char   estadoC;
                if (sexo == "Masculino")
                {
                    sex = 'M';
                }
                else
                {
                    if (sexo == "Femenino")
                    {
                        sex = 'F';
                    }
                    else
                    {
                        sex = 'O';
                    }
                }
                if (estado == "Soltero")
                {
                    estadoC = 'S';
                }
                else
                {
                    if (estado == "Casado")
                    {
                        estadoC = 'C';
                    }
                    else
                    {
                        if (estado == "Divorciado")
                        {
                            estadoC = 'D';
                        }
                        else
                        {
                            estadoC = 'V';
                        }
                    }
                }

                cli.Sexo   = sex;
                cli.Estado = estadoC;

                if (cli.Rut != "")
                {
                    daoClienteCollection cl = new daoClienteCollection();
                    bool resp = cl.Actualizar(cli, cli);
                    if (resp == true)
                    {
                        MessageBox.Show("Cliente Actualizado");
                    }
                    else
                    {
                        MessageBox.Show("No Ha Sido Posible Procesar Su Solicitud");
                    }
                }
                else
                {
                    MessageBox.Show("Debe ingresar todos los campos");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex);
            }
        }
Beispiel #7
0
        private void btnRegistrar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Cliente cli = new Cliente();
                cli.Rut       = txtRut.Text;
                cli.Nombre    = txtNombre.Text;
                cli.Apellidos = txtApellido.Text;
                cli.FechaNaci = (DateTime)dpkFechaN.SelectedDate;
                //ESTADO CIVIL
                if (cbo_ECivil.SelectedValue.Equals("Soltero"))
                {
                    cli.Estado = (char)'S';
                }
                else
                {
                    if (cbo_ECivil.SelectedValue.Equals("Casado"))
                    {
                        cli.Estado = (char)'C';
                    }
                    else
                    {
                        if (cbo_ECivil.SelectedValue.Equals("Viudo"))
                        {
                            cli.Estado = (char)'V';
                        }
                        else
                        {
                            if (cbo_ECivil.SelectedValue.Equals("Divorciado"))
                            {
                                cli.Estado = (char)'D';
                            }
                        }
                    }
                }
                //SEXO
                if (cbo_sexo.SelectedValue.Equals("Femenino"))
                {
                    cli.Sexo = 'F';
                }
                else
                {
                    if (cbo_sexo.SelectedValue.Equals("Masculino"))
                    {
                        cli.Sexo = 'M';
                    }
                    else
                    {
                        cli.Sexo = 'O';        //Otro
                    }
                }

                daoClienteCollection cl = new daoClienteCollection();
                bool resp = cl.Registrar(cli);
                if (resp == true)
                {
                    MessageBox.Show("Cliente Registrado");
                }
                else
                {
                    MessageBox.Show("No Ha Sido Posible Procesar Su Solicitud");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error");
            }
        }