示例#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);
        }
示例#2
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();
        }
示例#3
0
 public void AjoutConge(int idCollab, Conge c, TypeConge type)
 {
     c.Type = type;
     bdd.Collaborateurs.FirstOrDefault(collab => collab.Id == idCollab).Conges.Add(c);
     bdd.Conges.Add(c);
     if (c.Type == TypeConge.RTT)
     {
         bdd.Collaborateurs.FirstOrDefault(collab => collab.Id == idCollab).CongesRestants -= c.GetDuree();
     }
     bdd.SaveChanges();
 }