public async Task <ActionResult> RelacionesInterpersonales(int?IdParticipante)
        {
            Ekilibrate.Model.Entity.Participante.clsExpedienteRelacionesInterpersonales model = new Ekilibrate.Model.Entity.Participante.clsExpedienteRelacionesInterpersonales();
            Ekilibrate.Model.Entity.Participante.clsExpedienteFiltro Filtro = new Ekilibrate.Model.Entity.Participante.clsExpedienteFiltro();
            BarcoSoftUtilidades.Seguridad.Usuario user = this.HttpContext.GetActualUser();
            Filtro.ID_PARTICIPANTE = user.IdPersona;
            using (var scope = EkilibrateUI.Autofac.ContainerConfig.ProxyContainer.BeginLifetimeScope())
            {
                var middleTier = scope.Resolve <Ekilibrate.Model.Services.Participante.IDataRetriever>();
                model = await middleTier.GetExpedienteRelacionesInterpersonales(Filtro);
            }

            return(PartialView(model));
        }
Example #2
0
        public async Task <Ekilibrate.Model.Entity.Participante.clsExpedienteRelacionesInterpersonales> GetRelacionesInterpersonales(Ekilibrate.Model.Entity.Participante.clsExpedienteFiltro Filtro)
        {
            var p = new DynamicParameters();

            p.Add("IdParticipante", Filtro.ID_PARTICIPANTE, System.Data.DbType.Int32);
            var Res = await Get <Ekilibrate.Model.Entity.Participante.clsExpedienteRelacionesInterpersonales>(p, QExpediente.GetRelacionesInterpersonales);

            if (Res != null && Res.Count() > 0)
            {
                return(Res.FirstOrDefault());
            }
            return(new Model.Entity.Participante.clsExpedienteRelacionesInterpersonales());
        }
