Beispiel #1
0
 public MilestoneRelationship_Pin(IMilestone dependent, IMilestone independent)
     : base(dependent, independent)
 {
     if (m_dependent != null)
     {
         throw new ApplicationException("The MilestoneRelationship_Pin relationship uses only the independent milestone, and you have specified a dependent one. The dependent milestone should be null.");
     }
     m_independentDateTime = m_independent.DateTime;
     AssessInitialCorrectnessForCtor();
 }
Beispiel #2
0
 /// <summary>
 /// Imposes changes on the dependent milestone, if the independent one changes.
 /// </summary>
 /// <param name="independent">The one that might be changed to kick off this rule.</param>
 /// <param name="dependent">The one upon which a resulting change is imposed by this rule.</param>
 public MilestoneRelationship(IMilestone dependent, IMilestone independent)
 {
     m_independent = independent;
     m_dependent   = dependent;
     m_enabled     = new Stack();
     m_enabled.Push(true);
     if (m_independent != null)
     {
         m_independent.AddRelationship(this);
     }
     if (m_dependent != null)
     {
         m_dependent.AddRelationship(this);
     }
 }
Beispiel #3
0
        private static void _GatherAllMilestones(ref List <IMilestone> list, Activity activity, object aspectKey)
        {
            IMilestone sm = (activity.GetTimePeriodAspect(aspectKey)).StartMilestone;
            IMilestone em = (activity.GetTimePeriodAspect(aspectKey)).EndMilestone;

            if (!list.Contains(sm))
            {
                list.Add(sm);
            }
            if (!list.Contains(em))
            {
                list.Add(em);
            }
            foreach (var treeNode in activity.Children)
            {
                Activity child = (Activity)treeNode;
                _GatherAllMilestones(ref list, child, aspectKey);
            }
        }
Beispiel #4
0
 private static void _CheckForCyclicDependencies(IMilestone prospectiveMover, ref Stack callStack)
 {
     if (!callStack.Contains(prospectiveMover))
     {
         callStack.Push(prospectiveMover);
         foreach (MilestoneRelationship mr in prospectiveMover.Relationships)
         {
             if (mr.Enabled && mr.Independent.Equals(prospectiveMover))
             {
                 foreach (MilestoneRelationship recip in mr.Reciprocals)
                 {
                     recip.PushEnabled(false);
                 }
                 callStack.Push(mr);
                 _CheckForCyclicDependencies(mr.Dependent, ref callStack);
                 foreach (MilestoneRelationship recip in mr.Reciprocals)
                 {
                     recip.PopEnabled();
                 }
             }
         }
     }
     else
     {
         object obj;
         while (callStack.Count > 0)
         {
             obj = callStack.Pop();
             if (obj is IMilestone)
             {
                 IMilestone ms = (IMilestone)obj;
                 Console.WriteLine("Milestone : " + ms);
             }
             else if (obj is MilestoneRelationship)
             {
                 MilestoneRelationship mr = (MilestoneRelationship)obj;
                 Console.WriteLine("Relationship : " + mr);
             }
         }
         Console.WriteLine();
     }
 }
 private void SaveMilestones(IMilestone[] milestones)
 {
     var projectEngine = _engineFactory.GetProjectEngine();
     var mileStoneEngine = _engineFactory.GetMilestoneEngine();
     foreach (var milestone in milestones.Where(x => _withClosed ? true : !x.Completed))
     {
         try
         {
             Milestone newMilestone = new Milestone()
             {
                 Title = ReplaceLineSeparator(milestone.Title),
                 DeadLine = milestone.Deadline,
                 Status = milestone.Completed ? MilestoneStatus.Closed : MilestoneStatus.Open,
                 Project = projectEngine.GetByID(FindProject(milestone.ProjectID)),
                 IsKey = false,
                 IsNotify = false
             };
             newMilestone = mileStoneEngine.SaveOrUpdate(newMilestone, false, true);
             NewMilestonesID.Add(new MilestoneIDWrapper() { inBasecamp = milestone.ID, inProjects = newMilestone.ID });
         }
         catch (Exception e)
         {
             Status.LogError(string.Format(SettingsResource.FailedToSaveMilestone, milestone.Title), e);
             LogError(string.Format("milestone '{0}' failed", milestone.Title), e);
             NewMilestonesID.RemoveAll(x => x.inBasecamp == milestone.ID);
         }
     }
 }
Beispiel #6
0
 public MilestoneRelationship_GTE(IMilestone dependent, IMilestone independent)
     : base(dependent, independent)
 {
     m_delta = independent.DateTime - dependent.DateTime;
     AssessInitialCorrectnessForCtor();
 }