Beispiel #1
0
        public static Rent RandomRent(Identifier property = null, double?totalYearlyRent = null)
        {
            var avgRent  = totalYearlyRent ?? 0D;
            var randRent = Pecuniam.Zero;

            if (avgRent == 0D)
            {
                avgRent = (double)GetAvgAmericanRentByYear(null).Amount;
                var stdOfAvgRent = avgRent * 0.43759;
                var lower        = (int)Math.Round(avgRent - (stdOfAvgRent * 3));
                var upper        = (int)Math.Round(avgRent + (stdOfAvgRent * 3));
                randRent = Pecuniam.RandomPecuniam(lower, upper, 100);
            }
            else
            {
                randRent = avgRent.ToPecuniam();
            }
            var randTerm       = Etx.RandomPickOne(new[] { 24, 18, 12, 6 });
            var randDate       = Etx.RandomDate(0, DateTime.Today.AddDays(-2), true);
            var randDepositAmt = (int)Math.Round((randRent.Amount - randRent.Amount % 250) / 2);
            var randDeposit    = new Pecuniam(randDepositAmt);

            var rent = new Rent(property, randDate, randTerm, randRent, randDeposit);

            return(rent);
        }
Beispiel #2
0
        public Pecuniam GetRandomMax(DateTime?dt)
        {
            if (!int.TryParse(Value, out var ccScore))
            {
                return(new Pecuniam(1000));
            }

            if (ccScore >= 800)
            {
                return(Pecuniam.RandomPecuniam(10000, 20000, 100));
            }
            if (ccScore >= 750)
            {
                return(Pecuniam.RandomPecuniam(5000, 10000, 100));
            }
            if (ccScore >= 700)
            {
                return(Pecuniam.RandomPecuniam(3000, 5000, 100));
            }
            if (ccScore >= 600)
            {
                return(Pecuniam.RandomPecuniam(1000, 2000, 100));
            }

            return(new Pecuniam(1000));
        }