Ejemplo n.º 1
0
        /// <inheritdoc/>
        public override string ModelSummary()
        {
            using (StringWriter htmlWriter = new StringWriter())
            {
                if (this.Parent.GetType() != typeof(LabourActivityFeed))
                {
                    htmlWriter.Write("<div class=\"warningbanner\">This Labour Feed Group must be placed beneath a Labour Activity Feed component</div>");
                    return(htmlWriter.ToString());
                }

                LabourFeedActivityTypes ft = (this.Parent as LabourActivityFeed).FeedStyle;
                htmlWriter.Write("\r\n<div class=\"activityentry\">");
                switch (ft)
                {
                case LabourFeedActivityTypes.SpecifiedDailyAmountPerAE:
                case LabourFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                    htmlWriter.Write("<span class=\"" + ((Value <= 0) ? "errorlink" : "setvalue") + "\">" + Value.ToString() + "</span>");
                    break;

                default:
                    break;
                }

                ZoneCLEM           zoneCLEM  = FindAncestor <ZoneCLEM>();
                ResourcesHolder    resHolder = zoneCLEM.FindChild <ResourcesHolder>();
                HumanFoodStoreType food      = resHolder.FindResourceType <HumanFoodStore, HumanFoodStoreType>(this, (this.Parent as LabourActivityFeed).FeedTypeName, OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore);
                if (food != null)
                {
                    htmlWriter.Write(" " + food.Units + " ");
                }

                htmlWriter.Write("<span class=\"setvalue\">");
                switch (ft)
                {
                case LabourFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                    htmlWriter.Write(" per individual per day");
                    break;

                case LabourFeedActivityTypes.SpecifiedDailyAmountPerAE:
                    htmlWriter.Write(" per AE per day");
                    break;

                default:
                    break;
                }
                htmlWriter.Write("</span> ");
                switch (ft)
                {
                case LabourFeedActivityTypes.SpecifiedDailyAmountPerAE:
                case LabourFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                    htmlWriter.Write("is fed to each individual");
                    break;
                }
                htmlWriter.Write(" that matches the following conditions:");

                htmlWriter.Write("</div>");
                return(htmlWriter.ToString());
            }
        }
Ejemplo n.º 2
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(LabourActivityFeed))
            {
                html += "<div class=\"warningbanner\">This Labour Feed Group must be placed beneath a Labour Activity Feed component</div>";
                return(html);
            }

            LabourFeedActivityTypes ft = (this.Parent as LabourActivityFeed).FeedStyle;

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

            default:
                break;
            }


            ZoneCLEM           zoneCLEM  = Apsim.Parent(this, typeof(ZoneCLEM)) as ZoneCLEM;
            ResourcesHolder    resHolder = Apsim.Child(zoneCLEM, typeof(ResourcesHolder)) as ResourcesHolder;
            HumanFoodStoreType food      = resHolder.GetResourceItem(this, (this.Parent as LabourActivityFeed).FeedTypeName, OnMissingResourceActionTypes.Ignore, OnMissingResourceActionTypes.Ignore) as HumanFoodStoreType;

            if (food != null)
            {
                html += " " + food.Units + " ";
            }

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

            case LabourFeedActivityTypes.SpecifiedDailyAmountPerAE:
                html += " per AE per day";
                break;

            default:
                break;
            }
            html += "</span> ";
            switch (ft)
            {
            case LabourFeedActivityTypes.SpecifiedDailyAmountPerAE:
            case LabourFeedActivityTypes.SpecifiedDailyAmountPerIndividual:
                html += "is fed to each individual";
                break;
            }
            html += " that matches the following conditions:";

            html += "</div>";
            return(html);
        }