public List <PasantiasPreProfesionales> SeleccionarPasantiasActivas()
 {
     try
     {
         using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Proceso))
         {
             EntityList <ListaPasantiasElemento> pasantias = context.GetList <ListaPasantiasElemento>(Properties.UdlaListDefinitions.Default.Lista_Pasantias);
             List <ListaPasantiasElemento>       data      = new List <ListaPasantiasElemento>();
             data = pasantias.Where(x => x.Estado != Constants.Properties.Flujo.Default.CANCELADO &&
                                    x.Estado != Constants.Properties.Flujo.Default.FINALIZACION).ToList();
             if (data != null)
             {
                 List <PasantiasPreProfesionales> pasantiasItems = new List <PasantiasPreProfesionales>();
                 data.ForEach(x => pasantiasItems.Add(MappeoMoss(x)));
                 return(pasantiasItems);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.ExLogger(ex);
         throw ex;
     }
     return(null);
 }
        public List <PasantiasPreProfesionales> SeleccionarPasantiasConProblemaSAES(int startRowIndex, int maximumRows, string estado, out int itemsCount)
        {
            try
            {
                using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Proceso))
                {
                    EntityList <ListaPasantiasElemento> pasantias = context.GetList <ListaPasantiasElemento>(Properties.UdlaListDefinitions.Default.Lista_Pasantias);
                    List <ListaPasantiasElemento>       itemsData = new List <ListaPasantiasElemento>();
                    itemsData = pasantias.Where(x => x.Estado != Constants.Properties.Flujo.Default.CANCELADO &&
                                                x.Estado != Constants.Properties.Flujo.Default.FINALIZACION &&
                                                x.ProblemaEnElSistemaSAES == true).ToList();

                    itemsCount = itemsData.Count;
                    var data = itemsData.Skip(startRowIndex * maximumRows).Take(maximumRows);

                    if (data != null)
                    {
                        List <PasantiasPreProfesionales> pasantiasItems = new List <PasantiasPreProfesionales>();
                        data.ToList().ForEach(x => pasantiasItems.Add(MappeoMoss(x)));
                        return(pasantiasItems);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.ExLogger(ex);
                throw ex;
            }
            return(null);
        }
 public List <PasantiasPreProfesionales> SeleccionarAlumnosParaEmpresa(string estado)
 {
     try
     {
         using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Sitio))
         {
             EntityList <ListaPasantiasElemento> pasantias = context.GetList <ListaPasantiasElemento>(Properties.UdlaListDefinitions.Default.Lista_Pasantias);
             List <ListaPasantiasElemento>       data      = new List <ListaPasantiasElemento>();
             data = pasantias.Where(x => x.Estado == estado &&
                                    (x.SupervisorDeEmpresaIdentificador == SPContext.Current.Web.CurrentUser.ID)).ToList();
             if (data != null)
             {
                 List <PasantiasPreProfesionales> pasantiasItems = new List <PasantiasPreProfesionales>();
                 data.ForEach(x => pasantiasItems.Add(MappeoMoss(x)));
                 return(pasantiasItems);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.ExLogger(ex);
         throw ex;
     }
     return(null);
 }
 public Actividades SeleccionarPorId(int id)
 {
     using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Sitio))
     {
         EntityList <ListaDeActividadesPorEstudianteElemento> actividades = context.GetList <ListaDeActividadesPorEstudianteElemento>(Properties.UdlaListDefinitions.Default.Lista_Actividades);
         var data = actividades.Where(x => x.Identificador == id).Take(1).ToList().First();;
         if (data != null)
         {
             return(MappeoMoss(data));
         }
     }
     return(null);
 }
