예제 #1
0
        /// <summary>
        /// Provides the description of the model settings for summary (GetFullSummary)
        /// </summary>
        /// <param name="formatForParentControl">Use full verbose description</param>
        /// <returns></returns>
        public override string ModelSummary(bool formatForParentControl)
        {
            string html = "";

            if (this.Parent.GetType() != typeof(RuminantActivityFeed))
            {
                html += "<div class=\"warningbanner\">This Ruminant Feed Group must be placed beneath a Ruminant Activity Feed component</div>";
                return(html);
            }

            RuminantFeedActivityTypes ft = (this.Parent as RuminantActivityFeed).FeedStyle;

            html += "\n<div class=\"activityentry\">";
            switch (ft)
            {
            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
            case RuminantFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                html += "<span class=\"" + ((Value <= 0) ? "errorlink" : "setvalue") + "\">" + Value.ToString() + "kg</span>";
                break;

            case RuminantFeedActivityTypes.ProportionOfFeedAvailable:
            case RuminantFeedActivityTypes.ProportionOfWeight:
            case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
            case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                if (Value != 1)
                {
                    html += "<span class=\"" + ((Value <= 0) ? "errorlink" : "setvalue") + "\">" + Value.ToString("0.##%") + "</span>";
                }
                break;

            default:
                break;
            }

            string starter = " of ";

            if (Value == 1)
            {
                starter = "The ";
            }

            bool overfeed = false;

            html += "<span class=\"setvalue\">";
            switch (ft)
            {
            case RuminantFeedActivityTypes.ProportionOfFeedAvailable:
                html    += " of the available food supply";
                overfeed = true;
                break;

            case RuminantFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                html    += " per individual per day";
                overfeed = true;
                break;

            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                overfeed = true;
                html    += " per day";
                break;

            case RuminantFeedActivityTypes.ProportionOfWeight:
                overfeed = true;
                html    += starter + "live weight";
                break;

            case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
                html += starter + "potential intake";
                break;

            case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                html += starter + "remaining intake";
                break;

            default:
                break;
            }
            html += "</span> ";

            switch (ft)
            {
            case RuminantFeedActivityTypes.ProportionOfFeedAvailable:
                html += "will be fed to all individuals that match the following conditions:";
                break;

            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                html += "combined is fed to all individuals that match the following conditions:";
                break;

            case RuminantFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                html += "is fed to each individual that matches the following conditions:";
                break;

            default:
                html += "is fed to the individuals that match the following conditions:";
                break;
            }
            html += "</div>";

            if (overfeed)
            {
                html += "\n<div class=\"activityentry\">";
                html += "Individual's intake will be limited to Potential intake x the modifer for max overfeeding";
                if (!(this.Parent as RuminantActivityFeed).StopFeedingWhenSatisfied)
                {
                    html += ", with excess food still utilised but wasted";
                }
                html += "</div>";
            }
            if (ft == RuminantFeedActivityTypes.SpecifiedDailyAmount)
            {
                html += "<div class=\"warningbanner\">Note: This is a specified daily amount fed to the entire herd. If insufficient provided, each individual's potential intake will not be met</div>";
            }

            return(html);
        }
        /// <summary>
        /// Provides the description of the model settings for summary (GetFullSummary)
        /// </summary>
        /// <param name="formatForParentControl">Use full verbose description</param>
        /// <returns></returns>
        public override string ModelSummary(bool formatForParentControl)
        {
            using (StringWriter htmlWriter = new StringWriter())
            {
                // get amount
                var grps = MonthlyValues.GroupBy(a => a).OrderBy(a => a.Key);

                RuminantFeedActivityTypes ft = (this.Parent as RuminantActivityFeed).FeedStyle;
                htmlWriter.Write("\r\n<div class=\"activityentry\">");
                if (grps.Count() > 1)
                {
                    htmlWriter.Write("From ");
                }
                htmlWriter.Write("<span class=\"setvalue\">");
                switch (ft)
                {
                case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                    htmlWriter.Write(grps.FirstOrDefault().Key.ToString() + "kg");
                    break;

                case RuminantFeedActivityTypes.ProportionOfWeight:
                case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
                case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                case RuminantFeedActivityTypes.ProportionOfFeedAvailable:
                    if (grps.LastOrDefault().Key != 1)
                    {
                        htmlWriter.Write((Convert.ToDecimal(grps.FirstOrDefault().Key, CultureInfo.InvariantCulture)).ToString("0.##%"));
                    }
                    break;

                default:
                    break;
                }
                htmlWriter.Write("</span>");

                if (grps.Count() > 1)
                {
                    htmlWriter.Write(" to ");
                    htmlWriter.Write("<span class=\"setvalue\">");
                    switch (ft)
                    {
                    case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                        htmlWriter.Write(grps.LastOrDefault().Key.ToString() + "kg");
                        break;

                    case RuminantFeedActivityTypes.ProportionOfWeight:
                    case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
                    case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                    case RuminantFeedActivityTypes.ProportionOfFeedAvailable:
                        htmlWriter.Write((Convert.ToDecimal(grps.LastOrDefault().Key, CultureInfo.InvariantCulture)).ToString("0.##%"));
                        break;

                    default:
                        break;
                    }
                    htmlWriter.Write("</span>");
                }

                string starter = " of ";
                if (grps.Count() == 1 && grps.LastOrDefault().Key == 1)
                {
                    starter = "The ";
                }

                bool overfeed = false;

                htmlWriter.Write("<span class=\"setvalue\">");
                switch (ft)
                {
                case RuminantFeedActivityTypes.ProportionOfFeedAvailable:
                    htmlWriter.Write(" feed available");
                    overfeed = true;
                    break;

                case RuminantFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                    htmlWriter.Write(" per individual per day");
                    overfeed = true;
                    break;

                case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                    htmlWriter.Write(" per day");
                    overfeed = true;
                    break;

                case RuminantFeedActivityTypes.ProportionOfWeight:
                    htmlWriter.Write(starter + "live weight");
                    overfeed = true;
                    break;

                case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
                    htmlWriter.Write(starter + "potential intake");
                    break;

                case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                    htmlWriter.Write(starter + "remaining intake");
                    break;

                default:
                    break;
                }
                htmlWriter.Write("</span> is fed each month to the individuals that match the following conditions:");

                htmlWriter.Write("</div>");

                if (overfeed)
                {
                    htmlWriter.Write("\r\n<div class=\"activityentry\">");
                    htmlWriter.Write("Individual's intake will be limited to Potential intake x the modifer for max overfeeding, with excess food still utilised but wasted");
                    htmlWriter.Write("</div>");
                }

                return(htmlWriter.ToString());
            }
        }
예제 #3
0
        /// <summary>
        /// Provides the description of the model settings for summary (GetFullSummary)
        /// </summary>
        /// <param name="formatForParentControl">Use full verbose description</param>
        /// <returns></returns>
        public override string ModelSummary(bool formatForParentControl)
        {
            string html = "";

            RuminantFeedActivityTypes ft = (this.Parent as RuminantActivityFeed).FeedStyle;

            html += "\n<div class=\"activityentry\">";
            switch (ft)
            {
            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
            case RuminantFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                html += "<span class=\"" + ((Value <= 0) ? "errorlink" : "setvalue") + "\">" + Value.ToString() + "kg</span>";
                break;

            case RuminantFeedActivityTypes.ProportionOfWeight:
            case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
            case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                if (Value != 1)
                {
                    html += "<span class=\"" + ((Value <= 0) ? "errorlink" : "setvalue") + "\">" + Value.ToString("0.##%") + "</span>";
                }
                break;

            default:
                break;
            }

            string starter = " of ";

            if (Value == 1)
            {
                starter = "The ";
            }

            html += "<span class=\"setvalue\">";
            switch (ft)
            {
            case RuminantFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                html += " per individual per day";
                break;

            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                html += " per day";
                break;

            case RuminantFeedActivityTypes.ProportionOfWeight:
                html += starter + "live weight";
                break;

            case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
                html += starter + "potential intake";
                break;

            case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                html += starter + "remaining intake";
                break;

            default:
                break;
            }
            html += "</span> is fed to the individuals that match the following conditions:";
            html += "</div>";
            return(html);
        }
예제 #4
0
        /// <summary>
        /// Provides the description of the model settings for summary (GetFullSummary)
        /// </summary>
        /// <param name="formatForParentControl">Use full verbose description</param>
        /// <returns></returns>
        public override string ModelSummary(bool formatForParentControl)
        {
            string html = "";

            // get amount
            var grps = MonthlyValues.GroupBy(a => a).OrderBy(a => a.Key);

            RuminantFeedActivityTypes ft = (this.Parent as RuminantActivityFeed).FeedStyle;

            html += "\n<div class=\"activityentry\">";
            if (grps.Count() > 1)
            {
                html += "From ";
            }
            html += "<span class=\"setvalue\">";
            switch (ft)
            {
            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                html += grps.FirstOrDefault().Key.ToString() + "kg";
                break;

            case RuminantFeedActivityTypes.ProportionOfWeight:
            case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
            case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                if (grps.LastOrDefault().Key != 1)
                {
                    html += (Convert.ToDecimal(grps.FirstOrDefault().Key, CultureInfo.InvariantCulture)).ToString("0.##%");
                }
                break;

            default:
                break;
            }
            html += "</span>";

            if (grps.Count() > 1)
            {
                html += " to ";
                html += "<span class=\"setvalue\">";
                switch (ft)
                {
                case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                    html += grps.LastOrDefault().Key.ToString() + "kg";
                    break;

                case RuminantFeedActivityTypes.ProportionOfWeight:
                case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
                case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                    html += (Convert.ToDecimal(grps.LastOrDefault().Key, CultureInfo.InvariantCulture)).ToString("0.##%");
                    break;

                default:
                    break;
                }
                html += "</span>";
            }

            string starter = " of ";

            if (grps.Count() == 1 && grps.LastOrDefault().Key == 1)
            {
                starter = "The ";
            }

            html += "<span class=\"setvalue\">";
            switch (ft)
            {
            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                html += " per day";
                break;

            case RuminantFeedActivityTypes.ProportionOfWeight:
                html += starter + "live weight";
                break;

            case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
                html += starter + "potential intake";
                break;

            case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                html += starter + "remaining intake";
                break;

            default:
                break;
            }
            html += "</span> is fed each month to the individuals that match the following conditions:";

            html += "</div>";

            html += "\n<div class=\"activityentry\">";
            html += "Individual's intake will automatically be limited to 1.2 x potential intake, with excess food still utilised";
            html += "</div>";

            return(html);
        }
예제 #5
0
        /// <summary>
        /// Provides the description of the model settings for summary (GetFullSummary)
        /// </summary>
        /// <param name="formatForParentControl">Use full verbose description</param>
        /// <returns></returns>
        public override string ModelSummary(bool formatForParentControl)
        {
            string html = "";

            if (this.Parent.GetType() != typeof(RuminantActivityFeed))
            {
                html += "<div class=\"warningbanner\">This Ruminant Feed Group must be placed beneath a Ruminant Activity Feed parent</div>";
                return(html);
            }

            RuminantFeedActivityTypes ft = (this.Parent as RuminantActivityFeed).FeedStyle;

            html += "\n<div class=\"activityentry\">";
            switch (ft)
            {
            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
            case RuminantFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                html += "<span class=\"" + ((Value <= 0) ? "errorlink" : "setvalue") + "\">" + Value.ToString() + "kg</span>";
                break;

            case RuminantFeedActivityTypes.ProportionOfWeight:
            case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
            case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                if (Value != 1)
                {
                    html += "<span class=\"" + ((Value <= 0) ? "errorlink" : "setvalue") + "\">" + Value.ToString("0.##%") + "</span>";
                }
                break;

            default:
                break;
            }

            string starter = " of ";

            if (Value == 1)
            {
                starter = "The ";
            }

            html += "<span class=\"setvalue\">";
            switch (ft)
            {
            case RuminantFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                html += " per individual per day";
                break;

            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                html += " per day";
                break;

            case RuminantFeedActivityTypes.ProportionOfWeight:
                html += starter + "live weight";
                break;

            case RuminantFeedActivityTypes.ProportionOfPotentialIntake:
                html += starter + "potential intake";
                break;

            case RuminantFeedActivityTypes.ProportionOfRemainingIntakeRequired:
                html += starter + "remaining intake";
                break;

            default:
                break;
            }
            html += "</span> ";
            switch (ft)
            {
            case RuminantFeedActivityTypes.SpecifiedDailyAmount:
                html += "combined is fed to all individuals";
                break;

            case RuminantFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                html += "is fed to each individual";
                break;

            default:
                html += "is fed to the individuals";
                break;
            }
            html += " that match the following conditions:";

            html += "</div>";
            if (ft == RuminantFeedActivityTypes.SpecifiedDailyAmount)
            {
                html += "<div class=\"warningbanner\">Note: This is a specified daily amount fed to the entire herd. If insufficient, this will reduce individual's potential intake</div>";
            }
            return(html);
        }