public async void borrarButton_Clicked(object sender, EventArgs e) { var rta = await DisplayAlert("Confirmación", "¿Desea borrar el estudiante?", "Si", "No"); if (!rta) return; using (var datos = new DateAccess()) { datos.DeleteEstudiante(estudent); } await DisplayAlert("Confirmación", "Estudiante eliminado correctamente", "Aceptar"); await Navigation.PushAsync(new Homepg()); }
public Homepg() { InitializeComponent(); nuevoButton.Clicked += nuevoButton_Clicked; datosListView.ItemSelected += datosListView_ItemSelected; datosListView.ItemTemplate = new DataTemplate(typeof(Estudiantecll)); using (var datos = new DateAccess()) { datosListView.ItemsSource = datos.GetEstudents(); } }
public async void nuevoButton_Clicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(nombresEntry.Text)) { await DisplayAlert("Error", "Debe ingresar nombres", "Aceptar"); nombresEntry.Focus(); return; } if (string.IsNullOrWhiteSpace(apellidosEntry.Text)) { await DisplayAlert("Error", "Debe ingresar apellidos", "Aceptar"); apellidosEntry.Focus(); return; } if (string.IsNullOrEmpty(gradoEntry.Text)) { await DisplayAlert("Error", "Debe ingresar Grado", "aceptar"); gradoEntry.Focus(); return; } Estudiante estudent = new Estudiante { Activo = activoSwitch.IsToggled, Apellido = apellidosEntry.Text, Fechana = fechanacimientoDatePicker.Date, Nombre = nombresEntry.Text, Grado = gradoEntry.Text, }; using (var datos = new DateAccess()) { datos.InsertEstudiante(estudent); datosListView.ItemsSource = datos.GetEstudents(); } apellidosEntry.Text = String.Empty; fechanacimientoDatePicker.Date = DateTime.Now; nombresEntry.Text = String.Empty; nombresEntry.Text = String.Empty; await DisplayAlert("Mensaje", "estudiante creado correctamente", "Aceptar"); }
public async void actualizarButton_Clicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(nombresEntry.Text)) { await DisplayAlert("Error", "Debe ingresar nombres", "Aceptar"); nombresEntry.Focus(); return; } if (string.IsNullOrWhiteSpace(apellidosEntry.Text)) { await DisplayAlert("Error", "Debe ingresar apellidos", "Aceptar"); apellidosEntry.Focus(); return; } if (string.IsNullOrEmpty(gradoEntry.Text)) { await DisplayAlert("Error", "Debe ingresar salario", "aceptar"); gradoEntry.Focus(); return; } Estudiante estu = new Estudiante { IDestudiante = this.estudent.IDestudiante, Activo = activoSwitch.IsToggled, Apellido = apellidosEntry.Text, Fechana = fechanacimientoDatePicker.Date, Nombre = nombresEntry.Text, Grado = gradoEntry.Text, }; using (var datos = new DateAccess()) { datos.UpdateEstudiante(estu); } await DisplayAlert("Confirmación", "Estudiante actualizado correctamente", "Aceptar"); await Navigation.PushAsync(new Homepg()); }