public int New_(string p_usuario, string p_mensaje, string p_moderador) { NotificacionesEN notificacionesEN = null; int oid; //Initialized NotificacionesEN notificacionesEN = new NotificacionesEN(); if (p_usuario != null) { // El argumento p_usuario -> Property usuario es oid = false // Lista de oids id_notificacion notificacionesEN.Usuario = new YoureOnGenNHibernate.EN.YoureOn.UsuarioEN(); notificacionesEN.Usuario.Email = p_usuario; } notificacionesEN.Mensaje = p_mensaje; if (p_moderador != null) { // El argumento p_moderador -> Property moderador es oid = false // Lista de oids id_notificacion notificacionesEN.Moderador = new YoureOnGenNHibernate.EN.YoureOn.ModeradorEN(); notificacionesEN.Moderador.Email = p_moderador; } //Call to NotificacionesCAD oid = _INotificacionesCAD.New_(notificacionesEN); return(oid); }
public void PoneFalta(string moderador_oid, YoureOnGenNHibernate.Enumerated.YoureOn.TipoFaltaEnum tipoFalta, YoureOnGenNHibernate.EN.YoureOn.UsuarioEN usuario, Nullable <DateTime> fechaFalta, YoureOnGenNHibernate.EN.YoureOn.AdministradorEN administrador) { /*PROTECTED REGION ID(YoureOnGenNHibernate.CEN.YoureOn_Moderador_poneFalta) ENABLED START*/ ModeradorEN moderadorEN = _IModeradorCAD.ReadOIDDefault(moderador_oid); NotificacionesEN notificacionEN = new NotificacionesEN(); FaltaEN faltaUsuario = new FaltaEN(); String mensaje = ""; if (moderador_oid != null) { faltaUsuario = new FaltaEN(faltaUsuario.Id_falta, tipoFalta, usuario, fechaFalta, moderadorEN); usuario.Falta.Add(faltaUsuario); if (usuario.Falta.Count == 3) { mensaje = "El usuario" + usuario.Email + "ha cometido 3 faltas leves"; this.EnviarNotificacion(moderadorEN.Email, administrador, mensaje); } else if (faltaUsuario.TipoFalta.Equals("2") || faltaUsuario.TipoFalta.Equals("grave")) { mensaje = "El usuario" + usuario.Email + "ha cometido una falta grave"; this.EnviarNotificacion(moderadorEN.Email, administrador, mensaje); } } /*PROTECTED REGION END*/ }
// Modify default (Update all attributes of the class) public void ModifyDefault(NotificacionesEN notificaciones) { try { SessionInitializeTransaction(); NotificacionesEN notificacionesEN = (NotificacionesEN)session.Load(typeof(NotificacionesEN), notificaciones.Id_notificacion); notificacionesEN.Mensaje = notificaciones.Mensaje; session.Update(notificacionesEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is YoureOnGenNHibernate.Exceptions.ModelException) { throw ex; } throw new YoureOnGenNHibernate.Exceptions.DataLayerException("Error in NotificacionesCAD.", ex); } finally { SessionClose(); } }
public NotificacionesEN ReadOIDDefault(int id_notificacion ) { NotificacionesEN notificacionesEN = null; try { SessionInitializeTransaction(); notificacionesEN = (NotificacionesEN)session.Get(typeof(NotificacionesEN), id_notificacion); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is YoureOnGenNHibernate.Exceptions.ModelException) { throw ex; } throw new YoureOnGenNHibernate.Exceptions.DataLayerException("Error in NotificacionesCAD.", ex); } finally { SessionClose(); } return(notificacionesEN); }
public void Destroy(int id_notificacion ) { try { SessionInitializeTransaction(); NotificacionesEN notificacionesEN = (NotificacionesEN)session.Load(typeof(NotificacionesEN), id_notificacion); session.Delete(notificacionesEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is YoureOnGenNHibernate.Exceptions.ModelException) { throw ex; } throw new YoureOnGenNHibernate.Exceptions.DataLayerException("Error in NotificacionesCAD.", ex); } finally { SessionClose(); } }
public void Modify(int p_Notificaciones_OID, string p_mensaje) { NotificacionesEN notificacionesEN = null; //Initialized NotificacionesEN notificacionesEN = new NotificacionesEN(); notificacionesEN.Id_notificacion = p_Notificaciones_OID; notificacionesEN.Mensaje = p_mensaje; //Call to NotificacionesCAD _INotificacionesCAD.Modify(notificacionesEN); }
public void EnviarNotificacion(string moderador_oid, YoureOnGenNHibernate.EN.YoureOn.UsuarioEN usuario, string mensaje) { /*PROTECTED REGION ID(YoureOnGenNHibernate.CEN.YoureOn_Moderador_enviarNotificacion) ENABLED START*/ ModeradorEN moderador = new ModeradorEN(); moderador = _IModeradorCAD.ReadOIDDefault(moderador.Email); NotificacionesEN notificacion = new NotificacionesEN(); if (usuario != null && !mensaje.Equals("") && moderador != null) { notificacion = new NotificacionesEN(notificacion.Id_notificacion, usuario, mensaje, moderador); } /*PROTECTED REGION END*/ }
public int New_(NotificacionesEN notificaciones) { try { SessionInitializeTransaction(); if (notificaciones.Usuario != null) { // Argumento OID y no colección. notificaciones.Usuario = (YoureOnGenNHibernate.EN.YoureOn.UsuarioEN)session.Load(typeof(YoureOnGenNHibernate.EN.YoureOn.UsuarioEN), notificaciones.Usuario.Email); notificaciones.Usuario.Notificaciones .Add(notificaciones); } if (notificaciones.Moderador != null) { // Argumento OID y no colección. notificaciones.Moderador = (YoureOnGenNHibernate.EN.YoureOn.ModeradorEN)session.Load(typeof(YoureOnGenNHibernate.EN.YoureOn.ModeradorEN), notificaciones.Moderador.Email); notificaciones.Moderador.Notificacion_enviada .Add(notificaciones); } session.Save(notificaciones); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is YoureOnGenNHibernate.Exceptions.ModelException) { throw ex; } throw new YoureOnGenNHibernate.Exceptions.DataLayerException("Error in NotificacionesCAD.", ex); } finally { SessionClose(); } return(notificaciones.Id_notificacion); }