Example #5
0
        public Visitas SeleccionarPorId(int id)
        {
            using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Sitio))
            {
                EntityList <ListaVisitasElemento> visitas = context.GetList <ListaVisitasElemento>(Properties.UdlaListDefinitions.Default.Lista_Visitas);
                var data = visitas.Where(x => x.Identificador == id).Take(1).ToList().First();;


                if (data != null)
                {
                    return(MappeoMoss(data));
                }
            }
            return(null);
        }
        public bool Insertar(PasantiasPreProfesionales item, out int?id)
        {
            bool   result = false;
            int?   auxId  = 0;
            string strUrl = Properties.UdlaListDefinitions.Default.Url_Sitio;

            try
            {
                if (SPContext.Current != null)
                {
                    HttpContext.Current = null;
                }
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (SPSite oSite = new SPSite(strUrl))
                    {
                        using (SPWeb oWeb = oSite.OpenWeb())
                        {
                            HttpRequest httpRequest = new HttpRequest("", oWeb.Url, "");
                            HttpContext.Current     = new HttpContext(httpRequest, new HttpResponse(new System.IO.StringWriter()));
                            SPControl.SetContextWeb(HttpContext.Current, oWeb);
                            using (UdlaEntityDataContext context = new UdlaEntityDataContext(oWeb.Url))
                            {
                                EntityList <ListaPasantiasElemento> pasantias = context.GetList <ListaPasantiasElemento>(Properties.UdlaListDefinitions.Default.Lista_Pasantias);
                                var itemBase = MappeoMoss(item);
                                pasantias.InsertOnSubmit(itemBase);
                                context.SubmitChanges();
                                itemBase.Accion = string.Format(itemBase.Accion, itemBase.Identificador);
                                itemBase.Título = string.Format(itemBase.Título, itemBase.Identificador);
                                context.SubmitChanges();

                                auxId  = itemBase.Identificador;
                                result = true;
                            }
                        }
                    }
                }
                                                     );
            }
            catch (Exception ex)
            {
                auxId = 0;
                Logger.ExLogger(ex);
                throw ex;
            }
            id = auxId;
            return(result);
        }
        public PasantiasPreProfesionales Actualizar(PasantiasPreProfesionales item)
        {
            string strUrl = Properties.UdlaListDefinitions.Default.Url_Sitio;
            ListaPasantiasElemento    pasantiasBase = null;
            PasantiasPreProfesionales pasantiaFinal = null;
            HttpContext backupCtxt = HttpContext.Current;

            try
            {
                if (SPContext.Current != null)
                {
                    HttpContext.Current = null;
                }
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (SPSite oSite = new SPSite(strUrl))
                    {
                        using (SPWeb oWeb = oSite.OpenWeb())
                        {
                            HttpRequest httpRequest = new HttpRequest("", oWeb.Url, "");
                            HttpContext.Current     = new HttpContext(httpRequest, new HttpResponse(new System.IO.StringWriter()));
                            SPControl.SetContextWeb(HttpContext.Current, oWeb);
                            using (UdlaEntityDataContext context = new UdlaEntityDataContext(oWeb.Url))
                            {
                                EntityList <ListaPasantiasElemento> pasantias = context.GetList <ListaPasantiasElemento>(Properties.UdlaListDefinitions.Default.Lista_Pasantias);
                                pasantiasBase = pasantias.Where(x => x.Identificador == item.Id).Take(1).ToList().First();;
                                if (pasantiasBase != null)
                                {
                                    pasantiasBase = MappeoMoss(item, pasantiasBase);
                                    context.SubmitChanges();
                                    pasantiaFinal = MappeoMoss(pasantiasBase);
                                }
                            }
                        }
                    }
                }
                                                     );
            }
            catch (Exception ex)
            {
                Logger.ExLogger(ex);
                throw ex;
            }
            return(pasantiaFinal);
        }
        public List <PasantiasPreProfesionales> SeleccionarPreCancelados(int startRowIndex, int maximumRows, out int itemsCount, string cancelado)
        {
            itemsCount = 0;

            using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Sitio))
            {
                EntityList <ListaPasantiasElemento> pasantias = context.GetList <ListaPasantiasElemento>(Properties.UdlaListDefinitions.Default.Lista_Pasantias);
                var itemsData = pasantias.Where(x => x.ProblemaEnElSistemaSAES == true && x.Estado != cancelado);
                itemsCount = itemsData.Count();
                var data = itemsData.Skip(startRowIndex * maximumRows).Take(maximumRows);
                if (data != null)
                {
                    List <PasantiasPreProfesionales> pasantiasItems = new List <PasantiasPreProfesionales>();
                    data.ToList().ForEach(x => pasantiasItems.Add(MappeoMoss(x)));
                    return(pasantiasItems);
                }
            }
            return(null);
        }
