Beispiel #1
0
        public override void Execute()
        {
            try {
                Log.Debug(
                    "Loading customer data for medal calculation, customer = {0}, calculation time = {1}. {2}",
                    this.customerId,
                    this.calculationTime.ToString("MMM d yyyy H:mm:ss", CultureInfo.InvariantCulture),
                    Tag
                    );

                LoadCustomerData();

                Result = CalculatePrimary()
                         ?? new MedalResult(this.customerId, Log, "Failed to calculate primary medal.");

                this.verificationResult = CalculateVerification();

                Result.CheckForMatch(this.verificationResult);
            } catch (Exception e) {
                Log.Say(
                    Severity.Alert,
                    e,
                    "Medal calculation for customer {0} failed with exception. {1}",
                    this.customerId,
                    Tag
                    );

                Result = new MedalResult(this.customerId, Log, e);
            }             // try

            if (!this.doStoreMedal)
            {
                return;
            }

            try {
                Result.SaveToDb(CashRequestID, NLCashRequestID, Tag, DB);

                if (this.verificationResult != null)
                {
                    this.verificationResult.SaveToDb(CashRequestID, NLCashRequestID, Tag, DB, Log);
                }
            } catch (Exception e) {
                Log.Say(
                    Severity.Alert,
                    e,
                    "Failed to save medal for customer {0}. {1}",
                    this.customerId,
                    Tag
                    );
            }     // try
        }         // Execute
Beispiel #2
0
        public CalculateMedal(
            int customerId,
            long?cashRequestID,
            long?nlCashRequestID,
            DateTime calculationTime,
            bool primaryOnly,
            bool doStoreMedal
            )
        {
            this.doStoreMedal       = doStoreMedal;
            this.primaryOnly        = primaryOnly;
            this.customerId         = customerId;
            this.calculationTime    = calculationTime;
            this.verificationResult = null;

            CashRequestID   = cashRequestID;
            NLCashRequestID = nlCashRequestID <= 0 ? null : nlCashRequestID;

            Result = new MedalResult(this.customerId, Log, "Medal calculator has not been executed yet.");
        }         // constructor