public clsEvento getObjEvento(Object varjson) { JObject json = (JObject)varjson; clsEvento obj = new clsEvento { idtarea = Int32.Parse(json["idtarea"].ToString()), titulo = json["titulo"].ToString(), totalhoras = json["horas"].ToString(), lapso = json["lapso"].ToString(), porcentajeavance = double.Parse(json["porcentaje"].ToString()) }; return(obj); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { int indicearreglo = indexPath.Row; UITableViewCell cell; clsEvento objev = lstEventos.ElementAt(indicearreglo); string idcell = celdaEventos + objev.idtarea.ToString() + objev.porcentajeavance.ToString(); cell = tableView.DequeueReusableCell(idcell) as CustomEventosCell; if (cell == null) { cell = new CustomEventosCell((NSString)idcell, objev.porcentajeavance); } String totalhoras = "Hrs.: " + objev.totalhoras; ((CustomEventosCell)cell).UpdateCell(objev.titulo, totalhoras, objev.lapso); return(cell); }
public async Task <Boolean> searchTareas() { var bounds = UIScreen.MainScreen.Bounds; loadPop = new LoadingOverlay(bounds, "Buscando Tareas..."); View.Add(loadPop); client = new HttpClient(); client.Timeout = new System.TimeSpan(0, 0, 0, 10, 0); string url = Consts.ulrserv + "controldeobras/busquedaTareasPlanificador"; var uri = new Uri(string.Format(url)); Dictionary <string, string> pet = new Dictionary <string, string>(); pet.Add("idcategoria", idcategoria.ToString()); pet.Add("strBusqueda", idcategoria.ToString()); var json = JsonConvert.SerializeObject(pet); string responseString = string.Empty; responseString = await funciones.llamadaRest(client, uri, loadPop, json, Consts.token); if (responseString.Equals("-1") || responseString.Equals("-2")) { funciones.SalirSesion(this); } JArray jrarray; try { var objectjson = JObject.Parse(responseString); var result = objectjson["result"]; if (result != null) { loadPop.Hide(); if (result.ToString().Equals("0")) { funciones.MessageBox("Aviso", "No se encontraron coincidencias "); } else { funciones.MessageBox("Error", objectjson["error"].ToString()); } return(false); } jrarray = JArray.Parse(objectjson["tareas"].ToString()); } catch (Exception e) { loadPop.Hide(); var jsonresponse = JObject.Parse(responseString); string mensaje = "al transformar el arreglo" + e.HResult; var jtokenerror = jsonresponse["error"]; if (jtokenerror != null) { mensaje = jtokenerror.ToString(); } funciones.MessageBox("Error", mensaje); return(false); } foreach (var tar in jrarray) { clsEvento objev = getObjEvento(tar); lstEventos.Add(objev); } loadPop.Hide(); return(true); }