Example #9
0
        public Visitas Actualizar(Visitas item)
        {
            Visitas visita = null;
            string  strUrl = Properties.UdlaListDefinitions.Default.Url_Sitio;

            try
            {
                if (SPContext.Current != null)
                {
                    HttpContext.Current = null;
                }
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (SPSite oSite = new SPSite(strUrl))
                    {
                        using (SPWeb oWeb = oSite.OpenWeb())
                        {
                            HttpRequest httpRequest = new HttpRequest("", oWeb.Url, "");
                            HttpContext.Current     = new HttpContext(httpRequest, new HttpResponse(new System.IO.StringWriter()));
                            SPControl.SetContextWeb(HttpContext.Current, oWeb);
                            using (UdlaEntityDataContext context = new UdlaEntityDataContext(oWeb.Url))
                            {
                                EntityList <ListaVisitasElemento> visitas = context.GetList <ListaVisitasElemento>(Properties.UdlaListDefinitions.Default.Lista_Visitas);
                                var visitaBase = visitas.Where(x => x.Identificador == item.Id).Take(1).ToList().First();;
                                if (visitaBase != null)
                                {
                                    visitaBase = MappeoMoss(item, visitaBase);
                                    context.SubmitChanges();
                                    visita = MappeoMoss(visitaBase);
                                }
                            }
                        }
                    }
                }
                                                     );
            }
            catch (Exception ex)
            {
                Logger.ExLogger(ex);
                throw ex;
            }
            return(visita);
        }
