Пример #1
0
        private void OnSimulationCommencing(object sender, EventArgs e)
        {
            SelectedOtherAnimalsType = Resources.OtherAnimalsStore().GetByName(AnimalType) as OtherAnimalsType;
            if (SelectedOtherAnimalsType == null)
            {
                throw new Exception("Unknown other animal type: " + AnimalType + " in OtherAnimalsActivityFeed : " + this.Name);
            }

            if (BreedingInterval <= 0)
            {
                Summary.WriteWarning(this, String.Format("Overhead payment interval must be greater than 1 ({0})", this.Name));
                throw new Exception(String.Format("Invalid payment interval supplied for overhead {0}", this.Name));
            }

            if (StartBreedingMonth >= Clock.StartDate.Month)
            {
                NextDueDate = new DateTime(Clock.StartDate.Year, StartBreedingMonth, Clock.StartDate.Day);
            }
            else
            {
                NextDueDate = new DateTime(Clock.StartDate.Year, StartBreedingMonth, Clock.StartDate.Day);
                while (Clock.StartDate > NextDueDate)
                {
                    NextDueDate = NextDueDate.AddMonths(BreedingInterval);
                }
            }
        }
Пример #2
0
 private void OnSimulationCommencing(object sender, EventArgs e)
 {
     SelectedOtherAnimalsType = Resources.OtherAnimalsStore().FindChild(AnimalType) as OtherAnimalsType;
     if (SelectedOtherAnimalsType == null)
     {
         throw new Exception("Unknown other animal type: " + AnimalType + " in OtherAnimalsActivityFeed : " + this.Name);
     }
 }