Ejemplo n.º 1
0
        private async void BtnAgregarConVida_Click(object sender, RoutedEventArgs e)
        {
            var metroWindow = (Application.Current.MainWindow as MetroWindow);

            try
            {
                BelifeLibrary.Plan        pl     = new BelifeLibrary.Plan();
                List <BelifeLibrary.Plan> Planes = new List <BelifeLibrary.Plan>();
                Planes = pl.ReadAll();



                BelifeLibrary.Contrato con = new BelifeLibrary.Contrato();
                BelifeLibrary.Cliente  cli = new BelifeLibrary.Cliente();
                cli.Rut = TxtRut.Text;
                cli.Read();


                con.PlanAsociado        = pl;
                con.FechaInicioVigencia = (DateTime)DtFechaVigencia.SelectedDate;
                con.Observaciones       = TxtObservaciones.Text;
                if (con.Create())
                {
                    await metroWindow.ShowMessageAsync("Agregar Contrato", "El contrato fue añadido exitosamente");
                }
            }
            catch (Exception er)
            {
                await metroWindow.ShowMessageAsync("Error!!", er.Message);
            }
        }