Example #10
0
        public List <Visitas> SeleccionarPaginado(int startRowIndex, int maximumRows, int idPasantia, out int itemsCount)
        {
            itemsCount = 0;
            using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Sitio))
            {
                EntityList <ListaVisitasElemento> visitas = context.GetList <ListaVisitasElemento>(Properties.UdlaListDefinitions.Default.Lista_Visitas);
                itemsCount = visitas.Where(x => x.IdPasantia.Identificador == idPasantia).Count();
                var data = visitas.Where(x => x.IdPasantia.Identificador == idPasantia).Skip(startRowIndex).Take(maximumRows);


                if (data != null)
                {
                    List <Visitas> itemVisitas = new List <Visitas>();
                    data.ToList().ForEach(x => itemVisitas.Add(MappeoMoss(x)));
                    return(itemVisitas);
                }
            }
            return(null);
        }
        public List <Actividades> SeleccionarPaginado(int startRowIndex, int maximumRows, int idPasantia, out int itemsCount)
        {
            itemsCount = 0;
            using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Sitio))
            {
                EntityList <ListaDeActividadesPorEstudianteElemento> actividades = context.GetList <ListaDeActividadesPorEstudianteElemento>(Properties.UdlaListDefinitions.Default.Lista_Actividades);

                itemsCount = actividades.Where(x => x.IdPasantia.Identificador == idPasantia).Count();
                var data = actividades.Where(x => x.IdPasantia.Identificador == idPasantia).Skip(startRowIndex).Take(maximumRows);


                if (data != null)
                {
                    List <Actividades> actividadesItem = new List <Actividades>();
                    data.ToList().ForEach(x => actividadesItem.Add(MappeoMoss(x)));
                    return(actividadesItem);
                }
            }
            return(null);
        }
 public string GetEstado(int id)
 {
     try
     {
         using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Sitio))
         {
             EntityList <ListaPasantiasElemento> pasantias = context.GetList <ListaPasantiasElemento>(Properties.UdlaListDefinitions.Default.Lista_Pasantias);
             var pasantiasBase = context.ListaPasantias.Where(x => x.Identificador == id).Take(1).ToList().First();;
             if (pasantiasBase != null)
             {
                 return(pasantiasBase.Estado);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.ExLogger(ex);
         throw ex;
     }
     return(string.Empty);
 }
        public List <PasantiasPreProfesionales> SeleccionarAlumnosParaDocente(int startRowIndex, int maximumRows, string estado, out int itemsCount)
        {
            itemsCount = 0;

            using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Sitio))
            {
                EntityList <ListaPasantiasElemento> pasantias = context.GetList <ListaPasantiasElemento>(Properties.UdlaListDefinitions.Default.Lista_Pasantias);
                var itemsData = pasantias.Where(x => x.DocenteIdentificador == SPContext.Current.Web.CurrentUser.ID && x.Estado == estado);
                itemsCount = itemsData.Count();
                var data = itemsData.Skip(startRowIndex * maximumRows).Take(maximumRows);


                if (data != null)
                {
                    List <PasantiasPreProfesionales> pasantiasItems = new List <PasantiasPreProfesionales>();
                    data.ToList().ForEach(x => pasantiasItems.Add(MappeoMoss(x)));
                    return(pasantiasItems);
                }
            }
            return(null);
        }
 public PasantiasPreProfesionales SeleccionarPorId(int id)
 {
     try
     {
         using (UdlaEntityDataContext context = new UdlaEntityDataContext(Properties.UdlaListDefinitions.Default.Url_Sitio))
         {
             EntityList <ListaPasantiasElemento> pasantias = context.GetList <ListaPasantiasElemento>(Properties.UdlaListDefinitions.Default.Lista_Pasantias);
             var pasantiasBase = pasantias.Where(x => x.Identificador == id).Take(1).ToList().First();;
             if (pasantiasBase != null)
             {
                 return(MappeoMoss(pasantiasBase));
             }
         }
     }
     catch (Exception ex)
     {
         Logger.ExLogger(ex);
         throw ex;
     }
     return(null);
 }
        public bool Insertar(Actividades item, out int?id)
        {
            bool   result = false;
            int?   auxId  = 0;
            string strUrl = Properties.UdlaListDefinitions.Default.Url_Sitio;

            try
            {
                if (SPContext.Current != null)
                {
                    HttpContext.Current = null;
                }
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (SPSite oSite = new SPSite(strUrl))
                    {
                        using (SPWeb oWeb = oSite.OpenWeb())
                        {
                            HttpRequest httpRequest = new HttpRequest("", oWeb.Url, "");
                            HttpContext.Current     = new HttpContext(httpRequest, new HttpResponse(new System.IO.StringWriter()));
                            SPControl.SetContextWeb(HttpContext.Current, oWeb);
                            using (UdlaEntityDataContext context = new UdlaEntityDataContext(oWeb.Url))

                            {
                                EntityList <ListaDeActividadesPorEstudianteElemento> actividades = context.GetList <ListaDeActividadesPorEstudianteElemento>(Properties.UdlaListDefinitions.Default.Lista_Actividades);
                                var itemBase           = MappeoMoss(item);
                                itemBase.Identificador = null;
                                itemBase.IdPasantia    = context.ListaPasantias.Where(x => x.Identificador == item.idPasantia).Take(1).ToList().First();
                                actividades.InsertOnSubmit(itemBase);
                                context.SubmitChanges();
                                auxId  = itemBase.Identificador;
                                result = true;
                            }
                        }
                    }
                }
                                                     );
            }
            catch (Exception ex)
            {
                auxId = 0;
                Logger.ExLogger(ex);
                throw ex;
            }
            id = auxId;
            return(result);
        }