Example #1
0
        public int New_(string p_Titulo, string p_descripcion, Nullable <DateTime> p_fecha, double p_precio, int p_usuario)
        {
            EventoEN eventoEN = null;
            int      oid;

            //Initialized EventoEN
            eventoEN        = new EventoEN();
            eventoEN.Titulo = p_Titulo;

            eventoEN.Descripcion = p_descripcion;

            eventoEN.Fecha = p_fecha;

            eventoEN.Precio = p_precio;


            if (p_usuario != -1)
            {
                // El argumento p_usuario -> Property usuario es oid = false
                // Lista de oids ID
                eventoEN.Usuario    = new WhateverGenNHibernate.EN.Whatever.UsuarioEN();
                eventoEN.Usuario.ID = p_usuario;
            }

            //Call to EventoCAD

            oid = _IEventoCAD.New_(eventoEN);
            return(oid);
        }
Example #2
0
        public static EventoDTO Convert(EventoEN en)
        {
            EventoDTO newinstance = null;

            if (en != null)
            {
                newinstance = new EventoDTO();


                newinstance.Id          = en.Id;
                newinstance.Nombre      = en.Nombre;
                newinstance.Descripcion = en.Descripcion;
                newinstance.Fecha       = en.Fecha;
                newinstance.Categoria   = en.Categoria;
                if (en.Inmobiliaria != null)
                {
                    newinstance.Inmobiliaria_oid = en.Inmobiliaria.Id;
                }
                if (en.Geolocalizacion != null)
                {
                    newinstance.Geolocalizacion_oid = en.Geolocalizacion.Id;
                }
            }

            return(newinstance);
        }
Example #3
0
        public int New_(string p_nombre, double p_precio, string p_descripcion, string p_imagen, SMPGenNHibernate.Enumerated.SMP.ValoracionEnum p_valor, int p_stock, string p_descriplarga, string p_imagran, string p_tipo)
        {
            EventoEN eventoEN = null;
            int      oid;

            //Initialized EventoEN
            eventoEN        = new EventoEN();
            eventoEN.Nombre = p_nombre;

            eventoEN.Precio = p_precio;

            eventoEN.Descripcion = p_descripcion;

            eventoEN.Imagen = p_imagen;

            eventoEN.Valor = p_valor;

            eventoEN.Stock = p_stock;

            eventoEN.Descriplarga = p_descriplarga;

            eventoEN.Imagran = p_imagran;

            eventoEN.Tipo = p_tipo;

            //Call to EventoCAD

            oid = _IEventoCAD.New_(eventoEN);
            return(oid);
        }
Example #4
0
        //
        // GET: /Galeria/Details/5

        public ActionResult Details(int id)
        {
            GaleriaModelo  gal          = null;
            IList <FotoEN> lista        = new List <FotoEN>();
            IList <FotoEN> listagaleria = new List <FotoEN>();

            SessionInitialize();
            GaleriaEN galEN = new GaleriaCAD(session).ReadOIDDefault(id);

            gal = new GaleriaAssembler().ConvertENToModelUI(galEN);
            FotoCEN fotos = new FotoCEN();

            lista = fotos.ReadAll(0, -1);
            foreach (FotoEN item in lista)
            {
                if (item.Pertenece_a != null)
                {
                    if (item.Pertenece_a.Id == id)
                    {
                        listagaleria.Add(item);
                    }
                }
            }
            ViewData["lista"] = listagaleria;
            ViewBag.Titulo    = galEN.NombreGaleria;
            //Aqui llamamos al evento para coger su nombre y mostrarlo en la vista
            EventoCEN cenev = new EventoCEN();
            EventoEN  ev    = cenev.ReadOID(galEN.Evento.Id);

            ViewBag.Ev = ev.Nombre;
            ViewBag.Us = ev.Crea.Nick;
            SessionClose();
            return(View(gal));
        }
Example #5
0
        public List <EventoEN> clsEventos()
        {
            EventoEN        eventoEN    = new EventoEN();
            List <EventoEN> listado     = new List <EventoEN>();
            HttpClient      clienteHttp = new HttpClient();

            try
            {
                clienteHttp.BaseAddress = new Uri("http://isasistencia.azurewebsites.net/");
                var request = clienteHttp.GetAsync("api/Evento").Result;

                if (request.IsSuccessStatusCode)
                {
                    var resultString = request.Content.ReadAsStringAsync().Result;
                    listado = JsonConvert.DeserializeObject <List <EventoEN> >(resultString);
                    return(listado);
                }
                else
                {
                    return(listado = null);
                }
            }
            catch (Exception)
            {
                return(listado = null);
            }
        }
        // GET: Recuerdo/Create
        public ActionResult Create(int idEvento)
        {
            if (Session["usuario"] == null)
            {
                return(RedirectToAction("Login", "Sesion"));
            }

            Recuerdo rec = new Recuerdo();

            TempData["idEvento"] = idEvento;
            ViewData["idEvento"] = idEvento;
            EventoCEN eventoCEN = new EventoCEN();
            EventoEN  eventoEN  = eventoCEN.ReadOID(idEvento);

            ViewData["NombreEvento"] = eventoEN.Nombre;

            if (TempData.ContainsKey("creado"))
            {
                TempData.Remove("creado");
            }
            if (TempData.ContainsKey("editado"))
            {
                TempData.Remove("editado");
            }

            if (Session["usuario"] != null && Session["esAdmin"].ToString() == "true" && Session["modoAdmin"].ToString() == "true")
            {
                return(View(rec));
            }
            else
            {
                return(View("./VistaUsuario/CrearRecuerdo", rec));
            }
        }
        public ActionResult PorFiltro()
        {
            EventoEN                    evento             = new EventoEN();
            CategoriaProyectoCEN        categoriasP        = new CategoriaProyectoCEN();
            IList <CategoriaProyectoEN> categoriasProyecto = categoriasP.ReadAll(0, -1).ToList();
            ArrayList                   categorias         = new ArrayList();

            foreach (CategoriaProyectoEN a in categoriasProyecto)
            {
                categorias.Add(a.Nombre);
            }

            if (Session["usuario"] != null && Session["esAdmin"].ToString() == "true" && Session["modoAdmin"].ToString() == "true")
            {
                ViewData["listacategorias"] = categorias;

                if (TempData.ContainsKey("eventocreado"))
                {
                    TempData.Remove("eventocreado");
                }
                if (TempData.ContainsKey("eventoeditado"))
                {
                    TempData.Remove("eventoeditado");
                }

                return(View(evento));
            }
            else
            {
                ViewData["listacategorias"] = categorias;
                return(View("./VistaUsuario/FiltroAvanzado", evento));
            }
        }
Example #8
0
        public EventoEN ReadOIDDefault(int ID
                                       )
        {
            EventoEN eventoEN = null;

            try
            {
                SessionInitializeTransaction();
                eventoEN = (EventoEN)session.Get(typeof(EventoEN), ID);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is WhateverGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in EventoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(eventoEN);
        }
Example #9
0
        public EventoEN DameEventoPorOID(int id)
        {
            EventoEN eventoEN = null;

            eventoEN = _IEventoCAD.DameEventoPorOID(id);
            return(eventoEN);
        }
Example #10
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(EventoEN evento)
        {
            try
            {
                SessionInitializeTransaction();
                EventoEN eventoEN = (EventoEN)session.Load(typeof(EventoEN), evento.Id);

                eventoEN.Tipo = evento.Tipo;


                session.Update(eventoEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is SMPGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new SMPGenNHibernate.Exceptions.DataLayerException("Error in EventoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
        public void PublicaEvento(int p_oid)
        {
            /*PROTECTED REGION ID(MultitecUAGenNHibernate.CEN.MultitecUA_Evento_publicaEvento) ENABLED START*/
            EventoEN eventoEN = ReadOID(p_oid);
            NotificacionEventoCEN notificacionEventoCEN = new NotificacionEventoCEN();
            int OID_notificacionEvento = notificacionEventoCEN.New_("Nuevo evento publicado", "Se acaba de publicar un nuevo evento: " + eventoEN.Nombre, eventoEN.Id);

            UsuarioCEN             usuarioCEN             = new UsuarioCEN();
            NotificacionUsuarioCEN notificacionUsuarioCEN = new NotificacionUsuarioCEN();

            List <int> listaOIDsUsuarios = new List <int>();

            foreach (UsuarioEN usuarioEN in usuarioCEN.ReadAll(0, -1))
            {
                listaOIDsUsuarios.Add(usuarioEN.Id);
            }

            foreach (int OIDUsuario in listaOIDsUsuarios)
            {
                notificacionUsuarioCEN.New_(OIDUsuario, OID_notificacionEvento);
            }


            /*PROTECTED REGION END*/
        }
Example #12
0
        public int New_(EventoEN evento)
        {
            try
            {
                SessionInitializeTransaction();

                session.Save(evento);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is SMPGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new SMPGenNHibernate.Exceptions.DataLayerException("Error in EventoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(evento.Id);
        }
Example #13
0
        public void Destroy(int ID
                            )
        {
            try
            {
                SessionInitializeTransaction();
                EventoEN eventoEN = (EventoEN)session.Load(typeof(EventoEN), ID);
                session.Delete(eventoEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is WhateverGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in EventoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
        //GET
        public ActionResult eliminandoRelacion(int idP, int idE)
        {
            if (Session["usuario"] == null)
            {
                return(RedirectToAction("Login", "Sesion"));
            }
            if (Session["esAdmin"].ToString() == "false")
            {
                return(View("../NoAdministrador"));
            }
            if (Session["modoAdmin"].ToString() == "false")
            {
                Session["modoAdmin"] = "true";
            }

            ProyectoCEN proyectoCEN = new ProyectoCEN();
            ProyectoEN  proyecto    = proyectoCEN.ReadOID(idP);
            EventoCEN   eventoCEN   = new EventoCEN();
            EventoEN    evento      = eventoCEN.ReadOID(idE);

            ViewData["idEvento"]     = idE;
            ViewData["nombreEvento"] = evento.Nombre;

            if (TempData.ContainsKey("eventocreado"))
            {
                TempData.Remove("eventocreado");
            }
            if (TempData.ContainsKey("eventoeditado"))
            {
                TempData.Remove("eventoeditado");
            }

            return(View(proyecto));
        }
Example #15
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                SessionInitialize();
                ComentarioCAD cad = new ComentarioCAD(session);

                ComentarioCEN cen = new ComentarioCEN(cad);


                ComentarioEN en = new ComentarioEN();
                en = cen.ReadOID(id);


                AssemblerComentario ass = new AssemblerComentario();

                Comentario sol  = ass.ConvertENToModelUI(en);
                string     tipo = null;


                ProductoCAD cadp = new ProductoCAD(session);
                ProductoCEN cenp = new ProductoCEN(cadp);
                ProductoEN  enp  = cenp.ReadOID(sol.idsup);


                EventoCAD cade = new EventoCAD(session);
                EventoCEN cene = new EventoCEN(cade);
                EventoEN  ene  = cene.ReadOID(sol.idsup);



                if (ene != null)
                {
                    tipo = "Evento";
                }
                else if (enp != null)
                {
                    tipo = "Producto";
                }
                else
                {
                    tipo = sol.tipo;
                }

                SessionClose();
                ComentarioCEN cenn = new ComentarioCEN();


                cenn.Destroy(id);



                return(RedirectToAction("Details", tipo, new { id = sol.idsup }));
            }
            catch
            {
                return(View());
            }
        }
        public int New_(string p_nombre, string p_descripcion, Nullable <DateTime> p_fechaInicio, Nullable <DateTime> p_fechaFin, Nullable <DateTime> p_fechaInicioInscripcion, Nullable <DateTime> p_fechaTopeInscripcion, System.Collections.Generic.IList <string> p_fotos)
        {
            /*PROTECTED REGION ID(MultitecUAGenNHibernate.CEN.MultitecUA_Evento_new__customized) START*/

            EventoEN eventoEN = null;

            int oid;

            //Initialized EventoEN
            eventoEN        = new EventoEN();
            eventoEN.Nombre = p_nombre;

            eventoEN.Descripcion = p_descripcion;

            eventoEN.FechaInicio = p_fechaInicio;

            eventoEN.FechaFin = p_fechaFin;

            eventoEN.FechaInicioInscripcion = p_fechaInicioInscripcion;

            eventoEN.FechaTopeInscripcion = p_fechaTopeInscripcion;

            eventoEN.FotosEvento = p_fotos;

            //Call to EventoCAD

            oid = _IEventoCAD.New_(eventoEN);
            return(oid);
            /*PROTECTED REGION END*/
        }
        public ActionResult Delete(int id, EventoEN evento)
        {
            if (Session["usuario"] == null)
            {
                return(RedirectToAction("Login", "Sesion"));
            }
            if (Session["esAdmin"].ToString() == "false")
            {
                return(View("../NoAdministrador"));
            }
            if (Session["modoAdmin"].ToString() == "false")
            {
                Session["modoAdmin"] = "true";
            }

            try{
                EventoCP eventoCP = new EventoCP();
                eventoCP.Destroy(id);

                if (TempData.ContainsKey("eventoeditado"))
                {
                    TempData.Remove("eventoeditado");
                }

                TempData["bien"] = "Se a borrado correctamente el evento " + evento.Nombre;
                return(RedirectToAction("Index"));
            }
            catch
            {
                TempData["mal"] = "Ocurrio un problema al intentar borrar la el evento";
                return(RedirectToAction("Index"));
            }
        }
        // GET: Evento/Delete/5
        public ActionResult Delete(int id)
        {
            if (Session["usuario"] == null)
            {
                return(RedirectToAction("Login", "Sesion"));
            }
            if (Session["esAdmin"].ToString() == "false")
            {
                return(View("../NoAdministrador"));
            }
            if (Session["modoAdmin"].ToString() == "false")
            {
                Session["modoAdmin"] = "true";
            }

            EventoCEN eventoCEN = new EventoCEN();
            EventoEN  eventoEN  = eventoCEN.ReadOID(id);

            ViewData["NombreEvento"] = eventoEN.Nombre;

            if (TempData.ContainsKey("eventocreado"))
            {
                TempData.Remove("eventocreado");
            }
            if (TempData.ContainsKey("eventoeditado"))
            {
                TempData.Remove("eventoeditado");
            }

            return(View(eventoEN));
        }
        // GET: Evento/Create
        public ActionResult Create()
        {
            if (Session["usuario"] == null)
            {
                return(RedirectToAction("Login", "Sesion"));
            }
            if (Session["esAdmin"].ToString() == "false")
            {
                return(View("../NoAdministrador"));
            }
            if (Session["modoAdmin"].ToString() == "false")
            {
                Session["modoAdmin"] = "true";
            }

            EventoEN evento = new EventoEN();

            if (TempData.ContainsKey("eventocreado"))
            {
                TempData.Remove("eventocreado");
            }
            if (TempData.ContainsKey("eventoeditado"))
            {
                TempData.Remove("eventoeditado");
            }

            return(View(evento));
        }
        //Filtro
        public ActionResult porEvento(int idEvento)
        {
            RecuerdoCEN            recuerdoCEN    = new RecuerdoCEN();
            IList <RecuerdoEN>     recuerdo       = recuerdoCEN.DameRecuerdosPorProyecto(idEvento);
            IEnumerable <Recuerdo> listaRecuerdos = new AssemblerRecuerdo().ConvertListENToModel(recuerdo).ToList();
            EventoCEN eventoCEN = new EventoCEN();
            EventoEN  evento    = eventoCEN.ReadOID(idEvento);

            ViewData["idevento"]     = idEvento;
            ViewData["nombreEvento"] = evento.Nombre;
            if (TempData.ContainsKey("creado"))
            {
                TempData.Remove("creado");
            }
            if (TempData.ContainsKey("nocreado"))
            {
                TempData.Remove("nocreado");
            }
            if (TempData.ContainsKey("editado"))
            {
                TempData.Remove("editado");
            }


            if (Session["usuario"] != null && Session["esAdmin"].ToString() == "true" && Session["modoAdmin"].ToString() == "true")
            {
                return(View(listaRecuerdos));
            }
            else
            {
                return(View("./VistaUsuario/Recuerdos", listaRecuerdos));
            }
        }
Example #21
0
        public int New_(EventoEN evento)
        {
            try
            {
                SessionInitializeTransaction();
                if (evento.Usuario != null)
                {
                    // Argumento OID y no colección.
                    evento.Usuario = (WhateverGenNHibernate.EN.Whatever.UsuarioEN)session.Load(typeof(WhateverGenNHibernate.EN.Whatever.UsuarioEN), evento.Usuario.ID);

                    evento.Usuario.Evento
                    .Add(evento);
                }

                session.Save(evento);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is WhateverGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in EventoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(evento.ID);
        }
Example #22
0
//Sin e: DameEventoPorOID
//Con e: EventoEN
        public EventoEN DameEventoPorOID(int id)
        {
            EventoEN eventoEN = null;

            try
            {
                SessionInitializeTransaction();
                eventoEN = (EventoEN)session.Get(typeof(EventoEN), id);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is NuevoInmueblateGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new NuevoInmueblateGenNHibernate.Exceptions.DataLayerException("Error in EventoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(eventoEN);
        }
Example #23
0
        public void BorrarEvento(int id)
        {
            try
            {
                SessionInitializeTransaction();
                EventoEN eventoEN = (EventoEN)session.Load(typeof(EventoEN), id);
                session.Delete(eventoEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is NuevoInmueblateGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new NuevoInmueblateGenNHibernate.Exceptions.DataLayerException("Error in EventoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
Example #24
0
        // GET: Articulo/Details/5
        public ActionResult Details(int id)
        {
            SessionInitialize();
            EventoCAD cad = new EventoCAD(session);

            EventoCEN cen = new EventoCEN(cad);
            EventoEN  en  = cen.ReadOID(id);

            AssemblerEvento ass = new AssemblerEvento();
            Evento          sol = ass.ConvertENToModelUI(en);


            IList <ComentarioEN> ten = en.Comentario;

            AssemblerComentario assc = new AssemblerComentario();
            IList <Comentario>  solc = assc.ConvertListENToModel(ten);

            SessionClose();

            // ViewData["action"] = "Details";
            ViewBag.coment = solc;

            System.Web.HttpContext.Current.Session["comen"] = id;


            return(View(sol));
        }
Example #25
0
        public ActionResult Edit(int id, Evento collection)
        {
            try
            {
                // TODO: Add update logic here
                EventoCEN cen = new EventoCEN();

                EventoEN en  = cen.get_IEventoCAD().ReadOIDDefault(id);
                string   img = collection.Imagen;

                if (collection.Imagen == null)
                {
                    img = en.Imagen;
                }

                cen.Modify(id, collection.Nombre, collection.Precio, collection.Descripcion, img, (SMPGenNHibernate.Enumerated.SMP.ValoracionEnum)collection.Valoracion, collection.Stock, collection.descriplarga, collection.imagran, collection.Tipo);

                //cen.New_(collection.Nombre, collection.Precio, collection.Descripcion, collection.Imagen, collection.Valor, collection.Stock, collection.Talla);
                string action     = System.Web.HttpContext.Current.Session["action"] as String;
                string controller = System.Web.HttpContext.Current.Session["controller"] as String;
                Object arg        = System.Web.HttpContext.Current.Session["arg"];


                return(RedirectToAction(action, controller, arg));
            }
            catch
            {
                return(View());
            }
        }
Example #26
0
        public ActionResult compra(int id)
        {
            SessionInitialize();
            CarritoCAD cad = new CarritoCAD(session);

            CarritoCEN cen = new CarritoCEN(cad);
            CarritoEN  en  = cen.ReadOID(id);

            AssemblerCarrito ass = new AssemblerCarrito();
            Carrito          sol = ass.ConvertENToModelUI(en);


            IList <Lineas_pedidoEN> ten = en.Lineas_pedido;

            AssemblerLineas_pedido assc = new AssemblerLineas_pedido();
            IList <Lineas_pedido>  solc = assc.ConvertListENToModel(ten);

            IList <int> vamos = new List <int>();


            foreach (Lineas_pedido linea in solc)
            {
                vamos.Add(linea.id);
                EventoCEN   cene = new EventoCEN();
                ProductoCEN cenp = new ProductoCEN();
                if (linea.tipo == "Producto")
                {
                    ProductoEN enp  = cenp.ReadOID(linea.articulo);
                    int        cant = enp.Stock - linea.cantidad;
                    cenp.Modify(linea.articulo, enp.Nombre, enp.Precio, enp.Descripcion, enp.Imagen, enp.Valor, cant, enp.Descriplarga, enp.Imagran, enp.Talla);
                }
                else
                {
                    EventoEN ene  = cene.ReadOID(linea.articulo);
                    int      cant = ene.Stock - linea.cantidad;
                    cene.Modify(linea.articulo, ene.Nombre, ene.Precio, ene.Descripcion, ene.Imagen, ene.Valor, cant, ene.Descriplarga, ene.Imagran, ene.Tipo);
                }
            }



            SessionClose();


            CarritoCEN fin = new CarritoCEN();

            fin.Modify(id, 0);
            fin.Dellinea(id, vamos);



            //cen.Dellinea(id, vamos);



            ViewData["correo"] = System.Web.HttpContext.Current.Session["correo"] as string;
            // ViewData["action"] = "Details";
            return(RedirectToAction("Details", "Carrito", new { id = id }));
        }
Example #27
0
        public MultitecUAGenNHibernate.EN.MultitecUA.EventoEN New_(string p_nombre, string p_descripcion, Nullable <DateTime> p_fechaInicio, Nullable <DateTime> p_fechaFin, Nullable <DateTime> p_fechaInicioInscripcion, Nullable <DateTime> p_fechaTopeInscripcion, System.Collections.Generic.IList <string> p_fotos)
        {
            /*PROTECTED REGION ID(MultitecUAGenNHibernate.CP.MultitecUA_Evento_new_) ENABLED START*/

            IEventoCAD eventoCAD = null;
            EventoCEN  eventoCEN = null;

            MultitecUAGenNHibernate.EN.MultitecUA.EventoEN result = null;


            try
            {
                SessionInitializeTransaction();
                eventoCAD = new EventoCAD(session);
                eventoCEN = new  EventoCEN(eventoCAD);



                int oid;
                //Initialized EventoEN
                EventoEN eventoEN;
                eventoEN        = new EventoEN();
                eventoEN.Nombre = p_nombre;

                eventoEN.Descripcion = p_descripcion;

                eventoEN.FechaInicio = p_fechaInicio;

                eventoEN.FechaFin = p_fechaFin;

                eventoEN.FechaInicioInscripcion = p_fechaInicioInscripcion;

                eventoEN.FechaTopeInscripcion = p_fechaTopeInscripcion;

                eventoEN.Fotos = p_fotos;

                //Call to EventoCAD

                oid    = eventoCAD.New_(eventoEN);
                result = eventoCAD.ReadOIDDefault(oid);



                SessionCommit();
            }
            catch (Exception ex)
            {
                SessionRollBack();
                throw ex;
            }
            finally
            {
                SessionClose();
            }
            return(result);


            /*PROTECTED REGION END*/
        }
Example #28
0
        public Evento ConvertENToModelUI(EventoEN even)
        {
            if (even != null)
            {
                AssemblerReporte    assR = new AssemblerReporte();
                AssemblerMapa       assM = new AssemblerMapa();
                AssemblerComentario assC = new AssemblerComentario();
                AssemblerPuntuacion assP = new AssemblerPuntuacion();
                PuntuacionCEN       p    = new PuntuacionCEN();
                Evento evento            = new Evento();
                evento.Titulo      = even.Titulo;
                evento.Descripcion = even.Descripcion;
                evento.Fecha       = even.Fecha;
                evento.Precio      = even.Precio;
                evento.Creador     = even.Usuario.Nombre;



                //puntuacion

                evento.Puntuaciones = null;
                if (even.Puntuacion != null)
                {
                    evento.Puntuaciones = assP.ConvertListENToModel(even.Puntuacion);
                }
                //mapa
                evento.Mapa = null;
                if (even.Mapa != null)
                {
                    evento.Latitud  = even.Mapa.Latitud;
                    evento.Longitud = even.Mapa.Longitud;
                    evento.Zoom     = even.Mapa.Zoom;
                    evento.Mapa     = assM.ConvertENToModelUI(even.Mapa);
                }
                //comentarios
                evento.Comentarios = null;
                if (even.Comentario != null)
                {
                    evento.Comentarios = assC.ConvertListENToModel(even.Comentario);
                }

                //atributos ocultos
                evento.id      = even.ID;
                evento.usuario = even.Usuario;

                //reportes
                evento.Reportes = null;
                if (even.Reporte != null)
                {
                    evento.Reportes = assR.ConvertListENToModel(even.Reporte);
                }

                return(evento);
            }
            else
            {
                return(null);
            }
        }
        public ActionResult CreateNoId(Recuerdo rec, HttpPostedFileBase file)
        {
            if (Session["usuario"] == null)
            {
                return(RedirectToAction("Login", "Sesion"));
            }
            if (Session["esAdmin"].ToString() == "false")
            {
                return(View("../NoAdministrador"));
            }
            if (Session["modoAdmin"].ToString() == "false")
            {
                Session["modoAdmin"] = "true";
            }

            try
            {
                // TODO: Add insert logic here
                RecuerdoCEN cen       = new RecuerdoCEN();
                EventoCEN   eventoCEN = new EventoCEN();
                EventoEN    evento    = eventoCEN.ReadOID(rec.IdEvento);

                string fileName = "", path = "";
                if (file != null && file.ContentLength > 0)
                {
                    fileName = Path.GetFileName(file.FileName);
                    path     = Path.Combine(Server.MapPath("~/Imagenes"), fileName);
                    if (!System.IO.File.Exists(path))
                    {
                        file.SaveAs(path);
                    }
                    file.SaveAs(path);
                    fileName = "/Imagenes/" + fileName;
                }

                int id;
                if (fileName == "")
                {
                    IList <string> fotos = new List <string>();
                    fotos.Add("/Imagenes/NoFoto.png");
                    id = cen.New_(rec.Titulo, rec.Cuerpo, rec.IdEvento, fotos);
                }
                else
                {
                    IList <string> fotos = new List <string>();
                    fotos.Add(fileName);
                    id = cen.New_(rec.Titulo, rec.Cuerpo, rec.IdEvento, fotos);
                }

                TempData["creado"] = "si";

                return(Redirect("Details/" + id));
            }
            catch
            {
                TempData["nocreado"] = "No se ha podido crear el recuerdo";
                return(View());
            }
        }
Example #30
0
        public EventoEN ReadOID(int id
                                )
        {
            EventoEN eventoEN = null;

            eventoEN = _IEventoCAD.ReadOID(id);
            return(eventoEN);
        }