Exemplo n.º 1
0
 protected ScheduledTask(ScheduledTask original, Cloner cloner)
   : base(original, cloner) {
   this.TaskNr = original.TaskNr;
   this.ResourceNr = original.ResourceNr;
   this.Duration = original.Duration;
   this.StartTime = original.StartTime;
   this.JobNr = original.JobNr;
 }
Exemplo n.º 2
0
    public void ScheduleTask(int resNr, double startTime, double duration, int jobNr) {
      ScheduledTask task = new ScheduledTask(resNr, startTime, duration, jobNr);
      Resource affectedResource = resources[task.ResourceNr];
      int i = 0;
      while (i < affectedResource.Tasks.Count && affectedResource.Tasks[i].StartTime < task.StartTime)
        i++;

      if (!lastScheduledTaskOfJob.ContainsKey(jobNr)) {
        lastScheduledTaskOfJob.Add(jobNr, task);
        task.TaskNr = 0;
      } else {
        task.TaskNr = lastScheduledTaskOfJob[jobNr].TaskNr + 1;
        lastScheduledTaskOfJob[jobNr] = task;
      }

      if (i >= affectedResource.Tasks.Count)
        affectedResource.Tasks.Add(task);
      else
        affectedResource.Tasks.Insert(i, task);

    }