Example #1
0
        public ValiditeConge isCongeValide(Conge c)
        {
            if (c.GetDuree() > CongesRestants)
            {
                return(ValiditeConge.errorPasAssezDeCongesRestants);
            }
            else
            {
                foreach (DateTime d1 in c.GetAllDaysInConge())
                {
                    foreach (Conge autreConge in Conges)
                    {
                        foreach (DateTime d2 in autreConge.GetAllDaysInConge())
                        {
                            if (d1.Date == d2.Date)
                            {
                                return(ValiditeConge.errorChevauchage);
                            }
                        }
                    }
                }
            }

            return(ValiditeConge.ok);
        }
Example #2
0
        public Message(TypeMessage t, string emetteur, Conge o)
        {
            Type     = t;
            Emetteur = emetteur;
            //Date = DateTime.Now;
            Lu = false;
            switch (t)
            {
            case TypeMessage.NotifCongeAller:
                Titre = "Demande de congés";
                //Contenu = "\nDu " + o.Debut + " au " + (o).Fin;
                if ((o).Statut == StatutConge.EnCours)
                {
                    Contenu     = "";
                    Redirection = "/ChefDeService/Index";
                }
                else
                {
                    Redirection = "/RH/Index";
                }
                break;

            case TypeMessage.NotifCongeRetour:
                Titre       = "Votre demande de congés";
                Contenu     = o.Statut.ToString();
                Redirection = "/Conges/Index";
                break;

            default:
                throw new HttpUnhandledException();
            }
        }
Example #3
0
        public void ValiderConge(int idCollab, int idConge)
        {
            Conge conge = bdd.Collaborateurs.First(col => col.Id == idCollab).Conges.FirstOrDefault(con => con.Id == idConge);

            ChangerStatut(conge.Id, StatutConge.Valide);
            int duree = (conge.Fin - conge.Debut).Days;

            ModifierCongesRestant(idCollab, duree);
            bdd.SaveChanges();
        }
Example #4
0
 public void AjoutConge(int idCollab, Conge c)
 {
     bdd.Collaborateurs.FirstOrDefault(collab => collab.Id == idCollab).Conges.Add(c);
     bdd.Conges.Add(c);
     if (c.Type == TypeConge.RTT && c.Statut != StatutConge.Refuse)
     {
         bdd.Collaborateurs.FirstOrDefault(collab => collab.Id == idCollab).CongesRestants -= c.GetDuree();
     }
     bdd.SaveChanges();
 }
Example #5
0
        public void SupprimerDemandeConge(int idCollab, int idConge)
        {
            Conge theConge = ObtenirConge(idConge);

            if (theConge.Type == TypeConge.RTT)
            {
                bdd.Collaborateurs.FirstOrDefault(collab => collab.Id == idCollab).CongesRestants += theConge.GetDuree();
            }
            bdd.Conges.Remove(bdd.Conges.FirstOrDefault(c => c.Id == idConge));

            bdd.SaveChanges();
        }
Example #6
0
        public void EnvoiCongeChef(int idService, int idCollab, int idConge)
        {
            Collaborateur c = bdd.Collaborateurs.FirstOrDefault(col => col.Id == idCollab);
            Service       s = bdd.Services.FirstOrDefault(serv => serv.Id == idService);
            Conge         l = bdd.Conges.FirstOrDefault(conge => conge.Id == idConge);

            if (c != null && s != null && l != null)
            {
                List <Conge> liste = bdd.Services.FirstOrDefault(serv => serv.Id == idService).Conges;
                liste.Add(l);
                bdd.Services.FirstOrDefault(serv => serv.Id == idService).Conges.Add(l);
                bdd.SaveChanges();
            }
        }
Example #7
0
 public void AjoutConge(int idCollab, Conge c)
 {
     bdd.Collaborateurs.FirstOrDefault(collab => collab.Id == idCollab).Conges.Add(c);
     bdd.SaveChanges();
 }