Example #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 = "";

            html += "\n<div class=\"activityentry\">";
            if (FeedTypeName == null || FeedTypeName == "")
            {
                html += "<span class=\"errorlink\">[PASTURE TYPE NOT SET]</span>";
            }
            else
            {
                html += "<span class=\"resourcelink\">" + FeedTypeName + "</span>";
            }
            html += " occupies ";
            Land parentLand = null;

            if (LandTypeNameToUse != null && LandTypeNameToUse != "")
            {
                parentLand = Apsim.Find(this, LandTypeNameToUse.Split('.')[0]) as Land;
            }

            if (UseAreaAvailable)
            {
                html += "the unallocated portion of ";
            }
            else
            {
                if (parentLand == null)
                {
                    html += "<span class=\"setvalue\">" + AreaRequested.ToString("#,##0.###") + "</span> <span class=\"errorlink\">[UNITS NOT SET]</span> of ";
                }
                else
                {
                    html += "<span class=\"setvalue\">" + AreaRequested.ToString("#,##0.###") + "</span> " + parentLand.UnitsOfArea + " of ";
                }
            }
            if (LandTypeNameToUse == null || LandTypeNameToUse == "")
            {
                html += "<span class=\"errorlink\">[LAND NOT SET]</span>";
            }
            else
            {
                html += "<span class=\"resourcelink\">" + LandTypeNameToUse + "</span>";
            }
            html += "</div>";

            html += "\n<div class=\"activityentry\">";
            html += "The simulation starts with <span class=\"setvalue\">" + StartingAmount.ToString("#,##0.##") + "</span> kg/ha";
            html += "</div>";

            return(html);
        }
Example #2
0
        bool FinishCanExecute()
        {
            if (String.IsNullOrEmpty(Name))
            {
                return(false);
            }

            if (BulkQuantity == 0)
            {
                return(false);
            }

            if (StartingAmountIsChecked)
            {
                if (StartingAmount.GetValueOrDefault() == 0)
                {
                    return(false);
                }
            }

            if (NutritionIsChecked)
            {
                if (Calories.GetValueOrDefault() == 0)
                {
                    return(false);
                }

                if (ComplexNutritionIsChecked)
                {
                    if ((Protein.GetValueOrDefault() == 0) || (Fat.GetValueOrDefault() == 0) || (Carbohydrates.GetValueOrDefault() == 0))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }