Ejemplo n.º 1
0
        public BETache modifierTache(int id, string nom, string detail, DateTime debut, DateTime fin, int idUser, List <BECategory> categories, BEEtat etat)
        {
            TacheDao tacheDao = new TacheDao();

            //On vérifie si la tache existe
            if (!tacheDao.TacheExisteDeja(id))
            {
                throw new ArgumentException("La tache n'existe pas.", "id");
            }

            BETache tache = null;

            try
            {
                tache = tacheDao.modifierTache(id, nom, detail, debut, fin, idUser, categories, etat);
                if (tache == null)
                {
                    throw new Exception("La tache est null.");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Une erreur est survenue lors de la modification de la tache.", ex);
            }

            return(tache);
        }
Ejemplo n.º 2
0
        public bool supprimerTache(int id)
        {
            TacheDao tacheDao = new TacheDao();

            //On vérifie si la tache existe
            if (!tacheDao.TacheExisteDeja(id))
            {
                throw new ArgumentException("La tache n'existe pas.", "id");
            }

            bool tache = false;

            try
            {
                tache = tacheDao.supprimerTache(id);
                if (tache == false)
                {
                    throw new Exception("Erreur lors de la suppression de la tache.");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Une erreur est survenue lors de la suppression de la tache.", ex);
            }

            return(tache);
        }