public Editpg(Estudiante estudent) { InitializeComponent(); this.estudent = estudent; actualizarButton.Clicked += actualizarButton_Clicked; borrarButton.Clicked += borrarButton_Clicked; nombresEntry.Text = estudent.Nombre; apellidosEntry.Text = estudent.Apellido; gradoEntry.Text = estudent.Grado; fechanacimientoDatePicker.Date = estudent.Fechana; activoSwitch.IsToggled = estudent.Activo; }
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()); }
public void UpdateEstudiante(Estudiante estudiante) { connec.Update(estudiante); }
public void InsertEstudiante(Estudiante estudiante) { connec.Insert(estudiante); }
public void DeleteEstudiante(Estudiante estudiante) { connec.Delete(estudiante); }