Beispiel #1
0
        protected string GetDetails(List <IMiniSimDescription> sims)
        {
            int totalHouses = 0, totalResidents = 0;

            List <FamilyFunds.Clumper> funds    = new List <FamilyFunds.Clumper>();
            List <NetWorth.Clumper>    worth    = new List <NetWorth.Clumper>();

            Dictionary <Household, bool> houses = new Dictionary <Household, bool>();

            foreach (IMiniSimDescription miniSim in sims)
            {
                SimDescription member = miniSim as SimDescription;
                if (member == null)
                {
                    continue;
                }

                if (member.Household == null)
                {
                    continue;
                }

                houses[member.Household] = true;
            }

            foreach (Household house in houses.Keys)
            {
                if (house.IsSpecialHousehold)
                {
                    continue;
                }

                totalHouses++;

                totalResidents += CommonSpace.Helpers.Households.NumSimsIncludingPregnancy(house);

                funds.Add(FamilyFunds.New(house));
                worth.Add(NetWorth.New(house));
            }

            string fundBody = FamilyFunds.ToString("SimsByMoney:Element", funds, MasterController.Settings.mByMoneyIntervals);

            string worthBody = NetWorth.ToString("SimsByMoney:Element", worth, MasterController.Settings.mByMoneyIntervals);

            return(Common.Localize("SimsByMoney:Body", false, new object[] { totalHouses, totalResidents, fundBody, worthBody }));
        }
