예제 #1
0
        /// <inheritdoc/>
        public override string ModelSummary()
        {
            using (StringWriter htmlWriter = new StringWriter())
            {
                ZoneCLEM        clemParent = FindAncestor <ZoneCLEM>();
                ResourcesHolder resHolder;
                Finance         finance = null;
                if (clemParent != null)
                {
                    resHolder = clemParent.FindAllChildren <ResourcesHolder>().FirstOrDefault() as ResourcesHolder;
                    finance   = resHolder.FindResourceGroup <Finance>();
                    if (finance != null && !finance.Enabled)
                    {
                        finance = null;
                    }
                }

                if (finance == null)
                {
                    htmlWriter.Write("\r\n<div class=\"activityentry\">This activity is not required as no <span class=\"resourcelink\">Finance</span> resource is available.</div>");
                }
                else
                {
                    htmlWriter.Write("\r\n<div class=\"activityentry\">Interest rates are set in the <span class=\"resourcelink\">FinanceType</span> component</div>");
                    foreach (FinanceType accnt in finance.FindAllChildren <FinanceType>().Where(a => a.Enabled))
                    {
                        if (accnt.InterestRateCharged == 0 & accnt.InterestRatePaid == 0)
                        {
                            htmlWriter.Write("\r\n<div class=\"activityentry\">This activity is not needed for <span class=\"resourcelink\">" + accnt.Name + "</span> as no interest rates are set.</div>");
                        }
                        else
                        if (accnt.InterestRateCharged > 0)
                        {
                            htmlWriter.Write("\r\n<div class=\"activityentry\">This activity will calculate interest charged for <span class=\"resourcelink\">" + accnt.Name + "</span> at a rate of <span class=\"setvalue\">" + accnt.InterestRateCharged.ToString("#.00") + "</span>%</div>");
                        }
                        else
                        {
                            htmlWriter.Write("\r\n<div class=\"activityentry\">This activity will calculate interest paid for <span class=\"resourcelink\">" + accnt.Name + "</span> at a rate of <span class=\"setvalue\">" + accnt.InterestRatePaid.ToString("#.00") + "</span>%</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       = "";
            ZoneCLEM        clemParent = FindAncestor <ZoneCLEM>();
            ResourcesHolder resHolder;
            Finance         finance = null;

            if (clemParent != null)
            {
                resHolder = clemParent.FindAllChildren <ResourcesHolder>().FirstOrDefault() as ResourcesHolder;
                finance   = resHolder.FinanceResource();
            }

            if (finance == null)
            {
                html += "\n<div class=\"activityentry\">This activity is not required as no <span class=\"resourcelink\">Finance</span> resource is available.</div>";
            }
            else
            {
                html += "\n<div class=\"activityentry\">Interest rates are set in the <span class=\"resourcelink\">FinanceType</span> component</div>";
                foreach (FinanceType accnt in finance.FindAllChildren <FinanceType>())
                {
                    if (accnt.InterestRateCharged == 0 & accnt.InterestRatePaid == 0)
                    {
                        html += "\n<div class=\"activityentry\">This activity is not needed for <span class=\"resourcelink\">" + accnt.Name + "</span> as no interest rates are set.</div>";
                    }
                    else
                    {
                        if (accnt.InterestRateCharged > 0)
                        {
                            html += "\n<div class=\"activityentry\">This activity will calculate interest charged for <span class=\"resourcelink\">" + accnt.Name + "</span> at a rate of <span class=\"setvalue\">" + accnt.InterestRateCharged.ToString("#.00") + "</span>%</div>";
                        }
                        else
                        {
                            html += "\n<div class=\"activityentry\">This activity will calculate interest paid for <span class=\"resourcelink\">" + accnt.Name + "</span> at a rate of <span class=\"setvalue\">" + accnt.InterestRatePaid.ToString("#.00") + "</span>%</div>";
                        }
                    }
                }
            }
            return(html);
        }