Esempio n. 1
0
        /// <summary>
        /// Do reporting of individuals
        /// </summary>
        /// <returns></returns>
        private void ReportHerd()
        {
            // warning if the same individual is in multiple filter groups it will be entered more than once

            var allRumGroups = this.FindAllChildren <RuminantGroup>();

            if (allRumGroups.Count() > 0)
            {
                // get all filter groups below.
                foreach (var fgroup in allRumGroups)
                {
                    foreach (Ruminant item in Resources.RuminantHerd().Herd.Filter(fgroup))
                    {
                        ReportDetails = new RuminantReportItemEventArgs();
                        if (item is RuminantFemale)
                        {
                            ReportDetails.RumObj = item as RuminantFemale;
                        }
                        else
                        {
                            ReportDetails.RumObj = item as RuminantMale;
                        }
                        ReportItemGenerated(ReportDetails);
                    }
                }
            }
            else // no filter. Use entire herd
            {
                foreach (Ruminant item in Resources.RuminantHerd().Herd)
                {
                    ReportDetails = new RuminantReportItemEventArgs();
                    if (item is RuminantFemale)
                    {
                        ReportDetails.RumObj = item as RuminantFemale;
                    }
                    else
                    {
                        ReportDetails.RumObj = item as RuminantMale;
                    }
                    ReportItemGenerated(ReportDetails);
                }
            }
        }
Esempio n. 2
0
        private void OnCLEMHerdSummary(object sender, EventArgs e)
        {
            // warning if the same individual is in multiple filter groups it will be entered more than once

            ReportDetails = new RuminantReportItemEventArgs();
            if (this.Children.Where(a => a.GetType() == typeof(RuminantFilterGroup)).Count() > 0)
            {
                // get all filter groups below.
                foreach (var fgroup in this.Children.Where(a => a.GetType() == typeof(RuminantFilterGroup)))
                {
                    foreach (Ruminant item in Resources.RuminantHerd().Herd.Filter(fgroup))
                    {
                        if (item.GetType() == typeof(RuminantFemale))
                        {
                            ReportDetails.RumObj = item as RuminantFemale;
                        }
                        else
                        {
                            ReportDetails.RumObj = item as RuminantMale;
                        }
                        ReportItemGenerated(ReportDetails);
                    }
                }
            }
            else // no filter. Use entire herd
            {
                foreach (Ruminant item in Resources.RuminantHerd().Herd)
                {
                    if (item.GetType() == typeof(RuminantFemale))
                    {
                        ReportDetails.RumObj = item as RuminantFemale;
                    }
                    else
                    {
                        ReportDetails.RumObj = item as RuminantMale;
                    }
                    ReportItemGenerated(ReportDetails);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Do reporting of individuals
        /// </summary>
        /// <returns></returns>
        private void ReportHerd()
        {
            // warning if the same individual is in multiple filter groups it will be entered more than once

            // get all filter groups below.
            foreach (var fgroup in this.FindAllChildren <RuminantGroup>())
            {
                foreach (Ruminant item in fgroup.Filter(ruminantHerd?.Herd))
                {
                    ReportDetails = new RuminantReportItemEventArgs();
                    if (item is RuminantFemale)
                    {
                        ReportDetails.RumObj = item as RuminantFemale;
                    }
                    else
                    {
                        ReportDetails.RumObj = item as RuminantMale;
                    }
                    ReportItemGenerated(ReportDetails);
                }
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Report item generated and ready for reporting
 /// </summary>
 /// <param name="e"></param>
 protected virtual void ReportItemGenerated(RuminantReportItemEventArgs e)
 {
     OnReportItemGenerated?.Invoke(this, e);
 }