private void BtnAgregarConVeh_Click(object sender, RoutedEventArgs e) { BelifeLibrary.Cliente cli = new BelifeLibrary.Cliente(); cli.Rut = TxtRut.Text; cli.Read(); BelifeLibrary.Contrato con = new BelifeLibrary.Contrato(); con.Titular = cli; BelifeLibrary.Plan pl = new BelifeLibrary.Plan(); pl.ReadAllByVehiculo(); con.PlanAsociado = pl; con.FechaInicioVigencia = (DateTime)DtFechaVigencia.SelectedDate; }
private void ComboTipoContratos_SelectionChanged(object sender, SelectionChangedEventArgs e) { List <BelifeLibrary.Plan> Planes = new List <BelifeLibrary.Plan>(); List <String> desc = new List <string>(); BelifeLibrary.Plan pl = new BelifeLibrary.Plan(); if (ComboTipoContratos.SelectedIndex == 0) { this.GridSalud.Visibility = System.Windows.Visibility.Visible; this.GridVehiculo.Visibility = System.Windows.Visibility.Hidden; this.GridVivienda.Visibility = System.Windows.Visibility.Hidden; Planes = pl.ReadAllByVida(); } else if (ComboTipoContratos.SelectedIndex == 1) { this.GridVehiculo.Visibility = System.Windows.Visibility.Visible; this.GridSalud.Visibility = System.Windows.Visibility.Hidden; this.GridVivienda.Visibility = System.Windows.Visibility.Hidden; Planes = pl.ReadAllByVehiculo(); } else if (ComboTipoContratos.SelectedIndex == 2) { this.GridVivienda.Visibility = System.Windows.Visibility.Visible; this.GridSalud.Visibility = System.Windows.Visibility.Hidden; this.GridVehiculo.Visibility = System.Windows.Visibility.Hidden; Planes = pl.ReadAllByHogar(); } if (ComboTipoContratos.SelectedIndex != -1) { foreach (var x in Planes) { desc.Add(x.Nombre); } ComboPlanes.ItemsSource = desc; } else { ComboPlanes.ItemsSource = null; } }