/// <summary> /// Herd change occurred /// </summary> /// <param name="e"></param> protected virtual void HerdChanged(HerdChangedEventArgs e) { if (OnHerdChanged != null) { OnHerdChanged(this, e); } }
/// <summary> /// Add individual/cohort to the the herd /// </summary> /// <param name="ind">Individual Ruminant to add</param> public void AddRuminant(Ruminant ind) { if (ind.ID == 0) { ind.ID = this.NextUniqueID; } Herd.Add(ind); LastIndividualChanged = ind; HerdChangedEventArgs args = new HerdChangedEventArgs(); args.Details = ind; HerdChanged(args); // remove change flag ind.SaleFlag = Common.HerdChangeReason.None; }
/// <summary> /// Remove individual/cohort from the herd /// </summary> /// <param name="ind">Individual Ruminant to remove</param> public void RemoveRuminant(Ruminant ind) { // Remove mother ID from any suckling offspring if (ind.Gender == Sex.Female) { foreach (var offspring in (ind as RuminantFemale).SucklingOffspring) { offspring.Mother = null; } } Herd.Remove(ind); LastIndividualChanged = ind; HerdChangedEventArgs args = new HerdChangedEventArgs(); args.Details = ind; HerdChanged(args); // remove change flag ind.SaleFlag = Common.HerdChangeReason.None; }
/// <summary> /// Herd change occurred /// </summary> /// <param name="e"></param> protected virtual void HerdChanged(HerdChangedEventArgs e) { if (OnHerdChanged != null) OnHerdChanged(this, e); }