} // LoadCompanyData protected virtual void ProcessRow(SafeReader sr) { RowType nRowType; string sRowType = sr["RowType"]; if (!Enum.TryParse(sRowType, out nRowType)) { Log.Alert("Unsupported row type encountered: '{0}'.", sRowType); return; } // if switch (nRowType) { case RowType.MetaData: sr.Fill(MetaData); break; case RowType.MpError: UpdateErrors.Add(sr.Fill <MpError>()); break; case RowType.OriginationTime: OriginationTime.Process(sr); break; case RowType.Turnover: //Turnover.Add(sr, Log); neutral SP data collection (elinar) break; default: throw new ArgumentOutOfRangeException(); } // switch } // ProcessRow
} // CheckAvailableFunds private void ProcessRow(SafeReader sr) { RowType nRowType; string sRowType = sr["RowType"]; if (!Enum.TryParse(sRowType, out nRowType)) { Log.Alert("Unsupported row type encountered: '{0}'.", sRowType); return; } // if switch (nRowType) { case RowType.MetaData: sr.Fill(MetaData); break; case RowType.LatePayment: LatePayments.Add(sr.Fill <Payment>()); break; case RowType.Marketplace: NewMarketplaces.Add(sr.Fill <Marketplace>()); break; default: throw new ArgumentOutOfRangeException(); } // switch } // ProcessRow
private void ProcessRow(SafeReader sr) { string sRowType = sr["RowType"]; RowTypes nRowType; if (!Enum.TryParse(sRowType, out nRowType)) { m_oLog.Alert("Failed to parse DataSharing row type '{0}'.", sRowType); return; } // if switch (nRowType) { case RowTypes.Funnel: m_oFunnel.Add(sr.Fill <FunnelRow>()); break; case RowTypes.RejectReason: RejectReasonRow rrr = sr.Fill <RejectReasonRow>(); m_oRejectReasons.Add(rrr); m_nRejectReasonTotal += rrr.Counter; break; default: throw new ArgumentOutOfRangeException(); } // switch } // ProcessRow
protected virtual void ProcessRow(SafeReader sr) { LastRowType = null; RowType nRowType; string sRowType = sr.ContainsField("DatumType", "RowType") ? sr["DatumType"] : sr["RowType"]; if (!Enum.TryParse(sRowType, out nRowType)) { Log.Alert("Unsupported row type encountered: '{0}'.", sRowType); return; } // if LastRowType = nRowType; Log.Debug("Auto approve agent, processing input row of type {0}.", sRowType); switch (nRowType) { case RowType.MetaData: sr.Fill(MetaData); break; case RowType.Payment: Payments.Add(sr.Fill <Payment>()); break; case RowType.OriginationTime: OriginationTime.Process(sr); break; case RowType.Turnover: Turnover.Add(sr.Fill <TurnoverDbRow>()); break; case RowType.DirectorName: DirectorNames.Add(new Name(sr["FirstName"], sr["LastName"])); break; case RowType.HmrcBusinessName: if (sr["BelongsToCustomer"]) { HmrcBusinessNames.Add(new NameForComparison(sr["Name"])); } break; case RowType.ExperianConsumerDataCais: this.caisAccounts.Add(sr.Fill <ExperianConsumerDataCaisAccounts>()); break; case RowType.CompanyDissolutionDate: MetaData.CompanyDissolutionDate = sr["CompanyDissolutionDate"]; break; default: throw new ArgumentOutOfRangeException(); } // switch } // ProcessRow
} // IsHomeOwner private void ProcessRow(SafeReader sr) { Datum d = sr.Fill <Datum>(); sr.Fill(d.Manual); sr.Fill(d.ManualCfg); d.ManualCfg.Calculate(d.Manual); d.LoadLoans(DB); this.data.Add(d); } // ProcessRow
} // BuildDefaultProduct private void ProcessRow(SafeReader sr) { RowTypes rowType; string rowTypeStr = sr["RowType"]; if (!Enum.TryParse(rowTypeStr, false, out rowType)) { Log.Alert("Unknown row type '{0}' while loading application info model.", rowTypeStr); return; } // if switch (rowType) { case RowTypes.LoanSource: this.loanSources.Add(sr.Fill <LoanSourceModel>()); break; case RowTypes.LoanType: this.loanTypes.Add(sr.Fill <LoanTypeModel>()); break; case RowTypes.DiscountPlan: this.discountPlans.Add(sr.Fill <DiscountPlanModel>()); break; case RowTypes.Model: sr.Fill(Result); this.rawOfferStart = sr["RawOfferStart"]; this.brokerCardID = sr["BrokerCardID"]; this.brokerID = sr["BrokerID"]; string typeOfBusinessStr = sr["TypeOfBusiness"]; TypeOfBusiness typeOfBusiness; if (Enum.TryParse(typeOfBusinessStr, out typeOfBusiness)) { Result.TypeOfBusiness = typeOfBusiness; } break; case RowTypes.OfferCalculation: sr.Fill(Result.AutomationOfferModel); break; default: throw new ArgumentOutOfRangeException(); } // switch } // ProcessRow
} // ProcessModelOutput private void ProcessOutputRatio(SafeReader sr) { OutputRatio ratio = sr.Fill <OutputRatio>(); if (this.models.ContainsKey(ratio.ModelOutputID)) { this.models[ratio.ModelOutputID].Grade.OutputRatios[ratio.OutputClass] = ratio.Score; Log.Debug( "Inference loader({0}): loaded map output ratio ({1}: {2}).", this.argList, ratio.OutputClass, ratio.Score ); } else { throw OutOfRangeException( "Inference loader({0}): map output ratio '{1}' should belong to unknown model '{2}'.", this.argList, ratio.ID, ratio.ModelOutputID ); } // if } // ProcessOutputRatio
} // ProcessOutputRatio private void ProcessWarning(SafeReader sr) { DBTable.Warning warning = sr.Fill <DBTable.Warning>(); if (this.models.ContainsKey(warning.ModelOutputID)) { this.models[warning.ModelOutputID].Error.Warnings.Add(new Engine.Interface.Warning { FeatureName = warning.FeatureName, MaxValue = warning.MaxValue, MinValue = warning.MinValue, Value = warning.Value, }); Log.Debug( "Inference loader({0}): loaded warning ({1}: '{2}' should be between '{3}' and '{4}').", this.argList, warning.FeatureName, warning.Value, warning.MinValue, warning.MaxValue ); } else { throw OutOfRangeException( "Inference loader({0}): warning '{1}' should belong to unknown model '{2}'.", this.argList, warning.ID, warning.ModelOutputID ); } // if } // ProcessWarning
} // AddLoanData public void AddRepayment(SafeReader sr, SortedSet <int> oLateLoans) { LoanData ld = sr.Fill <LoanData>(); ld.IsLate = oLateLoans.Contains(ld.ID); if (m_oLoans.ContainsKey(ld.ID)) { m_oLoans[ld.ID] += ld; } else { m_oLoans[ld.ID] = ld; if (m_oCashRequests.ContainsKey(ld.CashRequestID)) { m_oCashRequests[ld.CashRequestID].AmountTaken += ld.Amount; } else { m_oCashRequests[ld.CashRequestID] = new CashRequestData { ApprovedAmount = sr["ManagerApprovedSum"], AmountTaken = ld.Amount, }; } // if } // if } // AddRepayment
private Tuple <CT_SearchResult, ServiceLog> Load() { SafeReader sr = DB.GetFirst( "LoadServiceLogEntry", CommandSpecies.StoredProcedure, new QueryParameter("@EntryID", m_nServiceLogID) ); var serviceLog = sr.Fill <ServiceLog>(); if (serviceLog.Id != m_nServiceLogID) { Log.Info("Parsing CallCredit for service log entry {0} failed: entry not found.", m_nServiceLogID); return(null); } // if try { var searchResultSerializer = new XmlSerializer(typeof(CT_SearchResult)); var searchResult = (CT_SearchResult)searchResultSerializer.Deserialize(new StringReader(serviceLog.ResponseData)); if (searchResult == null) { Log.Alert("Parsing CallCredit Consumer for service log entry {0} failed root element is null.", m_nServiceLogID); return(null); } return(new Tuple <CT_SearchResult, ServiceLog>(searchResult, serviceLog)); } catch (Exception e) { Log.Alert(e, "Parsing CallCredit for service log entry {0} failed.", m_nServiceLogID); return(null); } } // Load
} // ProcessWarning private void ProcessEncodingFailure(SafeReader sr) { DBTable.EncodingFailure encodingFailure = sr.Fill <DBTable.EncodingFailure>(); if (this.models.ContainsKey(encodingFailure.ModelOutputID)) { this.models[encodingFailure.ModelOutputID].Error.EncodingFailures.Add( new Engine.Interface.EncodingFailure { ColumnName = encodingFailure.ColumnName, Message = encodingFailure.Message, Reason = encodingFailure.Reason, RowIndex = encodingFailure.RowIndex, UnencodedValue = encodingFailure.UnencodedValue, } ); Log.Debug( "Inference loader({0}): loaded encoding failure ('{1}': '{2}'; unenc: '{3}', msg: '{4}').", this.argList, encodingFailure.ColumnName, encodingFailure.Reason, encodingFailure.UnencodedValue, encodingFailure.Message ); } else { throw OutOfRangeException( "Inference loader({0}): encoding failure '{1}' should belong to unknown model '{2}'.", this.argList, encodingFailure.ID, encodingFailure.ModelOutputID ); } // if } // ProcessEncodingFailure
} // constructor public AccountingLoanBalanceRow( SafeReader sr, decimal nEarnedInterest, CustomerStatusChange oLastChange, CustomerStatusChange oCurrent, DateTime oWriteOffDate ) { IsTotal = false; WriteOffTotalBalance = 0; TotalBalance = 0; Transactions = new SortedSet <int>(); LoanCharges = new SortedSet <int>(); AccountingLoanBalanceRawData raw = sr.Fill <AccountingLoanBalanceRawData>(); IssueDate = raw.IssueDate; ClientID = raw.ClientID; LoanID = raw.LoanID; ClientName = raw.ClientName; ClientEmail = raw.ClientEmail; IssuedAmount = raw.IssuedAmount; SetupFee = raw.SetupFee; LoanStatus = raw.LoanStatus; CurrentCustomerStatus = oCurrent.NewStatus; EarnedInterest = nEarnedInterest; CustomerRefNum = raw.CustomerRefNum; LoanRefNum = raw.LoanRefNum; IsFirstLoan = raw.IsFirstLoan; RepaidPrincipal = 0; RepaidInterest = 0; FeesRepaid = 0; EarnedFees = 0; CashPaid = 0; WriteOffEarnedFees = 0; WriteOffCashPaid = 0; WriteOffNonCashPaid = 0; NonCashPaid = 0; if (SetupFee > 0) { IssuedAmount -= SetupFee; } LastInPeriodCustomerStatus = oLastChange.NewStatus; LastStatusChangeDate = oLastChange.ChangeDate; WriteOffDate = oWriteOffDate; Update(null, raw); } // constructor
public Job(EzServiceInstanceRuntimeData oRuntimeData, SafeReader sr, TypeRepository oTypeRepo) { WhyNotStarting = "never checked whether it is time to start"; m_oRuntimeData = oRuntimeData; m_oArguments = new List <JobArgument>(); sr.Fill(this); AddArgument(sr, oTypeRepo); } // constructor
} // GetDiscountPlan private LoanSource GetLoanSource() { SafeReader lssr = Library.Instance.DB.GetFirst( "GetLoanSource", CommandSpecies.StoredProcedure, // Get specific for re-approval or default otherwise new QueryParameter("@LoanSourceID", IsAutoReApproval ? LoanSourceID : (int?)null), new QueryParameter("@CustomerID", CustomerID) ); return(lssr.Fill <LoanSource>()); } // GetLoanSource
public NotAutoApprovedTrail(SafeReader sr) { this.traces = new SortedDictionary <int, NotAutoApprovedTrace>(); if (sr == null) { TrailID = 0; return; } // if sr.Fill(this); Add(sr); } // constructor
} // UpdateTotal public void Update(SafeReader sr, AccountingLoanBalanceRawUpdate upd = null) { upd = upd ?? sr.Fill <AccountingLoanBalanceRawUpdate>(); if (upd.TransactionDate.HasValue && !Transactions.Contains(upd.TransactionID)) { Transactions.Add(upd.TransactionID); bool bNonCash = (upd.LoanTranMethod ?? string.Empty).ToLower().StartsWith("non-cash"); if (bNonCash) { NonCashPaid += upd.TotalRepaid; } else { CashPaid += upd.TotalRepaid; } EarnedFees += upd.RolloverRepaid; RepaidPrincipal += upd.RepaidPrincipal; RepaidInterest += upd.RepaidInterest; FeesRepaid += upd.FeesRepaid; if (upd.TransactionDate.Value < WriteOffDate) { if (bNonCash) { WriteOffNonCashPaid += upd.TotalRepaid; } else { WriteOffCashPaid += upd.TotalRepaid; } WriteOffEarnedFees += upd.RolloverRepaid; } // if } // if if (upd.LoanChargeDate.HasValue && !LoanCharges.Contains(upd.FeesEarnedID)) { LoanCharges.Add(upd.FeesEarnedID); EarnedFees += upd.FeesEarned; if (upd.LoanChargeDate < WriteOffDate) { WriteOffEarnedFees += upd.FeesEarned; } } // if } // Update
public override void Init(long nRowID, SafeReader oRow) { oRow.Fill(this); Id = nRowID; ChooseInvestor = new List <PendingInvestorModel>(); foreach (var investor in allinvestors) { if (investor.InvestorFunds >= ApprovedAmount) { ChooseInvestor.Add(investor); } } } // Init
} // ProcessEtl private void ProcessModelOutput(SafeReader sr) { DBModelOutput dbModel = sr.Fill <DBModelOutput>(); if (!Enum.IsDefined(typeof(ModelNames), dbModel.ModelID)) { throw OutOfRangeException( "inference loader({1}): unsupported request type '{0}'.", dbModel.ModelID, this.argList ); } // if if (!this.resultSet.ContainsKey(dbModel.ResponseID)) { throw OutOfRangeException( "Inference loader({0}): model output '{1}' should belong to unknown response '{2}'.", this.argList, dbModel.ID, dbModel.ResponseID ); } // if var pubModel = new PublicModelOutput { Status = dbModel.Status, Grade = new Grade { DecodedResult = dbModel.InferenceResultDecoded, EncodedResult = dbModel.InferenceResultEncoded, Score = dbModel.Score, }, Error = new ModelError { ErrorCode = dbModel.ErrorCode, Exception = dbModel.Exception, Uuid = dbModel.Uuid, }, }; ModelNames requestType = (ModelNames)dbModel.ModelID; this.models[dbModel.ID] = pubModel; this.resultSet[dbModel.ResponseID].ModelOutputs[requestType] = pubModel; Log.Debug( "Inference loader({0}): loaded model output (id: {1}, type: {2}).", this.argList, dbModel.ID, requestType ); } // ProcessModelOutput
public StrategyData(int nActionID, SafeReader sr) { m_oData = new SortedDictionary <Guid, ActionData>(); m_oSuccessStat = new Stat(); m_oFailStat = new Stat(); m_oTotalStat = new Stat(); UnknownCount = 0; if (nActionID != 0) { ID = nActionID; sr.Fill(this); AddAction(sr); } // if } // constructor
private Tuple <OutputRoot, ServiceLog> Load() { SafeReader sr = DB.GetFirst( "LoadServiceLogEntry", CommandSpecies.StoredProcedure, new QueryParameter("@EntryID", this.serviceLogID) ); var serviceLog = sr.Fill <ServiceLog>(); if (serviceLog.Id != this.serviceLogID) { Log.Info("Parsing Experian Consumer for service log entry {0} failed: entry not found.", this.serviceLogID); return(null); } // if if (string.IsNullOrWhiteSpace(serviceLog.ResponseData)) { Log.Alert( "Parsing Experian Consumer for service log entry {0} failed: response data is empty.", this.serviceLogID ); return(null); } // if try { var outputRootSerializer = new XmlSerializer(typeof(OutputRoot)); var outputRoot = (OutputRoot)outputRootSerializer.Deserialize(new StringReader(serviceLog.ResponseData)); if (outputRoot == null) { Log.Alert( "Parsing Experian Consumer for service log entry {0} failed root element is null.", this.serviceLogID ); return(null); } // if return(new Tuple <OutputRoot, ServiceLog>(outputRoot, serviceLog)); } catch (Exception e) { Log.Alert(e, "Parsing Experian Consumer for service log entry {0} failed.", this.serviceLogID); return(null); } // try } // Load
} // ProcessResponse private void ProcessEtl(SafeReader sr) { DBEtlData dbEtl = sr.Fill <DBEtlData>(); if (!this.resultSet.ContainsKey(dbEtl.ResponseID)) { throw OutOfRangeException( "Inference loader({0}): ETL '{1}' should belong to unknown response '{2}'.", this.argList, dbEtl.ID, dbEtl.ResponseID ); } // if this.resultSet[dbEtl.ResponseID].Etl = new PublicEtlData { Code = dbEtl.EtlCodeID == null ? null : this.etlCodeRepo.Find(dbEtl.EtlCodeID.Value), Message = dbEtl.Message, }; } // ProcessEtl
} // ProcessRequest private void ProcessResponse(SafeReader sr) { var dbResponse = sr.Fill <DBResponse>(); var result = ProcessRequest(sr); if (result == null) { throw OutOfRangeException( "Inference loader({0}): response '{1}' has no unique request ID.", this.argList, dbResponse.ID ); } // if result.ResponseID = dbResponse.ID; result.ReceivedTime = dbResponse.ReceivedTime; result.Bucket = ((dbResponse.BucketID != null) && (this.bucketRepo != null)) ? this.bucketRepo.Find(dbResponse.BucketID.Value) : null; result.Reason = dbResponse.Reason; result.Outcome = dbResponse.Outcome; result.Error = new InferenceError { Message = dbResponse.ErrorMessage, ParsingExceptionMessage = dbResponse.ParsingExceptionMessage, ParsingExceptionType = dbResponse.ParsingExceptionType, TimeoutSource = (dbResponse.TimeoutSourceID == null) || (this.timeoutSourceRepo == null) ? null : this.timeoutSourceRepo.Find(dbResponse.TimeoutSourceID.Value), }; result.Status = new InferenceStatus { HasEquifaxData = dbResponse.HasEquifaxData, HttpStatus = (HttpStatusCode)dbResponse.HttpStatus, ResponseStatus = (HttpStatusCode)dbResponse.ResponseStatus, }; this.resultSet[result.ResponseID] = result; Log.Debug("Inference loader({0}): loaded response (id: {1}).", this.argList, result.ResponseID); } // ProcessResponse
} // constructor public void Load() { if (RequestedID <= 0) { return; } if (RequestedID == ID) { return; } Library.Instance.Log.Debug("Getting personal info for customer {0}...", RequestedID); SafeReader results = Library.Instance.DB.GetFirst( "GetPersonalInfo", CommandSpecies.StoredProcedure, new QueryParameter("CustomerId", RequestedID) ); if (results.IsEmpty) { return; } results.Fill(this); var scoreStrat = new GetExperianConsumerScore(RequestedID); scoreStrat.Execute(); ExperianConsumerScore = scoreStrat.Score; ID = RequestedID; Library.Instance.Log.Debug("Getting personal info for customer {0} complete.", RequestedID); } // Load
} // Seniority /// <summary> /// Feeds marketplace first transaction time. /// </summary> /// <param name="sr">Transaction time read from DB. Refer to <see cref="Row"/> for details.</param> public void Process(SafeReader sr) { Row r = sr.Fill <Row>().SetTime(); this.log.Debug("Origination time: processing row {0}", r); if (r.Time == null) { return; } if (Since == null) { this.log.Debug("Marketplace origination time set from {0}.", r); this.row = r; return; } // if if (r.Time < Since.Value) { this.row = r; this.log.Debug("Marketplace origination time updated from {0}.", r); } // if } // Process
} // constructor public LoadOfferRanges Execute() { LoadRanges(); if (this.matchingGradeRanges.Count != 1) { this.log.Alert("Failed to find one grade range for {0}.", this); return(this); } // if GradeRangeID = this.matchingGradeRanges[0].GradeRangeID; ProductSubTypeID = this.matchingGradeRanges[0].ProductSubTypeID; SafeReader sr = this.db.GetFirst( "LoadGradeRangeAndSubproduct", CommandSpecies.StoredProcedure, new QueryParameter("@GradeRangeID", GradeRangeID), new QueryParameter("@ProductSubTypeID", ProductSubTypeID) ); if (sr.IsEmpty) { this.log.Alert( "Failed to load grade range and product subtype by grade range id {0} and product sub type id {1}.", GradeRangeID, ProductSubTypeID ); return(this); } // if GradeRangeSubproduct = sr.Fill <GradeRangeSubproduct>(); Success = true; return(this); } // Execute
} // ProcessEncodingFailure private void ProcessMissingColumn(SafeReader sr) { MissingColumn column = sr.Fill <MissingColumn>(); if (this.models.ContainsKey(column.ModelOutputID)) { this.models[column.ModelOutputID].Error.MissingColumns.Add(column.ColumnName); Log.Debug( "Inference loader({0}): loaded missing column ({1}).", this.argList, column.ColumnName ); } else { throw OutOfRangeException( "Inference loader({0}): missing column '{1}' should belong to unknown model '{2}'.", this.argList, column.ID, column.ModelOutputID ); } // if } // ProcessMissingColumn
public NotAutoApprovedCashRequest(SafeReader sr) { this.trails = new SortedDictionary <long, NotAutoApprovedTrail>(); sr.Fill(this); Add(sr); } // constructor
} // class SpLoadVatReturnSummary private static void ProcessSummary(SortedDictionary <int, VatReturnSummary> oResults, SafeReader sr) { var oSummary = sr.Fill <VatReturnSummary>(); oResults[oSummary.SummaryID] = oSummary; } // ProcessSummary
} // IsEmpty public void Add(SafeReader sr) { var trace = sr.Fill <NotAutoApprovedTrace>(); this.traces[trace.Position] = trace; } // Add
} // ProcessSummary private static void ProcessQuarter(SortedDictionary <int, VatReturnSummary> oResults, SafeReader sr) { var oQuarter = sr.Fill <VatReturnQuarter>(); oResults[oQuarter.SummaryID].Quarters.Add(oQuarter); } // ProcessQuarter