public int New_(string p_contenido, int p_notificacionGenerica, Nullable <DateTime> p_fecha, bool p_enviada)
        {
            NotificacionEN notificacionEN = null;
            int            oid;

            //Initialized NotificacionEN
            notificacionEN           = new NotificacionEN();
            notificacionEN.Contenido = p_contenido;


            if (p_notificacionGenerica != -1)
            {
                // El argumento p_notificacionGenerica -> Property notificacionGenerica es oid = false
                // Lista de oids id
                notificacionEN.NotificacionGenerica    = new LePapeoGenNHibernate.EN.LePapeo.NotificacionGenericaEN();
                notificacionEN.NotificacionGenerica.Id = p_notificacionGenerica;
            }

            notificacionEN.Fecha = p_fecha;

            notificacionEN.Enviada = p_enviada;

            //Call to NotificacionCAD

            oid = _INotificacionCAD.New_(notificacionEN);
            return(oid);
        }
示例#2
0
        public int New_(NotificacionEN notificacion)
        {
            try
            {
                SessionInitializeTransaction();

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

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


            finally
            {
                SessionClose();
            }

            return(notificacion.Id);
        }
        public int New_(NotificacionEN notificacion)
        {
            try
            {
                SessionInitializeTransaction();
                if (notificacion.NotificacionGenerica != null)
                {
                    // Argumento OID y no colección.
                    notificacion.NotificacionGenerica = (LePapeoGenNHibernate.EN.LePapeo.NotificacionGenericaEN)session.Load(typeof(LePapeoGenNHibernate.EN.LePapeo.NotificacionGenericaEN), notificacion.NotificacionGenerica.Id);

                    notificacion.NotificacionGenerica.Notificacion
                    .Add(notificacion);
                }

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

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


            finally
            {
                SessionClose();
            }

            return(notificacion.Id);
        }
示例#4
0
        public int New_(NotificacionEN notificacion)
        {
            try
            {
                SessionInitializeTransaction();
                if (notificacion.Usuario != null)
                {
                    // Argumento OID y no colección.
                    notificacion.Usuario = (DSMGitGenNHibernate.EN.DSMGit.UsuarioEN)session.Load(typeof(DSMGitGenNHibernate.EN.DSMGit.UsuarioEN), notificacion.Usuario.Email);

                    notificacion.Usuario.Notificaciones
                    .Add(notificacion);
                }

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

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


            finally
            {
                SessionClose();
            }

            return(notificacion.Id);
        }
示例#5
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(NotificacionEN notificacion)
        {
            try
            {
                SessionInitializeTransaction();
                NotificacionEN notificacionEN = (NotificacionEN)session.Load(typeof(NotificacionEN), notificacion.Id);

                notificacionEN.Titulo = notificacion.Titulo;


                notificacionEN.Mensaje = notificacion.Mensaje;



                notificacionEN.Fecha = notificacion.Fecha;

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

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


            finally
            {
                SessionClose();
            }
        }
示例#6
0
        public NotificacionEN ReadOIDDefault(int id
                                             )
        {
            NotificacionEN notificacionEN = null;

            try
            {
                SessionInitializeTransaction();
                notificacionEN = (NotificacionEN)session.Get(typeof(NotificacionEN), id);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(notificacionEN);
        }
示例#7
0
        public void Destroy(int id
                            )
        {
            try
            {
                SessionInitializeTransaction();
                NotificacionEN notificacionEN = (NotificacionEN)session.Load(typeof(NotificacionEN), id);
                session.Delete(notificacionEN);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }
        }
示例#8
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(NotificacionEN notificacion)
        {
            try
            {
                SessionInitializeTransaction();
                NotificacionEN notificacionEN = (NotificacionEN)session.Load(typeof(NotificacionEN), notificacion.Id);

                notificacionEN.Descripcion = notificacion.Descripcion;


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

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


            finally
            {
                SessionClose();
            }
        }
        public void Modify(NotificacionEN notificacion)
        {
            try
            {
                SessionInitializeTransaction();
                NotificacionEN notificacionEN = (NotificacionEN)session.Load(typeof(NotificacionEN), notificacion.Id);

                notificacionEN.Contenido = notificacion.Contenido;


                notificacionEN.Fecha = notificacion.Fecha;


                notificacionEN.Enviada = notificacion.Enviada;

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

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


            finally
            {
                SessionClose();
            }
        }
示例#10
0
        public NotificacionEN ReadOID(int id
                                      )
        {
            NotificacionEN notificacionEN = null;

            notificacionEN = _INotificacionCAD.ReadOID(id);
            return(notificacionEN);
        }
        // GET: Registrado/Details/5
        public ActionResult Details(int id)
        {
            NotificacionCEN       NotificacionCEN = new NotificacionCEN();
            NotificacionEN        notiEN          = NotificacionCEN.ReadOID(id);
            NotificacionViewModel notiVM          = new AssemblerNotificacion().ConvertENToModelUI(notiEN);

            return(View(notiVM));
        }
示例#12
0
        public static NotificacionModel ConvertENToModelUI(NotificacionEN en)
        {
            NotificacionModel not = new NotificacionModel();

            not.Id          = en.Id;
            not.Usuario     = en.Usuario.Email;
            not.Descripcion = en.Descripcion;

            return(not);
        }
示例#13
0
        public NotificacionViewModel ConvertENToModelUI(NotificacionEN notiEN)
        {
            NotificacionViewModel noti = new NotificacionViewModel();

            noti.contenido            = notiEN.Contenido;
            noti.notificacionGenerica = notiEN.NotificacionGenerica;
            noti.fecha   = (System.DateTime)notiEN.Fecha;
            noti.enviada = notiEN.Enviada;

            return(noti);
        }
示例#14
0
        public void Modify(int p_Notificacion_OID, string p_descripcion)
        {
            NotificacionEN notificacionEN = null;

            //Initialized NotificacionEN
            notificacionEN             = new NotificacionEN();
            notificacionEN.Id          = p_Notificacion_OID;
            notificacionEN.Descripcion = p_descripcion;
            //Call to NotificacionCAD

            _INotificacionCAD.Modify(notificacionEN);
        }
        // GET: Registrado/VistoNotificacion/5
        public ActionResult VistoNotificacion(int id)
        {
            NotificacionCEN notCEN = new NotificacionCEN();

            NotificacionEN notEN = notCEN.ReadOID(id);

            bool env = !notEN.Enviada;

            notCEN.Modify(notEN.Id, notEN.Contenido, notEN.Fecha, env);

            return(RedirectToAction("MisNotificaciones"));
        }
示例#16
0
        public void Modify(int p_Notificacion_OID, string p_contenido, Nullable <DateTime> p_fecha, bool p_enviada)
        {
            NotificacionEN notificacionEN = null;

            //Initialized NotificacionEN
            notificacionEN           = new NotificacionEN();
            notificacionEN.Id        = p_Notificacion_OID;
            notificacionEN.Contenido = p_contenido;
            notificacionEN.Fecha     = p_fecha;
            notificacionEN.Enviada   = p_enviada;
            //Call to NotificacionCAD

            _INotificacionCAD.Modify(notificacionEN);
        }
示例#17
0
        // GET: Notificacion/Delete/5
        public ActionResult Delete(int id, string usu)
        {
            SessionInitialize();
            NotificacionCAD   notiCAD = new NotificacionCAD(session);
            NotificacionCEN   notiCEN = new NotificacionCEN(notiCAD);
            NotificacionEN    notiEN  = notiCEN.ReadOID(id);
            NotificacionModel noti    = NotificacionAssembler.ConvertENToModelUI(notiEN);

            SessionClose();

            new NotificacionCEN().Destroy(id);

            return(RedirectToRoute(new { controller = "Usuario", action = "Details", id = usu + '/' }));
        }
        // GET: Registrado/AccionNotificacion/5
        public ActionResult AccionNotificacion(int id)
        {
            NotificacionCEN notCEN = new NotificacionCEN();

            NotificacionEN notEN = notCEN.ReadOID(id);

            NotificacionGenericaCEN notgenCEN = new NotificacionGenericaCEN();

            //if (notEN.NotificacionGenerica.Tipo.ToString.Equals("1") || notEN.NotificacionGenerica.Tipo.ToString == "ReservaAceptada") 1 = 1; //Dependiendo del tipo de notificacion te lleva a un sitio o a otro
            if (notEN.NotificacionGenerica.Tipo.ToString() == "8")
            {
                return(RedirectToAction("EliminarCuenta"));
            }
            //notgenCEN.ReadOID(notEN.NotificacionGenerica);
            if (notEN.NotificacionGenerica.Tipo.ToString() == "nuevaOpinion")
            {
                return(RedirectToAction("MisOpiniones"));
            }
            return(View());
        }
        // GET: Registrado/Delete/5
        public ActionResult Delete(int id)
        {
            try
            {
                SessionInitialize();
                NotificacionCAD       notiCAD = new NotificacionCAD(session);
                NotificacionCEN       cen     = new NotificacionCEN(notiCAD);
                NotificacionEN        notiEN  = cen.ReadOID(id);
                NotificacionViewModel noti    = new AssemblerNotificacion().ConvertENToModelUI(notiEN);

                SessionClose();


                return(View(noti));
            }
            catch
            {
                //Meter aqui el mensaje de error
                return(View());
            }
        }
        public int New_(string p_titulo, string p_mensaje)
        {
            /*PROTECTED REGION ID(MultitecUAGenNHibernate.CEN.MultitecUA_Notificacion_new__customized) ENABLED START*/

            NotificacionEN notificacionEN = null;

            int oid;

            //Initialized NotificacionEN
            notificacionEN        = new NotificacionEN();
            notificacionEN.Titulo = p_titulo;

            notificacionEN.Mensaje = p_mensaje;

            notificacionEN.Fecha = DateTime.Now;

            //Call to NotificacionCAD

            oid = _INotificacionCAD.New_(notificacionEN);
            return(oid);
            /*PROTECTED REGION END*/
        }
示例#21
0
        public int New_(string p_descripcion, string p_usuario)
        {
            NotificacionEN notificacionEN = null;
            int            oid;

            //Initialized NotificacionEN
            notificacionEN             = new NotificacionEN();
            notificacionEN.Descripcion = p_descripcion;


            if (p_usuario != null)
            {
                // El argumento p_usuario -> Property usuario es oid = false
                // Lista de oids id
                notificacionEN.Usuario       = new DSMGitGenNHibernate.EN.DSMGit.UsuarioEN();
                notificacionEN.Usuario.Email = p_usuario;
            }

            //Call to NotificacionCAD

            oid = _INotificacionCAD.New_(notificacionEN);
            return(oid);
        }