Beispiel #2
0
        }         // SaveToDb

        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendFormat(
                "Calculation Num 1 .........Medal Type {2} Medal: {0} " +
                "NormalizedScore: {1}% Score: {3} Offered amount: {4}\n",
                MedalClassification,
                StringBuilderExtention.ToPercent(TotalScoreNormalized),
                MedalType,
                TotalScore,
                OfferedLoanAmount
                );

            sb.AppendFormat(
                "{0}| {1}| {2}| {3}| {4}| {5}| {6}| {7}| {8} \n",
                "Parameter".PadRight(25),
                "Weight".PadRight(10),
                "MinScore".PadRight(10),
                "MaxScore".PadRight(10),
                "MinGrade".PadRight(10),
                "MaxGrade".PadRight(10),
                "Grade".PadRight(10),
                "Score".PadRight(10),
                "Value"
                );

            var summary = new Weight();

            Weight weight;

            if (MedalType != MedalType.SoleTrader)
            {
                weight = new Weight {
                    Value       = BusinessScore.ToString(CultureInfo.InvariantCulture),
                    FinalWeight = BusinessScoreWeight,
                    Grade       = (int)BusinessScoreGrade,
                    Score       = BusinessScoreScore
                };
                sb.AddWeight(weight, "BusinessScore", ref summary);
            }             // if

            if (MedalType == MedalType.Limited || MedalType == MedalType.OnlineLimited)
            {
                weight = new Weight {
                    Value       = TangibleEquity.ToString(CultureInfo.InvariantCulture),
                    FinalWeight = TangibleEquityWeight,
                    Grade       = (int)TangibleEquityGrade,
                    Score       = TangibleEquityScore
                };
                sb.AddWeight(weight, "TangibleEquity", ref summary);
            }             // if

            DateTime calcTime = CalculationTime;
            int      businessSeniorityYears = 0;
            decimal  ezbobSeniorityMonth    = 0;

            if (BusinessSeniority.HasValue)
            {
                businessSeniorityYears = (int)(calcTime - BusinessSeniority.Value).TotalDays / 365;
            }

            if (EzbobSeniority.HasValue)
            {
                ezbobSeniorityMonth = (decimal)(calcTime - EzbobSeniority.Value).TotalDays / (365.0M / 12.0M);
            }

            weight = new Weight {
                Value       = businessSeniorityYears.ToString(CultureInfo.InvariantCulture),
                FinalWeight = BusinessSeniorityWeight,
                Grade       = (int)BusinessSeniorityGrade,
                Score       = BusinessSeniorityScore
            };
            sb.AddWeight(weight, "BusinessSeniority", ref summary);

            weight = new Weight {
                Value       = ConsumerScore.ToString(CultureInfo.InvariantCulture),
                FinalWeight = ConsumerScoreWeight,
                Grade       = (int)ConsumerScoreGrade,
                Score       = ConsumerScoreScore
            };
            sb.AddWeight(weight, "ConsumerScore", ref summary);

            weight = new Weight {
                Value       = ezbobSeniorityMonth.ToString(CultureInfo.InvariantCulture),
                FinalWeight = EzbobSeniorityWeight,
                Grade       = (int)EzbobSeniorityGrade,
                Score       = EzbobSeniorityScore
            };
            sb.AddWeight(weight, "EzbobSeniority", ref summary);

            weight = new Weight {
                Value       = MaritalStatus.ToString(),
                FinalWeight = MaritalStatusWeight,
                Grade       = (int)MaritalStatusGrade,
                Score       = MaritalStatusScore
            };
            sb.AddWeight(weight, "MaritalStatus", ref summary);

            weight = new Weight {
                Value       = NumOfLoans.ToString(CultureInfo.InvariantCulture),
                FinalWeight = NumOfLoansWeight,
                Grade       = (int)NumOfLoansGrade,
                Score       = NumOfLoansScore
            };
            sb.AddWeight(weight, "NumOfLoans", ref summary);

            weight = new Weight {
                Value       = NumOfLateRepayments.ToString(CultureInfo.InvariantCulture),
                FinalWeight = NumOfLateRepaymentsWeight,
                Grade       = (int)NumOfLateRepaymentsGrade,
                Score       = NumOfLateRepaymentsScore
            };
            sb.AddWeight(weight, "NumOfLateRepayments", ref summary);

            weight = new Weight {
                Value       = NumOfEarlyRepayments.ToString(CultureInfo.InvariantCulture),
                FinalWeight = NumOfEarlyRepaymentsWeight,
                Grade       = (int)NumOfEarlyRepaymentsGrade,
                Score       = NumOfEarlyRepaymentsScore
            };
            sb.AddWeight(weight, "NumOfEarlyRepayments", ref summary);

            weight = new Weight {
                Value       = AnnualTurnover.ToString(CultureInfo.InvariantCulture),
                FinalWeight = AnnualTurnoverWeight,
                Grade       = (int)AnnualTurnoverGrade,
                Score       = AnnualTurnoverScore
            };
            sb.AddWeight(weight, "AnnualTurnover", ref summary);

            weight = new Weight {
                Value       = FreeCashFlow.ToString(CultureInfo.InvariantCulture),
                FinalWeight = FreeCashFlowWeight,
                Grade       = (int)FreeCashFlowGrade,
                Score       = FreeCashFlowScore
            };
            sb.AddWeight(weight, "FreeCashFlow", ref summary);

            weight = new Weight {
                Value       = NetWorth.ToString(CultureInfo.InvariantCulture),
                FinalWeight = NetWorthWeight,
                Grade       = (int)NetWorthGrade,
                Score       = NetWorthScore
            };
            sb.AddWeight(weight, "NetWorth", ref summary);

            bool isOnline =
                MedalType == MedalType.OnlineLimited ||
                MedalType == MedalType.OnlineNonLimitedNoBusinessScore ||
                MedalType == MedalType.OnlineNonLimitedWithBusinessScore;

            if (isOnline)
            {
                weight = new Weight {
                    Value       = NumberOfStores.ToString(CultureInfo.InvariantCulture),
                    FinalWeight = NumberOfStoresWeight,
                    Grade       = (int)NumberOfStoresGrade,
                    Score       = NumberOfStoresScore
                };
                sb.AddWeight(weight, "NumOfStores", ref summary);

                weight = new Weight {
                    Value       = PositiveFeedbacks.ToString(CultureInfo.InvariantCulture),
                    FinalWeight = PositiveFeedbacksWeight,
                    Grade       = (int)PositiveFeedbacksGrade,
                    Score       = PositiveFeedbacksScore
                };
                sb.AddWeight(weight, "PositiveFeedbacks", ref summary);
            }             // if

            sb.AppendLine("----------------------------------------------------------------------------------------------------------------------------------------");

            sb.AppendFormat("{0}| {1}| {2}| {3}| {4}| {5}| {6}| {7}| {8}\n",
                            "Sum".PadRight(25),
                            StringBuilderExtention.ToShort(summary.FinalWeight)
                            .PadRight(10),
                            "-".PadRight(10),
                            "-".PadRight(10),
                            "-".PadRight(10),
                            "-".PadRight(10),
                            summary.Grade.ToString(CultureInfo.InvariantCulture)
                            .PadRight(10),
                            StringBuilderExtention.ToShort(summary.Score)
                            .PadRight(10), summary.Value);

            return(sb.ToString());
        }         // ToString