/// <summary> /// Recherche dans la BD les informations (person/following/group) pour une Person /// </summary> /// <param name="context">La connection à la base de données</param> /// <param name="personID">Le ID de la personne</param> /// <returns>Une liste qui contient la personne ses following et ses groupes</returns> public IEnumerable <person> GetPersonData(pigeonsEntities1 context, object personID) { Expression <Func <person, bool> > filter = (p => p.Id == (int)personID && p.followings.Any(f => f.Is_active && f.group.Is_active)); string includedProperty = "followings"; return(Get(context, filter, null, includedProperty)); }
/// <summary> /// Get a group by searching a value in a column /// </summary> /// <param name="context">The connection</param> /// <param name="columnName">The name of the column in the table</param> /// <param name="value">The value to search</param> /// <returns>A list of groups that match the query</returns> public new IEnumerable <group> GetBy(pigeonsEntities1 context, string columnName, object value) { Expression <Func <group, bool> > filter = null; try { switch (columnName) { case group.COLUMN_NAME: filter = (g => g.Name == (string)value); break; case group.COLUMN_IS_ACTIVE: filter = (g => g.Is_active == (bool)value); break; case group.COLUMN_DESCRIPTION: filter = (g => g.Description == (string)value); break; case group.COLUMN_CREATION_DATE: //groupList = dao.Get(g => DbFunctions.TruncateTime(g.Creation_date).Equals( ((DateTime)value).Date) ); break; default: break; } return(Get(context, filter)); } catch (Exception ex) when(ex is EntityException || ex is DAOException) { throw new DAOException("Erreur dans le GroupDAO GetBy : " + ex.Message); } }
/// <summary> /// Appel le DAO afin de mettre à jour les informations d'un groupe /// </summary> /// <param name="groupID">Le ID du group à mettre à jour</param> /// <param name="groupToUpdate">Le group avec les nouvelles valeurs</param> /// <returns></returns> public group UpdateGroup(object groupID, group groupToUpdate) { if (groupID == null) { throw new ServiceException("Le ID du groupe ne peut pas être null"); } if (groupToUpdate == null) { throw new ServiceException("Le groupe à updater est null"); } try { using (var context = new pigeonsEntities1()) { group groupValidation = groupDAO.GetByID(context, groupID); if (groupValidation == null) { throw new ServiceException(string.Format("Le groupe no.{0} n'existe pas. Impossible de le mettre a jour", groupID)); } groupValidation = groupToUpdate; groupDAO.Update(context, groupValidation); context.SaveChanges(); return(groupValidation); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Recherche d'une Person qui inclu la person, ses following et ses group /// </summary> /// <param name="personID">Le ID de la personne</param> /// <returns>La person et ses information qui corresponde au ID. Null sinon</returns> public person GetPersonData(object personID) { if (personID == null) { throw new ServiceException("Erreur GetPersonDate : Le ID de la personne est null"); } try { using (var context = new pigeonsEntities1()) { List <person> personList = personDAO.GetPersonData(context, personID).ToList(); if (personList.Count() != 1) { throw new ServiceException("Erreur personService GetPersonData : La requête ne retourne pas qu'une personne"); } return(personList[0]); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Finding all the groups a person is registered too /// </summary> /// <param name="personID">The ID of the person we want the groups</param> /// <returns>A list of active groups that a person is following or an empty list of he is not following any group</returns> public IList <group> GetPersonGroups(object personID) { if (personID == null) { throw new ServiceException("The ID of the person is null"); } IList <group> personGroups = new List <group>(); IList <following> personFollowings = new List <following>(); try { using (var context = new pigeonsEntities1()) { // Getting the list of followings personFollowings = (followingDAO.GetPersonFollowingGroups(context, personID)).ToList(); if (personFollowings.Count() > 0) { foreach (following followingGroup in personFollowings) { personGroups.Add(followingGroup.group); } } } return(personGroups); } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Appel du DAO pour avoir la liste de tout les message chat d'un Group /// </summary> /// <param name="groupID">Le ID du Group pour lequel les messages sont voulues</param> /// <returns>Une liste de chatMessage ou bien un liste vide</returns> public IEnumerable <chathistory> GetAllMessagesFromGroup(object groupID) { if (groupID == null) { throw new ServiceException("Le ID du groupe est null"); } try { using (var context = new pigeonsEntities1()) { group groupValidation = groupDAO.GetByID(context, groupID); if (groupValidation == null) { throw new ServiceException(string.Format("Le groupe no.{0} n'existe pas. Impossible de récupérer les messages", groupID)); } if (!groupValidation.Is_active) { throw new ServiceException(string.Format("Le groupe no.{0} n'est pas actif en ce moment. Impossible de récupérer les messages", groupID)); } return(chatHistoryDAO.GetAllMessagesByGroup(context, groupID)); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Recherche d'une assignation par sa clé primaire /// </summary> /// <param name="context">La connexion</param> /// <param name="personID">Le ID de la person</param> /// <param name="taskID">Le ID de la Task</param> /// <returns>Une assignation si elle existe. Null sinon</returns> public assignation GetByID(pigeonsEntities1 context, object personID, object taskID) { Expression <Func <assignation, bool> > filter = (a => a.Person_ID == (int)personID && a.Task_ID == (int)taskID); IList <assignation> assignations = Get(context, filter).ToList(); return((assignations.Count() == 1) ? assignations[0] : null); }
/// <summary> /// Indique une Task comme complété ou non /// </summary> /// <param name="taskID">Le ID de la Task à modifier</param> /// <param name="completed">True si la task est complété, False si elle ne l'est pas</param> public void UpdateTaskCompleted(object taskID, bool completed) { if (taskID == null) { throw new ServiceException("Le ID de la Task est null"); } try { task taskValidation = GetByID(taskID); if (taskValidation.Is_completed == completed) { throw new ServiceException(string.Format("La Task no.{0} est déjà dans l'état désiré ( {1} )", taskID, completed)); } using (var context = new pigeonsEntities1()) { taskValidation.Is_completed = completed; taskDAO.Update(context, taskValidation); context.SaveChanges(); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Recherche d'une Entity dans la base de donnée à partir d'une requête Linq /// </summary> /// <param name="context">La connection vers la base de données</param> /// <param name="filter">La requête</param> /// <param name="orderBy">La colonne utilisé pour trier les résultats</param> /// <param name="includeProperties">Pour inclure une autre table dans le résultat (LazyLoading = False)</param> /// <returns>Une liste d'Entity qui correspond à la requête. Une liste vide sinon.</returns> public virtual IEnumerable <TEntity> Get( pigeonsEntities1 context, Expression <Func <TEntity, bool> > filter = null, Func <IQueryable <TEntity>, IOrderedQueryable <TEntity> > orderBy = null, string includeProperties = "") { try { IQueryable <TEntity> query = context.Set <TEntity>(); if (filter != null) { query = query.Where(filter); } foreach (var includeProperty in includeProperties.Split (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { query = query.Include(includeProperty); } if (orderBy != null) { return(orderBy(query).ToList()); } else { return(query.AsNoTracking().ToList()); } } catch (Exception ex) when(ex is ArgumentException || ex is EntityException) { throw new DAOException("Erreur dans le Get du DAO " + ex.Message); } }
/// <summary> /// Vérification si la person qui accède à un groupe est l'administrateur /// </summary> /// <param name="personID">Le ID de la personne qui accède au groupe</param> /// <param name="groupID">Le ID du groupe que la personne tente d'accèder</param> /// <returns>True si la personne est admin, false sinon</returns> public bool PersonIsGroupAdmin(object personID, object groupID) { if (personID == null) { throw new ServiceException("Le ID de la personne est null"); } if (groupID == null) { throw new ServiceException("Le ID du groupe est null"); } try { using (var context = new pigeonsEntities1()) { following adminValidation = followingDAO.GetByID(context, personID, groupID); if (adminValidation == null) { throw new ServiceException("Cette personne n'existe pas"); } // returning the value return(adminValidation.Is_admin); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Efface un fichier sur le serveur selon son chemin vers celui-ci /// </summary> /// <param name="filePath">Le chemin sur le serveur du fichier</param> public void DeleteFileByFilePath(object filePath) { if (filePath == null) { throw new ServiceException("Le filePath est null"); } try { using (var context = new pigeonsEntities1()) { List<file> fileValidation = fileDAO.GetByFilePath(context, filePath).ToList(); if (fileValidation == null) { throw new ServiceException(string.Format("Aucun fichier n'est trouvé avec ce lien : {0}", filePath.ToString())); } if (fileValidation.Count() != 1) { throw new ServiceException(string.Format("Le chemin envoyer ( {0} ) retourne plus qu'un ficher, veuillez revérififer votre chemin", filePath.ToString())); } fileDAO.Delete(context, fileValidation[0]); context.SaveChanges(); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Appel du DAO afin de créer un nouvel Event /// </summary> /// <param name="newEvent">Le Event à insérer dans la base de donnée</param> /// <returns>L'Event si créer. Null sinon</returns> public @event CreateNewEvent(@event newEvent) { if (newEvent == null) { throw new ServiceException("Le nouvel évènement est null"); } if (newEvent.Group_ID == 0) { throw new ServiceException("Le ID du groupe pour créer l'évènement est null"); } if (string.IsNullOrEmpty(newEvent.Description)) { throw new ServiceException("Le nouvel évènement doit avoir une description"); } try { using (var context = new pigeonsEntities1()) { // Validation du groupe group groupValidation = groupDAO.GetByID(context, newEvent.Group_ID); if (groupValidation == null) { throw new ServiceException(string.Format("Le groupe no.{0} n'existe pas", newEvent.Group_ID)); } if (!groupValidation.Is_active) { throw new ServiceException(string.Format("Le groupe no.{0} n'est pas actif. Impossible de créer un évènement", newEvent.Group_ID)); } if (newEvent.Event_End == default(DateTime)) { newEvent.Event_End = null; } // Validation des dates if (newEvent.Event_End != null && newEvent.Event_Start != null) { if (newEvent.Event_End < newEvent.Event_Start) { throw new ServiceException(string.Format("La date de fin : {0} ne peut pas précéder la date de départ : {1}", newEvent.Event_End, newEvent.Event_Start)); } } // Insertion de l'event newEvent.Is_Completed = false; eventDAO.Insert(context, newEvent); context.SaveChanges(); return(newEvent); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Appel du FileDAO pour avoir les informations sur les fichier associés à un Group /// </summary> /// <param name="groupID">Le ID du group pour lequel nous voulons les fichiers</param> /// <returns>Une liste de fichier ou une liste vide</returns> public IEnumerable<file> GetFilesByGroup(object groupID) { if (groupID == null) { throw new ServiceException("Le ID du group est null"); } try { using (var context = new pigeonsEntities1()) { group groupValidation = groupDAO.GetByID(context, groupID); if (groupValidation == null) { throw new ServiceException(string.Format("Le groupe no.{0} n'existe pas", groupID)); } if (!groupValidation.Is_active) { throw new ServiceException(string.Format("Le groupe no.{0} n'est pas actif. Impossible de récupérer ses fichiers", groupID)); } return fileDAO.GetFilesByGroup(context, groupID); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Get a following by search a value in a column /// </summary> /// <param name="context">The connection</param> /// <param name="columnName">The name of the column in the table</param> /// <param name="value">The value to search</param> /// <returns>A list of following that match the query</returns> public new IEnumerable <following> GetBy(pigeonsEntities1 context, string columnName, object value) { Expression <Func <following, bool> > filter = null; try { switch (columnName.ToLower()) { case following.COLUMN_PERSON_ID: filter = (f => f.Person_Id == (int)value); break; case following.COLUMN_GROUP_ID: filter = (f => f.Group_id == (int)value); break; default: break; } return(Get(context, filter)); } catch (Exception ex) when(ex is EntityException || ex is DAOException) { throw new DAOException("Erreur dans le FollowingDAO GetBy : " + ex.Message); } }
/// <summary> /// Appel du DAO afin de retirer une assignation à une Person /// </summary> /// <param name="taskID">Le ID de la la task assignée</param> /// <param name="personID">Le ID de la personne à qui la Task est assigné</param> public void RemoveAssignation(object taskID, object personID) { if (taskID == null) { throw new ServiceException("Le ID de la Task est null"); } if (personID == null) { throw new ServiceException("Le ID de la Personne est null"); } try { using (var context = new pigeonsEntities1()) { assignation assignationValidation = assignationDAO.GetByID(context, personID, taskID); if (assignationValidation == null) { throw new ServiceException(string.Format("L'assignation (personID : {0}, taskID : {1}) n'existe pas", personID, taskID)); } assignationDAO.Delete(context, assignationValidation); context.SaveChanges(); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Get a message by searching a value in a column /// </summary> /// <param name="context">The connection</param> /// <param name="columnName">The name of the column in the table</param> /// <param name="value">The value to search</param> /// <returns>A list of message that match the query</returns> public new IEnumerable <message> GetBy(pigeonsEntities1 context, string columnName, object value) { Expression <Func <message, bool> > filter = null; try { switch (columnName.ToLower()) { case message.COLUMN_AUTHOR_ID: filter = (m => m.Author_Id == (int)value); break; case message.COLUMN_GROUP_ID: filter = (m => m.Group_Id == (int)value); break; case message.COLUMN_CONTENT: filter = (m => m.Content.ToLower().Contains(((string)value).ToLower())); break; case message.COLUMN_DATE_CREATED: //messageList = Get(m => DbFunctions.TruncateTime(m.Date_created).Equals( ((DateTime)value).Date) ); break; default: break; } return(Get(context, filter)); } catch (Exception ex) when(ex is EntityException || ex is DAOException) { throw new DAOException("Erreur dans le MessageDAO GetBy : " + ex.Message); } }
/// <summary> /// Get an assignation by searching a value in a column /// </summary> /// <param name="context">The connection</param> /// <param name="columnName">The name of the column in the table</param> /// <param name="value">The value to search</param> /// <returns>A list of assignations that match the query</returns> public new IEnumerable <assignation> GetBy(pigeonsEntities1 context, string columnName, object value) { Expression <Func <assignation, bool> > filter = null; try { switch (columnName.ToLower()) { case assignation.COLUMN_PERSON_ID: filter = (t => t.Person_ID == (int)value); break; case assignation.COLUMN_TASK_ID: filter = (t => t.Task_ID == (int)value); break; default: break; } return(Get(context, filter)); } catch (Exception ex) when(ex is EntityException || ex is DAOException) { throw new DAOException(ex.Message); } }
/// <summary> /// Appel le DAO pour effacer une Task de la base de données /// </summary> /// <param name="taskID">Le ID de la Task qui doit être effacé</param> public void DeleteTask(object taskID) { if (taskID == null) { throw new ServiceException("Le ID de la Task est null"); } try { task taskValidation = GetByID(taskID); if (taskValidation == null) { throw new ServiceException(string.Format("La Task no.{0} n'existe pas", taskID)); } using (var context = new pigeonsEntities1()) { taskDAO.Delete(context, taskID); context.SaveChanges(); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Get a person by searching a value in a column /// </summary> /// <param name="context">The connection</param> /// <param name="columnName">The name of the column in the table</param> /// <param name="value">The value to search</param> /// <returns>A list of person that match the query</returns> public new IEnumerable <person> GetBy(pigeonsEntities1 context, string columnName, object value) { Expression <Func <person, bool> > filter = null; try { switch (columnName.ToLower()) { case person.COLUMN_NAME: filter = (p => p.Name.ToLower() == ((string)value).ToLower()); break; case person.COLUMN_EMAIL: filter = (p => p.Email.ToLower() == ((string)value).ToLower()); break; case person.COLUMN_PASSWORD: filter = (p => p.Password == (string)value); break; case person.COLUMN_INSCRIPTION_DATE: break; case person.COLUMN_BIRTH_DATE: break; case person.COLUMN_PHONE_NUMBER: filter = (p => p.Phone_number.ToLower() == ((string)value).ToLower()); break; case person.COLUMN_ORGANIZATION: filter = (p => p.Organization.ToLower() == ((string)value).ToLower()); break; case person.COLUMN_POSITION: filter = (p => p.Position.ToLower() == ((string)value).ToLower()); break; case person.COLUMN_DESCRIPTION: filter = (p => p.Description.ToLower().Contains(((string)value).ToLower())); break; case person.COLUMN_ALL: filter = (p => p.Email.ToLower().Contains(((string)value).ToLower()) || p.Name.ToLower().Contains(((string)value).ToLower())); break; default: break; } return(Get(context, filter)); } catch (Exception ex) when(ex is EntityException || ex is DAOException) { throw new DAOException(ex.Message); } }
/// <summary> /// Retire un 'follower' d'un groupe (Set is_active à false) /// </summary> /// <param name="groupID">Le ID du groupe pour lequel la personne est retirée</param> /// <param name="followerID">Le ID du 'follower' à retirer</param> /// <returns>Retourne True si la personne est retirer. False sinon</returns> public bool RemoveTheFollower(object groupID, object followerID) { if (groupID == null) { throw new ServiceException("Le ID du groupe est null"); } if (followerID == null) { throw new ServiceException("Le ID du follower est null"); } try { using (var context = new pigeonsEntities1()) { group groupValidation = groupDAO.GetByID(context, groupID); if (groupValidation == null) { throw new ServiceException("Ce groupe n'existe pas"); } if (!groupValidation.Is_active) { throw new ServiceException("Ce groupe n'est pas actif, impossible de le changer"); } following follower = followingDAO.GetByID(context, followerID, groupID); if (follower == null) { throw new ServiceException("Ce follower n'existe pas"); } if (!follower.Is_active) { throw new ServiceException("Ce follower ne suis déjà plus ce groupe"); } if (follower.Is_admin) { throw new ServiceException("Il est impossible de retirer l'admin d'un groupe"); } follower.Is_active = false; followingDAO.Update(context, follower); context.SaveChanges(); return(true); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Recherche de toute les Entity contenu dans une table /// </summary> /// <param name="context">La connection vers la base de données</param> /// <returns>Une liste avec tout les Entity de la table</returns> public virtual IEnumerable <TEntity> GetAll(pigeonsEntities1 context) { try { return(context.Set <TEntity>().AsNoTracking().ToList()); } catch (Exception ex) when(ex is ArgumentException || ex is EntityException) { throw new DAOException("Erreur dans le GetAll du DAO " + ex.Message); } }
/// <summary> /// Recherche une Entity dans la base de donnée par sa clé primaire /// </summary> /// <param name="context">La connection vers la base de données</param> /// <param name="id">Le ID de l'entity recherchée</param> /// <returns>L'Entity ou null</returns> public virtual TEntity GetByID(pigeonsEntities1 context, object id) { try { return(context.Set <TEntity>().Find(id)); } catch (Exception ex) when(ex is ArgumentException || ex is EntityException) { throw new DAOException("Erreur dans le GetByID du DAO " + ex.Message); } }
/// <summary> /// Insert une Entity dans la base de donnée /// </summary> /// <param name="context">La connection vers la base de données</param> /// <param name="entity">L'Entity qui doit être inséré</param> public virtual void Insert(pigeonsEntities1 context, TEntity entity) { try { context.Set <TEntity>().Add(entity); } catch (Exception ex) when(ex is ArgumentException || ex is EntityException) { throw new DAOException("Erreur dans le Insert du DAO " + ex.Message); } }
/// <summary> /// Recherche une Entity dans la base de donnée à partir d'une valeur dans une colonne donnée /// </summary> /// <param name="context">La connection vers la base de données</param> /// <param name="columnName">Le nom de la colonne dans la table</param> /// <param name="value">La valeur à rechercher</param> /// <returns>Une liste d'Entity qui correspond à la recherche. Une liste vide sinon.</returns> public IEnumerable <TEntity> GetBy(pigeonsEntities1 context, string columnName, object value) { try { return(new List <TEntity>()); } catch (Exception ex) when(ex is ArgumentException || ex is EntityException) { throw new DAOException("Erreur dans le GetBy du DAO " + ex.Message); } }
/// <summary> /// Recherche un fichier en fonction de son chemin sur le serveur /// </summary> /// <param name="context">La connection à la base de données</param> /// <param name="filePath">Le chemin vers le fichier sur le serveur</param> public IEnumerable <file> GetByFilePath(pigeonsEntities1 context, object filePath) { try { Expression <Func <file, bool> > filter = (f => f.FileURL == (string)filePath); return(Get(context, filter)); } catch (Exception ex) when(ex is EntityException || ex is DAOException) { throw new DAOException("Erreur dans le FileDAO GetByFilePath : " + ex.Message); } }
/// <summary> /// Efface un Entity de la base de données par sa clé primaire /// </summary> /// <param name="context">La connection vers la base de données</param> /// <param name="id">Le ID de l'Entity à effacer</param> public virtual void Delete(pigeonsEntities1 context, object id) { try { TEntity entityToDelete = context.Set <TEntity>().Find(id); Delete(context, entityToDelete); } catch (Exception ex) when(ex is ArgumentException || ex is EntityException) { throw new DAOException("Erreur dans le Delete du DAO " + ex.Message); } }
/// <summary> /// Assignation d'un Task à une personne /// </summary> /// <param name="newAssignation">La nouvelle assignation</param> /// <returns></returns> public assignation AssignTaskToPerson(assignation newAssignation) { if (newAssignation == null) { throw new ServiceException("L'assignation à créer est null"); } if (newAssignation.Person_ID == 0) { throw new ServiceException("Vous devez fournir le ID de la personne à qui assigner la Task"); } if (newAssignation.Task_ID == 0) { throw new ServiceException("Vous devez fournir le ID de la Task qui doit être assigné"); } try { using (var context = new pigeonsEntities1()) { // Validation de l'assignation assignation assignationValidation = assignationDAO.GetByID(context, newAssignation.Person_ID, newAssignation.Task_ID); if (assignationValidation != null) { throw new ServiceException(string.Format("La person ID : {0} est déjà associé à cette tâche (ID : {1})", assignationValidation.Person_ID, assignationValidation.ID)); } // Validation de la task task taskValidation = taskDAO.GetByID(context, newAssignation.Task_ID); if (taskValidation == null) { throw new ServiceException("Cette Task n'existe pas"); } if (taskValidation.Is_completed) { throw new ServiceException(string.Format("La Task no.{0} ({1}) est déjà complété. Impossible d'assigner une personne", taskValidation.Id, taskValidation.Description)); } // Tout est beau, ajouter à la BD assignationDAO.Insert(context, newAssignation); context.SaveChanges(); return(newAssignation); } } catch (DAOException daoException) { throw new ServiceException(daoException.Message); } }
/// <summary> /// Recherche des Files d'un Group dans la base de donnée /// </summary> /// <param name="context">La connection à la base de données</param> /// <param name="groupID">Le ID du group pour lequel nous voulons les Files</param> /// <returns>Une liste de File ou un liste vide</returns> public IEnumerable <file> GetFilesByGroup(pigeonsEntities1 context, object groupID) { try { Expression <Func <file, bool> > filter = (f => f.Group_ID == (int)groupID); return(Get(context, filter).OrderBy(f => f.Creation_Date)); } catch (Exception ex) when(ex is EntityException || ex is DAOException) { throw new DAOException("Erreur dans le FileDAO GetFilesByGroup : " + ex.Message); } }
/// <summary> /// Mise à jour d'une Entity dans la base de donnée /// </summary> /// <param name="context">La connection vers la base de données</param> /// <param name="entityToUpdate">L'Entity à updater</param> public virtual void Update(pigeonsEntities1 context, TEntity entityToUpdate) { try { context.Set <TEntity>().Attach(entityToUpdate); context.Entry(entityToUpdate).State = EntityState.Modified; } catch (Exception ex) when(ex is ArgumentException || ex is EntityException) { throw new DAOException("Erreur dans le Update du DAO " + ex.Message); } }
/// <summary> /// Recherche de tout les Events non complété pour un Group /// </summary> /// <param name="context">La connection</param> /// <param name="groupID">Le ID du groupe</param> /// <returns>Une liste de Events ou une liste vide</returns> public IEnumerable <@event> GetGroupEvent(pigeonsEntities1 context, object groupID) { try { Expression <Func <@event, bool> > filter = (e => e.Group_ID == (int)groupID && !e.Is_Completed); return(Get(context, filter).OrderBy(e => e.Event_Start)); } catch (Exception ex) when(ex is EntityException || ex is DAOException) { throw new DAOException("Erreur dans le EventDAO GetGroupEvent : " + ex.Message); } }