コード例 #1
0
 public static IList<Proyecto> ListProyectosLugar(int idLugar)
 {
     PersistenceManager persistence = new PersistenceManager();
     return (from p in persistence.Session.Query<Proyecto>()
             where p.Lugar.ID == idLugar
             select p).ToList();
 }
コード例 #2
0
 public static IList<Historia> ListHistoriasLugar(int idLugar)
 {
     PersistenceManager persistence = new PersistenceManager();
     return (from h in persistence.Session.Query<Historia>()
             where h.Proyecto.Lugar.ID == idLugar
             select h).ToList();
 }
コード例 #3
0
 public ResultadoMapa ListLugares(DataContract.PointDC tl, DataContract.PointDC br, byte zoom, FiltroMapa filtro)
 {
     if (zoom >= 8)
     {
         PersistenceManager persistence = new PersistenceManager();
         ICriteria criteria = persistence.CreateCriteria<Lugar>();
         List<Coordinate> coordenadas = new List<Coordinate>();
         coordenadas.Add(new Coordinate(tl.Longitud, tl.Latitud));
         coordenadas.Add(new Coordinate(br.Longitud, tl.Latitud));
         coordenadas.Add(new Coordinate(br.Longitud, br.Latitud));
         coordenadas.Add(new Coordinate(tl.Longitud, br.Latitud));
         coordenadas.Add(new Coordinate(tl.Longitud, tl.Latitud));
         Polygon p = new Polygon(new LinearRing(coordenadas.ToArray()));
         criteria.SetProjection(Projections.ProjectionList()
             .Add(Projections.Property<Lugar>(l => l.ID), "ID")
             .Add(Projections.Property<Lugar>(l => l.Posicion), "Point")
             .Add(Projections.Property<Lugar>(l => l.Nombre), "Nombre")
             );
         criteria.Add(SpatialRestrictions.Within("Posicion", p));
         criteria.SetResultTransformer(Transformers.AliasToBean<ItemLugar>());
         criteria.AddOrder(new Order(Projections.Property<Lugar>(l => l.Nombre), true));
         var list = criteria.List<ItemLugar>().ToList();
         HttpContext.Current.Session["Colegios"] = list;
         return new ResultadoMapa() { Items = list };
     }
     return new ResultadoMapa() { Items = new List<ItemLugar>() };
 }
コード例 #4
0
 public static int UpdateProyecto(Proyecto proyecto)
 {
     ValidateProyecto(proyecto);
     var fechaActual = DateTime.Now;
     var pm = new PersistenceManager();
     proyecto.FechaUltimaActualizacion = fechaActual;
     pm.Update(proyecto);
     return proyecto.ID;
 }
コード例 #5
0
        public static IList<Matricula> GetMatriculas(int rdb)
        {
            var pm = new PersistenceManager();

            var r = (from m in pm.Session.Query<Matricula>()
                     where m.RBD == rdb
                     select m
                     ).ToList();

            return r;
        }
コード例 #6
0
        public static IList<Rendimiento> GetRendimientos(int rdb)
        {
            var pm = new PersistenceManager();

            var rs = (from r in pm.Session.Query<Rendimiento>()
                     where r.RBD == rdb
                     select r
                     ).ToList();

            return rs;
        }
コード例 #7
0
        public static Escuela Establecimiento(int rdb)
        {
            var pm = new PersistenceManager();

            var r = (from m in pm.Session.Query<Escuela>()
                     where m.RDB == rdb
                     select m
                     ).Single();

            return r;
        }
コード例 #8
0
        public static IList<EvaluacionDocente> GetEvaluacionesDocentes(int id)
        {
            var pm = new PersistenceManager();

            var rdb = (from e in pm.Session.Query<Escuela>()
                       where e.ID == id
                       select e.RDB).Single();

            var rs = (from r in pm.Session.Query<EvaluacionDocente>()
                      where r.RBD == rdb
                      select r
                     ).ToList();

            return rs;
        }
コード例 #9
0
 public void DeleteNecesidad(int idNecesidad)
 {
     var pm = new PersistenceManager();
     var necesidad = pm.Get<Necesidad>(idNecesidad);
     if (necesidad == null)
     {
         throw new BusinessException(Properties.Resources.ErrorDeleteNecesidadNecesidadNoExiste);
     }
     if (necesidad.EstadoNecesidad == EstadoNecesidad.EnProceso)
     {
         throw new BusinessException(Properties.Resources.ErrorDeleteNecesidadEstadoEnProceso);
     }
     if (necesidad.EstadoNecesidad == EstadoNecesidad.Finalizada)
     {
         throw new BusinessException(Properties.Resources.ErrorDeleteNecesidadEstadoFinalizada);
     }
     pm.Delete(necesidad);
 }
