Ejemplo n.º 1
0
        }         // ToInputData

        private void FillNumOfLateConsumerAccounts(ExperianConsumerData oData)
        {
            this.numOfLateConsumerAccounts = 0;

            if ((oData == null) || (oData.Cais == null) || (oData.Cais.Count < 1))
            {
                return;
            }

            List <ExperianConsumerDataCais> lst = oData.Cais.Where(cais =>
                                                                   cais.LastUpdatedDate.HasValue &&
                                                                   (cais.MatchTo == 1) &&
                                                                   !string.IsNullOrWhiteSpace(cais.AccountStatusCodes) &&
                                                                   (cais.LastUpdatedDate.Value <= Trail.InputData.DataAsOf) &&
                                                                   (MiscUtils.CountMonthsBetween(cais.LastUpdatedDate.Value, Trail.InputData.DataAsOf) < 1)
                                                                   )
                                                  .ToList();

            Log.Debug("Fill num of lates: {0} found.", Grammar.Number(lst.Count, "relevant account"));

            foreach (var cais in lst)
            {
                Log.Debug(
                    "Fill num of lates cais id {0}: last updated = '{1}', match to = '{2}', statues = '{3}', now = {4}",
                    cais.Id,
                    cais.LastUpdatedDate.HasValue
                                        ? cais.LastUpdatedDate.Value.ToString("d/MMM/yyyy H:mm:ss", CultureInfo.InvariantCulture)
                                        : "-- null --",
                    cais.MatchTo.HasValue ? cais.MatchTo.Value.ToString(CultureInfo.InvariantCulture) : "-- null --",
                    cais.AccountStatusCodes,
                    Trail.InputData.DataAsOf.ToString("d/MMM/yyyy H:mm:ss", CultureInfo.InvariantCulture)
                    );

                int nMonthCount = Math.Min(Trail.MyInputData.Reject_LateLastMonthsNum, cais.AccountStatusCodes.Length);

                Log.Debug(
                    "Fill num of lates cais id {0}: month count is {1}, status count is {2}.",
                    cais.Id,
                    nMonthCount,
                    cais.AccountStatusCodes.Length
                    );

                for (int i = 1; i <= nMonthCount; i++)
                {
                    char status = cais.AccountStatusCodes[cais.AccountStatusCodes.Length - i];

                    Log.Debug("Fill num of lates cais id {0}: status[{1}] = '{2}'.", cais.Id, i, status);

                    if (!lateStatuses.Contains(status))
                    {
                        Log.Debug("Fill num of lates cais id {0} ain't no late: not a late status.", cais.Id);
                        continue;
                    }                     // if

                    int nStatus = 0;

                    int.TryParse(status.ToString(CultureInfo.InvariantCulture), out nStatus);

                    Log.Debug("Fill num of lates cais id {0}: status[{1}] = '{2}'.", cais.Id, i, nStatus);

                    if (nStatus > Trail.MyInputData.RejectionLastValidLate)
                    {
                        Log.Debug("Fill num of lates cais id {0} is late.", cais.Id);
                        this.numOfLateConsumerAccounts++;
                        break;
                    } // if
                }     // for i
            }         // for each account
        }             // FillLateConsumerAccounts