Beispiel #1
0
        public void RemoveReservationForActivity(ScheduleActivity a)
        {
            int index = -1;

            for (int i = 0; i < _reservation.Count; i++)
            {
                ResourceReservation r = _reservation[i];
                if (r.Activity.Equals(a))
                {
                    index = i;
                    break;
                }
            }
            if (index > 0)
            {
                _reservation.RemoveAt(index);
            }
            for (int i = 0; i < Count; i++)
            {
                UnitReservations urs = _unitReservations[i];
                LinkedListNode <UnitReservation> u = urs.First;
                while (u != null)
                {
                    LinkedListNode <UnitReservation> next = u.Next;
                    if (u.Value.Activity.Equals(a))
                    {
                        urs.Remove(u);
                    }
                    u = next;
                }
            }
        }
Beispiel #2
0
 void AddReservation(ResourceReservation reserv)
 {
     _reservation.Add(reserv);
     for (int i = 0; i < reserv.Uint.Length; i++)
     {
         UnitReservations ureservs = _unitReservations[reserv.Uint[i]];
         UnitReservation  urv      = new UnitReservation();
         urv.Resource = this;
         urv.Activity = reserv.Activity;
         urv.Uint     = reserv.Uint[i];
         LinkedListNode <UnitReservation> node    = ureservs.Last;
         LinkedListNode <UnitReservation> newNode = null;
         if (node == null)
         {
             newNode = ureservs.AddFirst(urv);
         }
         else
         {
             while (node != null)
             {
                 if (urv.PlannedStart > node.Value.PlannedStart)
                 {
                     newNode = ureservs.AddAfter(node, urv);
                     break;
                 }
                 node = node.Previous;
             }
             if (node == null)
             {
                 newNode = ureservs.AddFirst(urv);
             }
         }
         reserv.Activity.UnitReservations.Add(newNode);
     }
 }