コード例 #10
0
        public void ListDonacion()
        {
            //PersistenceManager persistence = new PersistenceManager();
            //var xx = (from d in persistence.Session.Query<Donacion>()
            //        where d.IDDonacion == 1
            //        select d);

            IList<int> list = new List<int>();
            list.Add(1);
            foreach (var item in list)
            {

                var fechaActual = DateTime.Now;

                var pm = new PersistenceManager();

                var necesidad = (from n in pm.Session.Query<Necesidad>()
                                 where n.ID == item
                                 select n).FirstOrDefault();

                var usuario = (from u in pm.Session.Query<Usuario>()
                               where u.ID == 1
                               select u).FirstOrDefault();

                Donacion donacion = new Donacion();
                DonacionNecesidad donacionNecesidad = new DonacionNecesidad();

                donacionNecesidad.DetalleDonante = "";
                donacionNecesidad.DetalleBeneficiarion = "";

                donacionNecesidad.Donacion = donacion;
                donacionNecesidad.Necesidad = necesidad;

                donacion.Fecha = fechaActual;

                IList<DonacionNecesidad> listNecesidad = new List<DonacionNecesidad>();
                listNecesidad.Add(donacionNecesidad);
                donacion.DonacionNecesidades = listNecesidad;
                donacion.Usuario = usuario;

                pm.Save(donacion);
                pm.Flush();
            }
        }
コード例 #11
0
        public static List<DatosSIMCEQM> GetSIMCES(int[] rbd)
        {
            var pm = new PersistenceManager();
            ICriteria criteria = pm.CreateCriteria<DatosSIMCE>();

            criteria.Add(Restrictions.In("RBD", rbd));
            criteria.SetProjection(Projections.ProjectionList()
                .Add(Projections.Property<DatosSIMCE>(d => d.Ano), "Ano")
                .Add(Projections.Avg<DatosSIMCE>(d => d.PromLect), "PromLect")
                .Add(Projections.Avg<DatosSIMCE>(d => d.PromMat), "PromMat")
                .Add(Projections.Avg<DatosSIMCE>(d => d.PromNat), "PromNat")
                .Add(Projections.Avg<DatosSIMCE>(d => d.PromSoc), "PromSoc")
                .Add(Projections.Avg<DatosSIMCE>(d => d.PromIngTotal), "PromIngTotal")
                .Add(Projections.GroupProperty("Ano")));
            criteria.SetResultTransformer(Transformers.AliasToBean<DatosSIMCEQM>());
            criteria.AddOrder(new Order("Ano", true));
            var a = criteria.List<DatosSIMCEQM>().ToList();

            return a;
        }
コード例 #12
0
        public void CrearDonacion(IList<int> necesidades )
        {
            if (necesidades.Count > 0)
            {
                foreach (var item in necesidades)
                {
                    var fechaActual = DateTime.Now;

                    var pm = new PersistenceManager();

                    var necesidad = (from n in pm.Session.Query<Necesidad>()
                                     where n.ID == item
                                     select n).FirstOrDefault();

                    var usuario = (from u in pm.Session.Query<Usuario>()
                                   where u.ID == 1
                                   select u).FirstOrDefault();

                    Donacion donacion = new Donacion();
                    DonacionNecesidad donacionNecesidad = new DonacionNecesidad();

                    donacionNecesidad.DetalleDonante = "";
                    donacionNecesidad.DetalleBeneficiarion = "";

                    donacionNecesidad.Donacion = donacion;
                    donacionNecesidad.Necesidad = necesidad;

                    donacion.Fecha = fechaActual;

                    IList<DonacionNecesidad> listNecesidad = new List<DonacionNecesidad>();
                    listNecesidad.Add(donacionNecesidad);
                    donacion.DonacionNecesidades = listNecesidad;
                    donacion.Usuario = usuario;

                    pm.Save(donacion);
                    pm.Flush();

                }

            }
        }
コード例 #13
0
 public static Proyecto GetProyectoId(int idProyecto)
 {
     var pm = new PersistenceManager();
     return pm.Get<Proyecto>(idProyecto);
 }
コード例 #14
0
 public List<ProyectosLugar> ListProyectosLugar(int idLugar)
 {
     var pm = new PersistenceManager();
     var criteria = pm.CreateCriteria<Proyecto>();
     criteria.SetProjection(Projections.ProjectionList()
         .Add(Projections.Property<Proyecto>(p => p.ID), "IDProyecto")
         .Add(Projections.Property<Proyecto>(p => p.Nombre), "Nombre")
         .Add(Projections.Property<Proyecto>(p => p.Descripcion), "Descripcion")
         .Add(Projections.Property<Proyecto>(p => p.PersonaResponsable.Rut), "PersonaResponsable")
         .Add(Projections.Property<Proyecto>(p => p.FechaIngreso), "FechaIngreso")
         .Add(Projections.Property<Proyecto>(p => p.Necesidades.Count), "Necesidades")
         );
     criteria.SetResultTransformer(Transformers.AliasToBean<ProyectosLugar>());
     return criteria.List<ProyectosLugar>().ToList();
 }
コード例 #15
0
        public static IList<TipoEnsenanza> GetTiposEnsenanza(int rdb)
        {
            var pm = new PersistenceManager();

            var rs = (from r in pm.Session.Query<TipoEnsenanza>()
                      where r.RBD == rdb
                      select r
                     ).ToList();

            return rs;
        }
コード例 #16
0
 public static DependenciaEscuela GetDependencia(int id)
 {
     var pm = new PersistenceManager();
     return pm.Get<DependenciaEscuela>(id);
 }
コード例 #17
0
 public IList<UsuarioLugar> ListUsuariosLugares()
 {
     var pm = new PersistenceManager();
     return pm.ListAll<UsuarioLugar>();
 }
コード例 #18
0
        public static string Nombre(int rdb)
        {
            var pm = new PersistenceManager();

            var r = (from m in pm.Session.Query<Escuela>()
                     where m.RDB == rdb
                     select m.Nombre
                     ).Single();

            return r;
        }