Ejemplo n.º 1
0
        }         // CreateWithGrade

        private static BackdoorSimpleApprove CreateWithMedal(
            string backdoorCode,
            int customerID,
            bool ownsProperty,
            decimal requestedAmount,
            int homeOwnerCap,
            int notHomeOwnerCap,
            int delay
            )
        {
            var match = regexMedal.Match(backdoorCode);

            if (!match.Success)
            {
                Log.Debug(
                    "Back door code '{0}' ain't no matches approval regex-with-medal /{1}/.",
                    backdoorCode,
                    regexMedal
                    );
                return(null);
            }             // if

            MedalClass medal = MedalClass.NoClassification;

            switch (match.Groups[2].Value)
            {
            case "s":
                medal = MedalClass.Silver;
                break;

            case "g":
                medal = MedalClass.Gold;
                break;

            case "p":
                medal = MedalClass.Platinum;
                break;

            case "d":
                medal = MedalClass.Diamond;
                break;
            }             // switch

            return(new BackdoorSimpleApprove(
                       homeOwnerCap,
                       notHomeOwnerCap,
                       customerID,
                       match.Groups[1].Value == "s" ? delay : 0,
                       medal,
                       ownsProperty,
                       null,
                       null,
                       requestedAmount
                       ));
        }         // CreateWithMedal
Ejemplo n.º 2
0
        }         // CalcualteMedalAndOffer

        private BackdoorSimpleApprove(
            int homeOwnerCap,
            int notHomeOwnerCap,
            int customerID,
            int delay,
            MedalClass medalClass,
            bool ownsProperty,
            string gradeScore,
            string investorID,
            decimal requestedAmount
            ) : base(
                homeOwnerCap,
                notHomeOwnerCap,
                customerID,
                DecisionActions.Approve,
                delay,
                ownsProperty,
                requestedAmount,
                !string.IsNullOrWhiteSpace(gradeScore)
                )
        {
            MedalClassification = medalClass;

            this.productSubTypeID = null;

            if (!string.IsNullOrWhiteSpace(gradeScore))
            {
                GradeScore = decimal.Parse("0." + gradeScore);
                InvestorID = string.IsNullOrWhiteSpace(investorID) ? (int?)null : int.Parse(investorID.Substring(1));
            }
            else
            {
                GradeScore = null;
                InvestorID = null;
            }     // if
        }         // constructor