예제 #1
0
        private async void bntModificarServidor_click(object sender, EventArgs e)
        {
            try
            {
                var fec1 = txtFechaNacimiento.Date;

                if (fec1 != fechanacimiento)
                {
                    fechaNac = fec1.ToString("yyyy/M/d");
                }
                else
                {
                    fechaNac = fechanacimiento.ToString("yyyy/M/d");
                }

                var fec2 = txtFechaIngreso.Date;

                if (fec2 != fechaingreso)
                {
                    fechaIng = fec2.ToString("yyyy/M/d");
                }
                else
                {
                    fechaIng = fechaingreso.ToString("yyyy/M/d");
                }

                var radioProp1 = txtRadioPropio.SelectedItem.ToString();

                if (radioProp1 != radiopropio)
                {
                    Radio = radioProp1;
                }
                else
                {
                    Radio = radiopropio;
                }

                UseManager manager = new UseManager();
                manager.modificarServidor(usuarioMod, txtNombre.Text.ToString(), txtApellido.Text.ToString(), txtDui.Text.ToString(),
                                          fechaNac, String.IsNullOrWhiteSpace(txtTelefono.Text) ? null : txtTelefono.Text.ToString(),
                                          String.IsNullOrWhiteSpace(txtLugarTrabajo.Text) ? null : txtLugarTrabajo.Text.ToString(),
                                          String.IsNullOrWhiteSpace(txtTelefonoTrabajo.Text) ? null : txtTelefonoTrabajo.Text.ToString(),
                                          String.IsNullOrWhiteSpace(txtContacto.Text) ? null : txtContacto.Text.ToString(),
                                          String.IsNullOrWhiteSpace(txtTelefonoContacto.Text) ? null : txtTelefonoContacto.Text.ToString(),
                                          fechaIng, Radio);

                await DisplayAlert("Modificacion", "Modificacion Exitosa", "Aceptar");

                txtNombre.Text           = "";
                txtApellido.Text         = "";
                txtDui.Text              = "";
                txtTelefono.Text         = "";
                txtLugarTrabajo.Text     = "";
                txtTelefonoTrabajo.Text  = "";
                txtContacto.Text         = "";
                txtTelefonoContacto.Text = "";

                await Navigation.PushAsync(new MenuUsuarios(servidor, acceso, usuario));
            } catch (Exception e1) {
                Console.WriteLine(e1.Message.ToString());
            }
        }