Esempio n. 1
0
        private clsAgenda getobjAgenda(Object varjson)
        {
            clsAgenda obj  = new clsAgenda();
            JObject   json = (JObject)varjson;

            obj.mes        = Int32.Parse(json["mes"].ToString());
            obj.comentario = "";

            List <clsEventoAgenda> lste = new List <clsEventoAgenda>();
            JArray jrarray;

            try
            {
                var jsoneventos = JArray.Parse(json["eventos"].ToString());
                jrarray = jsoneventos;
            }
            catch (Exception e) {
                Console.WriteLine(e.ToString());
                jrarray = null;
            }

            if (jrarray != null)
            {
                foreach (var ev in jrarray)
                {
                    clsEventoAgenda e      = new clsEventoAgenda();
                    JObject         jsonev = (JObject)ev;
                    e.idevento   = Int32.Parse(jsonev["idevento"].ToString());
                    e.dia        = Int32.Parse(jsonev["dia"].ToString());
                    e.comentario = jsonev["titulo"].ToString();
                    e.lapso      = jsonev["lapso"].ToString();
                    lste.Add(e);
                }
            }

            obj.lstEventos = lste;
            return(obj);
        }
Esempio n. 2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            if (isChild(indexPath))
            {
                int indicesubarreglo = indexPath.Row - (currentExpandedIndex + 1);

                var cell = tableView.DequeueReusableCell(celdahija) as CustomAgendaCell;

                if (cell == null)
                {
                    cell = new CustomAgendaCell((NSString)celdahija);
                }


                clsAgenda objagenda = LstDatosAgenda.ElementAt(currentExpandedIndex);



                clsEventoAgenda objev         = objagenda.lstEventos.ElementAt(indicesubarreglo);
                String          strComentario = objev.comentario;
                String          strLapso      = objev.lapso;

                UIImage imgFecha = UIImage.FromFile("calendario/schedule_" + objev.dia + ".png");
                cell.UpdateCell(strComentario, strLapso, imgFecha);


                cell.Accessory = UITableViewCellAccessory.None;



                return(cell);
            }
            else
            {
                int indicearreglo = indexPath.Row;

                if (currentExpandedIndex > -1 && indexPath.Row > currentExpandedIndex)
                {
                    indicearreglo -= LstDatosAgenda.ElementAt(currentExpandedIndex).lstEventos.Count;
                }

                Boolean blnTieneEventos = false;
                if (LstDatosAgenda.ElementAt(indicearreglo).lstEventos.Count > 0)
                {
                    blnTieneEventos = true;
                }

                clsAgenda objagenda = LstDatosAgenda.ElementAt(indicearreglo);
                var       cell      = tableView.DequeueReusableCell(celdapadre) as CustomPadreAgendaCell;

                if (cell == null)
                {
                    cell = new CustomPadreAgendaCell((NSString)ChildCellIndentifier, funciones.getColorMes(objagenda.mes));
                }

                UIImage img = null;
                if (blnTieneEventos)
                {
                    img = UIImage.FromFile("more.png");
                }

                cell.UpdateCell(funciones.getNombreMes(objagenda.mes), img);

                return(cell);
            }
        }