} // ProcessDir private static void ReadFromZip(SortedDictionary <string, Stat> oStat, string sFileName, ASafeLog oLog) { oLog.Msg("Processing zip file {0}...", sFileName); using (FileStream zipToOpen = new FileStream(sFileName, FileMode.Open)) using (ZipArchive zip = new ZipArchive(zipToOpen, ZipArchiveMode.Read)) foreach (ZipArchiveEntry entry in zip.Entries) { ProcessFile(oStat, entry, oLog); } oLog.Msg("Processing zip file {0} complete.", sFileName); } // ReadFromZip
private static void TestInterestFreeze(AConnection oDB, ASafeLog log) { var oPeriods = new SortedDictionary <int, InterestFreezePeriods>(); oDB.ForEachRowSafe( (sr, bRowsetStart) => { int nLoanID = sr["LoanId"]; DateTime?oStart = sr["StartDate"]; DateTime?oEnd = sr["EndDate"]; decimal nRate = sr["InterestRate"]; DateTime?oDeactivation = sr["DeactivationDate"]; DateTime?oTo = oDeactivation.HasValue ? (oEnd.HasValue ? DateInterval.Min(oEnd.Value, oDeactivation.Value) : oDeactivation) : oEnd; if (!oPeriods.ContainsKey(nLoanID)) { oPeriods[nLoanID] = new InterestFreezePeriods(); } oPeriods[nLoanID].Add(oStart, oTo, nRate); return(ActionResult.Continue); }, "RptEarnedInterest_Freeze", CommandSpecies.StoredProcedure ); foreach (var pair in oPeriods) { log.Msg("LoanID: {0} Freeze Periods: {1}", pair.Key, pair.Value); } }
private static void TestHashPassword(AConnection oDB, ASafeLog oLog) { var aryPasswords = new string[] { null, "", " ", "123456", "jkkasjzdhfkjjk", "lskdfsdlkjfsldkfjsldkfjsldkfjsldkjfsldkfjsdlkfjjdsfsldkjfsldkfjsldkfj", "дер.пароль", "סיסמא סידית ביותר", "*****@*****.**", }; foreach (string sPassword in aryPasswords) { string sHash = Ezbob.Utils.Security.SecurityUtils.HashPassword(sPassword); oLog.Msg("Password: '******', hash size: {1}, hash: {2}\n", sPassword, sHash.Length, sHash); } // for each password }
} // IsValid public QuickOfferModel GetOffer(bool bSaveOfferToDB, AConnection oDB, ASafeLog oLog) { if (RequestedAmount < Cfg.MinOfferAmount) { oLog.Debug("Requested amount (£{0}) is less than minimal offer amount (£{1}), not offering.", RequestedAmount, Cfg.MinOfferAmount); return(null); } // if oDB.ForEachRowSafe( (sr, bRowsetStart) => { minLoanAmount = sr["MinLoanAmount"]; return(ActionResult.SkipAll); }, "GetBankBasedApprovalConfigs", CommandSpecies.StoredProcedure ); decimal?nOffer = Calculate(); if (!nOffer.HasValue) { return(null); } int nOfferID = default(int); decimal nRequestedAmount = RequestedAmount.Min(Cfg.PotentialMaxAmount); var oOffer = new QuickOfferModel { ID = nOfferID, Amount = nOffer.Value, Aml = Aml, BusinessScore = BusinessScore, IncorporationDate = IncorporationDate.Value, TangibleEquity = TangibleEquity, TotalCurrentAssets = TotalCurrentAssets, ImmediateTerm = Cfg.ImmediateTermMonths, ImmediateInterestRate = Cfg.ImmediateInterestRate, ImmediateSetupFee = Cfg.ImmediateSetupFee, PotentialAmount = nRequestedAmount, PotentialTerm = Cfg.PotentialTermMonths, PotentialInterestRate = Cfg.LoanPct(BusinessScore, nRequestedAmount), PotentialSetupFee = Cfg.PotentialSetupFee, }; if (bSaveOfferToDB && (Cfg.Enabled != QuickOfferEnabledStatus.Silent)) { try { var oID = new QueryParameter("@QuickOfferID") { Type = DbType.Int32, Direction = ParameterDirection.Output, }; oDB.ExecuteNonQuery( "QuickOfferSave", CommandSpecies.StoredProcedure, new QueryParameter("@Now", DateTime.UtcNow), new QueryParameter("@CustomerID", CustomerID), new QueryParameter("@Amount", oOffer.Amount), new QueryParameter("@Aml", oOffer.Aml), new QueryParameter("@BusinessScore", oOffer.BusinessScore), new QueryParameter("@IncorporationDate", oOffer.IncorporationDate), new QueryParameter("@TangibleEquity", oOffer.TangibleEquity), new QueryParameter("@TotalCurrentAssets", oOffer.TotalCurrentAssets), new QueryParameter("@ImmediateTerm", oOffer.ImmediateTerm), new QueryParameter("@ImmediateInterestRate", oOffer.ImmediateInterestRate), new QueryParameter("@ImmediateSetupFee", oOffer.ImmediateSetupFee), new QueryParameter("@PotentialAmount", oOffer.PotentialAmount), new QueryParameter("@PotentialTerm", oOffer.PotentialTerm), new QueryParameter("@PotentialInterestRate", oOffer.PotentialInterestRate), new QueryParameter("@PotentialSetupFee", oOffer.PotentialSetupFee), oID ); if (int.TryParse(oID.SafeReturnedValue, out nOfferID)) { oLog.Msg("Quick offer id is {0}", nOfferID); oOffer.ID = nOfferID; } else { oLog.Warn("Failed to parse quick offer id from {0}", oID.Value.ToString()); } } catch (Exception e) { oLog.Alert(e, "Failed to save a quick offer to DB."); } // try } // if return(oOffer); } // GetOffer