//se inicializan los componentes de otra forma solo aprecera una ventana en blanco public void Guardar() { if (txtNombre.Text == "") { System.Windows.MessageBox.Show("Inserta el nombre de la Clasificacion"); } else { DateTime fec = DateTime.Now; CLASIFICACION_ESTUDIOS cestudios = new CLASIFICACION_ESTUDIOS { NOMBRE = txtNombre.Text, FECHA_CREACION = fec }; BaseDatos.GetBaseDatos().CLASIFICACION_ESTUDIOS.Add(cestudios); BaseDatos.GetBaseDatos().SaveChanges(); //BaseDatos.GetBaseDatos().SaveChangesAsync(); System.Windows.MessageBox.Show("Se ha guardado CORRECTAMENTE"); txtNombre.Text = String.Empty; //antes de cerrar la ventana de edicion para una nueva clasificacion se declara de nueva cuenta el //autocomplete para actualizar sus valores autoClasifica.ItemsSource = BaseDatos.GetBaseDatos().CLASIFICACION_ESTUDIOS.ToList(); //-------------- this.Close(); } }
public NuevoEstudio(CATALOGO_ESTUDIOS ces, CLASIFICACION_ESTUDIOS claes, bool save) { InitializeComponent(); AutoClasifica.ItemsSource = BaseDatos.GetBaseDatos().CLASIFICACION_ESTUDIOS.ToList(); idestudi = ces.CATALOGO_ESTUDIO_ID; idclasi = claes.CLASIFICACIONID; txtNombre.Text = ces.NOMBRE; txtDescripcion.Text = ces.DESCRIPCION; txtCosto.Text = ces.COSTO.ToString(); AutoClasifica.SearchText = claes.NOMBRE; btnEditar.Visibility = Visibility.Visible; btnGuardar.Visibility = Visibility.Hidden; }