//---------------------------------------------------------------- public CResultAErreur CalcAnomaliesDates(CProjet projet) { CResultAErreur result = CResultAErreur.True; if (projet == null) { return(result); } if (((projet.TypesAnomaliesFiltres & ETypeAnomalieProjet.NonRespectContrainteDate) == 0)) { if (ElementA == null && ElementB == null) { CAnomalieProjet.CreerAnomalie(ContexteDonnee, projet, ETypeAnomalieProjet.Autre, I.T("Invalid project link : no link end|484"), null); } else if (ElementA == null) { CAnomalieProjet.CreerAnomalie(ContexteDonnee, projet, ETypeAnomalieProjet.Autre, I.T("No link end for link to @1|485", ElementB.DescriptionElement), null); } else if (ElementB == null) { CAnomalieProjet.CreerAnomalie(ContexteDonnee, projet, ETypeAnomalieProjet.Autre, I.T("No link end for link to @1|485", ElementA.DescriptionElement), null); } else { DateTime?date1 = ElementA.DateDebutGantt; DateTime?date2 = ElementB.DateDebutGantt; if (date1 != null && date2 != null) { TimeSpan sp = date1.Value - date2.Value; double fTolerance = 0; if (sp.TotalDays > fTolerance) { result = CAnomalieProjet.CreerAnomalie(ContexteDonnee, projet, ETypeAnomalieProjet.NonRespectContrainteDate, I.T("Constraint error for elements @1 and @2|486", ElementA.DescriptionElement, ElementB.DescriptionElement), this); } } } } return(result); }
//------------------------------------------------------------------- public override CResultAErreur VerifieDonnees(CObjetDonnee objet) { CResultAErreur result = CResultAErreur.True; try { CAnomalieProjet anomalie = (CAnomalieProjet)objet; } catch (Exception e) { result.EmpileErreur(new CErreurException(e)); } return(result); }
//----------------------------------------------- public static CResultAErreur CreerAnomalie( CContexteDonnee ctx, CProjet projetParent, ETypeAnomalieProjet type, string message, IElementAAnomalieProjet elementConcerne) { CAnomalieProjet anomalie = new CAnomalieProjet(ctx); anomalie.CreateNewInCurrentContexte(); anomalie.Projet = projetParent; anomalie.TypeAnomalieCode = (int)type; anomalie.Message = message; anomalie.ElementConcerne = elementConcerne; return(CResultAErreur.True); }