Example #3
0
        public async Task <Ekilibrate.Model.Entity.Participante.clsExpedienteEstadoSalud> GetEstadoSalud(Ekilibrate.Model.Entity.Participante.clsExpedienteFiltro Filtro)
        {
            var p = new DynamicParameters();

            p.Add("IdParticipante", Filtro.ID_PARTICIPANTE, System.Data.DbType.Int32);
            var Res = await Get <Ekilibrate.Model.Entity.Participante.clsExpedienteEstadoSalud>(p, QExpediente.GetEstadoSalud);

            if (Res != null && Res.Count() > 0)
            {
                var result = Res.FirstOrDefault();
                result.FactoresRiesgo          = new List <string>();
                result.CondicionesPrexistentes = new List <string>();
                if (result.Bebe)
                {
                    result.FactoresRiesgo.Add("Beber");
                }
                if (result.Fuma)
                {
                    result.FactoresRiesgo.Add("Fumar");
                }
                var enfermedades = await Get <string>(p, QExpediente.Efermedades);

                if (enfermedades != null && enfermedades.Count() > 0)
                {
                    result.FactoresRiesgo.AddRange(enfermedades);
                }
                var preexistentes = await Get <string>(p, QExpediente.CondicionesPreexistentes);

                if (preexistentes != null && preexistentes.Count() > 0)
                {
                    result.CondicionesPrexistentes.AddRange(preexistentes);
                }
                return(result);
            }
            return(new Model.Entity.Participante.clsExpedienteEstadoSalud());
        }
        public async Task <ActionResult> Index()
        {
            //return View();
            Ekilibrate.Model.Entity.Participante.ResumenExpediente   model  = new Ekilibrate.Model.Entity.Participante.ResumenExpediente();
            Ekilibrate.Model.Entity.Participante.clsExpedienteFiltro Filtro = new Ekilibrate.Model.Entity.Participante.clsExpedienteFiltro();

            BarcoSoftUtilidades.Seguridad.Usuario user = this.HttpContext.GetActualUser();

            if (user == null)
            {
                return(Redirect("~/SitioAdministrativo/Home/Login?ReturnUrl=%2fParticipante%2fExpediente"));
            }

            using (var scope = EkilibrateUI.Autofac.ContainerConfig.ProxyContainer.BeginLifetimeScope())
            {
                //1. Resumen
                var middleTier = scope.Resolve <Ekilibrate.Model.Services.Participante.IDataRetriever>();
                model = await middleTier.GetResumenExpediente(user.IdPersona);

                model.REDgeneral = model.VET - model.RED;

                //2. Pasos
                List <String> TitleList      = new List <String>();
                List <Int32>  MetaList       = new List <Int32>();
                List <Int32>  PasosList      = new List <Int32>();
                List <Int32>  MetaCompaList  = new List <Int32>();
                List <Int32>  PasosCompaList = new List <Int32>();

                var Pasos = await middleTier.GetPasosDia(user.IdPersona);

                if (Pasos.Count() > 0)
                {
                    var compa = Pasos.FirstOrDefault();
                    ViewBag.NombreCompa = compa.NombreCompa;
                    ViewBag.IdCompa     = compa.IdCompa;

                    ViewBag.FechaInicio = compa.FechaInicio;
                    ViewBag.FechaFin    = compa.FechaFin;
                }
                else
                {
                    ViewBag.NombreCompa = string.Empty;
                    ViewBag.IdCompa     = 0;
                }

                //List<Ekilibrate.Model.Entity.Participante.clsPasosDiaBase> lresult = (List<Ekilibrate.Model.Entity.Participante.clsPasosDiaBase>)Result;

                Pasos.OrderBy(y => y.Dia).ToList().ForEach(x =>
                {
                    TitleList.Add(x.NombreDia);
                    MetaList.Add(x.Meta);
                    PasosList.Add(x.Caminados);
                    MetaCompaList.Add(x.MetaCompa);
                    PasosCompaList.Add(x.CaminadosCompa);
                });

                ViewBag.TitleList      = TitleList;
                ViewBag.MetaList       = MetaList;
                ViewBag.PasosList      = PasosList;
                ViewBag.MetaCompaList  = MetaCompaList;
                ViewBag.PasosCompaList = PasosCompaList;

                if (MetaList.Count > 0)
                {
                    ViewBag.MaxMeta      = MetaList.Max();
                    ViewBag.AvgMeta      = MetaList.Average();
                    ViewBag.MaxMetaCompa = MetaCompaList.Max();
                    ViewBag.AvgMetaCompa = MetaCompaList.Average();
                }
                else
                {
                    ViewBag.MaxMeta      = 0;
                    ViewBag.AvgMeta      = 0;
                    ViewBag.MaxMetaCompa = 0;
                    ViewBag.AvgMetaCompa = 0;
                }

                if (PasosList.Count > 0)
                {
                    ViewBag.AvgPasos        = PasosList.Average();
                    ViewBag.CountPasos      = PasosList.Sum();
                    ViewBag.AvgPasosCompa   = PasosCompaList.Average();
                    ViewBag.CountPasosCompa = PasosCompaList.Sum();
                }
                else
                {
                    ViewBag.AvgPasos        = 0;
                    ViewBag.CountPasos      = 0;
                    ViewBag.AvgCompaPasos   = 0;
                    ViewBag.CountCompaPasos = 0;
                }

                ViewBag.Pasos = Pasos;

                //3. Alimentacion
                List <String>  ATitleList = new List <String>();
                List <Decimal> AMetaList  = new List <Decimal>();
                List <Decimal> ComidoList = new List <Decimal>();

                Ekilibrate.Model.Entity.Participante.clsAlimentacionDiaFiltro objFiltro = new Ekilibrate.Model.Entity.Participante.clsAlimentacionDiaFiltro();
                objFiltro.ParticipanteId = user.IdPersona;
                var Alimentacion = await middleTier.GetAlimentacionDia(objFiltro);

                //Estos datos quedan quemados de acuerdo a lo que platicamos que estos calculo los haria un servicio que programarias.
                Alimentacion.OrderBy(y => y.Dia).ToList().ForEach(x =>
                {
                    ATitleList.Add(x.NombreDia);
                    AMetaList.Add(x.Meta);
                    ComidoList.Add(x.Comido);
                });

                ViewBag.AMetaList  = AMetaList;
                ViewBag.ComidoList = ComidoList;
                ViewBag.MaxAMeta   = AMetaList.Max();
                ViewBag.AvgAMeta   = AMetaList.Average();
                ViewBag.AvgComidos = ComidoList.Average();

                //6. Crecimiento Personal
                ViewBag.ModelCP = await middleTier.GetExpedienteCrecimientoPersonal(user.IdPersona);

                //7. Cuadro de metas
                var middleTierNut = scope.Resolve <Ekilibrate.Model.Services.Nutricionista.IDataRetriever>();
                var resultSeg     = await middleTierNut.GetSeguimientoActual(user.IdPersona);

                resultSeg.ReadOnly = true;
                ViewBag.ModelSeg   = resultSeg;

                //8. Plan de Alimentacion
                var Plan = await middleTierNut.GetPlanAlimentacion(resultSeg.CitaId, resultSeg.ParticipanteId);

                Plan.ReadOnly     = true;
                ViewBag.ModelPlan = Plan;
            }

            return(PartialView(model));
        }