Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
 public void UpdateEstudiante(Estudiante estudiante)
 {
     connec.Update(estudiante);
 }
Exemplo n.º 5
0
 public void InsertEstudiante(Estudiante estudiante)
 {
     connec.Insert(estudiante);
 }
Exemplo n.º 6
0
 public void DeleteEstudiante(Estudiante estudiante)
 {
     connec.Delete(estudiante);
 }