コード例 #1
0
        private async Task BusquedaClases()
        {
            resultado = "";
            try
            {
                if (ValidarCampos())
                {
                    SolicitudClase solicitudClase = ObtenerDatos();
                    ApiService     dataServices   = new ApiService();
                    listaClases = new ListaClases();

                    try
                    {
                        var result = await dataServices.GetClasesProgreso(solicitudClase);

                        if (result != null)
                        {
                            clase = result;
                        }
                    }
                    catch (Exception ex)
                    {
                        resultado = ex.Message.ToString();
                    }
                }
                else
                {
                    await DisplayAlert("Advertencia", msgError, "Aceptar");
                }
            }
            catch (Exception ex)
            {
                resultado = ex.Message.ToString();
            }
        }
コード例 #2
0
        public async Task <ClaseVM> GetClasesProgreso(SolicitudClase datos)
        {
            try
            {
                string        url      = "https://www.creativasoftlineapps.com/ScriptAppUnoMasCliente/frmGetClases.aspx";
                string        content  = JsonConvert.SerializeObject(datos);
                StringContent body     = new StringContent(content, Encoding.UTF8, "application/json");
                var           response = await Client.PostAsync(url, body);

                if (response.IsSuccessStatusCode)
                {
                    var json = await response.Content.ReadAsStringAsync();

                    if (json.Substring(0, 5) != "Error")
                    {
                        var resultado = (ClaseVM)JsonConvert.DeserializeObject(json, typeof(ClaseVM));
                        return(resultado);
                    }
                }
                return(null);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
 private SolicitudClase ObtenerDatos()
 {
     try
     {
         SolicitudClase solicitudClase = new SolicitudClase
         {
             id_entrenador = listaEntrenador.Entrenador[pckEntrenador.SelectedIndex].id_entrenador
                             // Fecha = dtpFecha.Date.ToString("yyyy-MM-dd")
         };
         return(solicitudClase);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }