/// <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()); } }
/// <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); }