Exemple #1
0
 private async void Tile_Click_1(object sender, RoutedEventArgs e)
 {
     if (texrut.Text != string.Empty)
     {
         try
         {
             Clientess clie = Menu.guar.First(c => c.Rut == texrut.Text);
             texrut.Text               = clie.Rut;
             texnombre.Text            = clie.Nombre_Contacto;
             texrazon.Text             = clie.Razón_Social;
             cbactividad.SelectedValue = clie.Actividad;
             textelefono.Text          = clie.Teléfono.ToString();
             texdireccion.Text         = clie.Dirección;
             texemail.Text             = clie.Mail_Contacto;
             cbemp.SelectedValue       = clie.tipo;
             mostrarListaBusqueda();
         }
         catch (System.Exception ex)
         {
             await this.ShowMessageAsync("Error", "Persona no encontrada");
         }
     }
     else
     {
         await this.ShowMessageAsync("Error", "Debe ingresar rut");
     }
 }
Exemple #2
0
        private async void Tile_Click(object sender, RoutedEventArgs e)
        {
            // Aca se crea el objeto cliente y se agregan
            Clientess clie = new Clientess();

            if (texrut.Text != "" && texnombre.Text != "" && texrazon.Text != "" &&
                textelefono.Text != "" && texdireccion.Text != "" && texemail.Text != "" && cbemp.SelectedIndex > 0 &&
                cbactividad.SelectedIndex > 0)
            {
                clie.Rut             = texrut.Text;
                clie.Nombre_Contacto = texnombre.Text;
                clie.Razón_Social    = texrazon.Text;
                clie.Actividad       = (ActividadEmpresa)cbactividad.SelectedValue;
                try
                {
                    clie.Teléfono      = int.Parse(textelefono.Text);
                    clie.Dirección     = texdireccion.Text;
                    clie.Mail_Contacto = texemail.Text;
                    clie.tipo          = (Tipo)cbemp.SelectedValue;
                    Menu.guar.Add(clie);
                    LimpiarText();
                    await this.ShowMessageAsync("Bien", "Persona registrada");

                    mostrarListaRegistro();
                }
                catch (FormatException ex)
                {
                    await this.ShowMessageAsync("Error", "Debes ingresar un dato numerico");
                }
            }
            else
            {
                await this.ShowMessageAsync("Error", "Faltan datos por completar");
            }
        }
Exemple #3
0
        private async void Tile_Click_3(object sender, RoutedEventArgs e)
        {
            try
            {
                Clientess clie = Menu.guar.First(c => c.Rut == texrut.Text);
                await this.ShowMessageAsync("", "Persona eliminada");

                Menu.guar.Remove(clie);
            }
            catch (System.Exception ex)
            {
                await this.ShowMessageAsync("Error", "Persona no encontrada");
            }
        }
Exemple #4
0
        private async void Tile_Click_2(object sender, RoutedEventArgs e)
        {
            try
            {
                Clientess clie = Menu.guar.First(c => c.Rut == texrut.Text);
                clie.Rut             = texrut.Text;
                clie.Nombre_Contacto = texnombre.Text;
                clie.Razón_Social    = texrazon.Text;
                clie.Actividad       = (ActividadEmpresa)cbactividad.SelectedValue;
                clie.Teléfono        = int.Parse(textelefono.Text);
                clie.Dirección       = texdireccion.Text;
                clie.Mail_Contacto   = texemail.Text;
                clie.tipo            = (Tipo)cbemp.SelectedValue;
                await this.ShowMessageAsync("", "Persona actualizada");

                LimpiarText();
            }
            catch (System.Exception ex)
            {
                await this.ShowMessageAsync("Error", "Persona no encontrada");
            }
        }