示例#1
0
 private void llenarDatos(string rut)
 {
     try
     {
         Biblioteca.Anfitrion anf = new Biblioteca.Anfitrion()
         {
             Id_tributario = rut
         };
         if (anf.read())
         {
             txtRut.Text             = anf.Id_tributario;
             txtNombre.Text          = anf.Nombre;
             cb_ciudad.SelectedIndex = anf.Id_Ciudad - 1;
             txtAPaterno.Text        = anf.APaterno;
             txtAMaterno.Text        = anf.AMaterno;
             txt_direccion.Text      = anf.Direccion;
             txt_email.Text          = anf.Email;
             txt_tel_hogar.Text      = anf.Tel_hogar;
             txt_tel_movil.Text      = anf.Tel_movil;
             dp_fecha_nac.Text       = anf.Fecha_nac.ToString();
             txt_cupos.Text          = anf.Cupos_alojamiento.ToString();
         }
     }
     catch (Exception ex)
     {
         lblMsj.Content = "Error: " + ex;
     }
 }
 private void btnBuscar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Biblioteca.Anfitrion anf = new Biblioteca.Anfitrion()
         {
             Id_tributario = txtRut.Text
         };
         if (anf.read())
         {
             txtNombre.Text          = anf.Nombre;
             cb_ciudad.SelectedIndex = anf.Id_Ciudad - 1;
             txtAPaterno.Text        = anf.APaterno;
             txtAMaterno.Text        = anf.AMaterno;
             txt_direccion.Text      = anf.Direccion;
             txt_email.Text          = anf.Email;
             txt_tel_hogar.Text      = anf.Tel_hogar;
             txt_tel_movil.Text      = anf.Tel_movil;
             dp_fecha_nac.Text       = anf.Fecha_nac.ToString();
             txt_cupos.Text          = anf.Cupos_alojamiento.ToString();
             lblMsj.Content          = "Anfitrion Encontrado.";
         }
         else
         {
             lblMsj.Content = "Anfitrion No Encontrado.";
         }
     }
     catch (Exception ex)
     {
         lblMsj.Content = "Error: " + ex;
     }
 }
 private void btnBorrar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Biblioteca.Anfitrion anfitrion = new Biblioteca.Anfitrion()
         {
             Id_tributario       = txtRut.Text,
             Estado_antecedentes = "D",
             AMaterno            = txtAMaterno.Text,
             APaterno            = txtAPaterno.Text,
             Direccion           = txt_direccion.Text,
             Email              = txt_email.Text,
             Fecha_nac          = DateTime.Parse(dp_fecha_nac.Text),
             Id_Ciudad          = cb_ciudad.SelectedIndex + 1,
             Nombre             = txtNombre.Text,
             Tel_hogar          = txt_tel_hogar.Text,
             Tel_movil          = txt_tel_movil.Text,
             Fecha_antecedentes = DateTime.Now,
             Cupos_alojamiento  = Int32.Parse(txt_cupos.Text)
         };
         lblMsj.Content = anfitrion.crud(3);
     }
     catch (Exception ex)
     {
         lblMsj.Content = "Error: " + ex;
     }
 }
示例#4
0
 public List <Anfitrion> readTodos()
 {
     try
     {
         List <Datos.ANFITRION> listaAnfitrion = null;
         listaAnfitrion = CommonBC.ModeloCEM.ANFITRION.Select(a => a).ToList();
         if (listaAnfitrion != null)
         {
             List <Anfitrion> list = new List <Anfitrion>();
             foreach (var item in listaAnfitrion)
             {
                 Anfitrion anf = new Anfitrion()
                 {
                     Id_tributario       = item.ID_TRIBUTARIO,
                     Id_anfitrion        = (int)item.ID_ANFITRION,
                     Nombre              = item.NOMBRES_RESPONSABLE,
                     APaterno            = item.A_PATERNO_RESPONSABLE,
                     AMaterno            = item.A_MATERNO_RESPONSABLE,
                     Fecha_nac           = item.FECHA_NAC,
                     Tel_movil           = item.TELEFONO_MOVIL,
                     Tel_hogar           = item.TELEFONO_HOGAR,
                     Email               = item.EMAIL,
                     Direccion           = item.DIRECCION,
                     Estado_antecedentes = item.ESTADO_ANTECEDENTES,
                     Cupos_alojamiento   = (int)item.CUPOS_ALOJAMIENTO,
                     Fecha_antecedentes  = item.FECHA_ANTECEDENTES,
                     Id_Ciudad           = (int)item.ID_CIUDAD,
                 };
                 list.Add(anf);
             }
             return(list);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
 private void btnCrear_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!(String.IsNullOrEmpty(txtRut.Text) || String.IsNullOrEmpty(txtNombre.Text) || String.IsNullOrEmpty(txtAPaterno.Text) || String.IsNullOrEmpty(txtAMaterno.Text) ||
               String.IsNullOrEmpty(txt_cupos.Text) || String.IsNullOrEmpty(txt_tel_movil.Text) || String.IsNullOrEmpty(txt_tel_hogar.Text) || String.IsNullOrEmpty(txt_email.Text) ||
               String.IsNullOrEmpty(txt_direccion.Text)))
         {
             if (!Validaciones.validarRut(txtRut.Text))
             {
                 lblMsj.Content = "Rut Invalido";
                 return;
             }
             Biblioteca.Anfitrion anf = new Biblioteca.Anfitrion()
             {
                 Id_tributario       = txtRut.Text,
                 Estado_antecedentes = "A",
                 AMaterno            = txtAMaterno.Text,
                 APaterno            = txtAPaterno.Text,
                 Direccion           = txt_direccion.Text,
                 Email              = txt_email.Text,
                 Fecha_nac          = DateTime.Parse(dp_fecha_nac.Text),
                 Id_Ciudad          = cb_ciudad.SelectedIndex + 1,
                 Nombre             = txtNombre.Text,
                 Tel_hogar          = txt_tel_hogar.Text,
                 Tel_movil          = txt_tel_movil.Text,
                 Fecha_antecedentes = DateTime.Now,
                 Cupos_alojamiento  = Int32.Parse(txt_cupos.Text)
             };
             lblMsj.Content = anf.crud(1);
         }
         else
         {
             lblMsj.Content = "Llene todos los campos.";
         }
     }
     catch (Exception ex)
     {
         lblMsj.Content = "Error: " + ex;
     }
 }