} // constructor public virtual void Init() { PropertyInfo[] propertyInfos = GetType().GetProperties(); foreach (PropertyInfo pi in propertyInfos) { SupportedTypes ignored; bool bInclude = pi.GetGetMethod().IsVirtual&& pi.GetGetMethod().IsPublic&& (pi.GetSetMethod(true) != null) && SupportedTypes.TryParse(pi.PropertyType.Name, out ignored); if (bInclude) { configPropertyInfos.Add(pi.Name, pi); Debug("Configuration property to read from DB: {0}", pi.Name); } // if } // for each property Info("Reading configurations"); try { AConnection oDB = DbConnectionGenerator.Get(this); oDB.ForEachRow((row, bRowsetStart) => { AddSingleConfiguration(row[KeyFieldName].ToString(), row[ValueFieldName].ToString()); return(ActionResult.Continue); }, SpName); } catch (Exception e) { throw new ConfigurationBaseException("Error reading configurations.", e); } // try } // Init
} // RegisterGlobalFilters private void InitOnStart() { Init(); if (_isInitialized) { return; } lock (this) { if (_isInitialized) { return; } try { new Log4Net().Init(); Log.NotifyStart(); var db = DbConnectionGenerator.Get(Log); CurrentValues.Init( db, Log, oLimitations => oLimitations.UpdateWebSiteCfg("Ezbob.Web") ); DbConnectionPool.ReuseCount = CurrentValues.Instance.ConnectionPoolReuseCount; AConnection.UpdateConnectionPoolMaxSize(CurrentValues.Instance.ConnectionPoolMaxSize); RegisterGlobalFilters(GlobalFilters.Filters); } catch (Exception ex) { Log.Error(ex); throw; } // try _isInitialized = true; } // lock } // InitOnStart
public JsonResult Save(string version, string history) { Dictionary <string, UiCachePkgModel> oHistory = null; try { oHistory = JsonConvert.DeserializeObject <Dictionary <string, UiCachePkgModel> >(history); } catch (Exception ex) { log.Warn(ex, "Failed to de-serialize history: {0}", history); } // try if ((oHistory == null) || (oHistory.Count < 1)) { log.Warn("No data received, nothing done."); return(Json(new { result = "success" })); } // if string sSessionID = this.GetSessionID(); string sRemoteIP = this.GetRemoteIP(); AConnection oDB = DbConnectionGenerator.Get(log); int nBrowserVersionID = this.GetBrowserVersionID(version, oDB, log); if (nBrowserVersionID == 0) { return(Json(new { result = "Failed to save browser version." })); } //log.Debug( // "{1} at {2}: UiActionController.Save(version: {3} - {0}), data:", // oBrowserVersion.UserAgent, // sSessionID, // sRemoteIP, // oBrowserVersion.ID //); var oSavedPackages = new List <string>(); var oFailedPackages = new List <UiCachePkgModel.SaveResult>(); foreach (KeyValuePair <string, UiCachePkgModel> pair in oHistory) { // log.Debug("\tkey: {0} pkg: {1}", pair.Key, pair.Value); UiCachePkgModel.SaveResult oResult = pair.Value.Save(oDB, nBrowserVersionID, sRemoteIP, sSessionID); if (oResult.Overall()) { oSavedPackages.Add(pair.Key); } else { oFailedPackages.Add(oResult); } } // for each pkg return(Json(new { result = "success", saved = oSavedPackages, failures = oFailedPackages })); } // Save
public static void Init() { Bootstrap.Init(); NHibernateManager.FluentAssemblies.Add(typeof(eBayDatabaseMarketPlace).Assembly); new Log4Net().Init(); var db = DbConnectionGenerator.Get(Log); EZBob.DatabaseLib.Library.Initialize(db.Env, db, Log); CurrentValues.Init(db, Log); }
public void Start() { NHibernateManager.FluentAssemblies.Add(typeof(User).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(Customer).Assembly); Scanner.Register(); ObjectFactory.Configure(x => { x.For <ISession>().LifecycleIs(new ThreadLocalStorageLifecycle()).Use(ctx => NHibernateManager.OpenSession()); x.For <ISessionFactory>().Use(() => NHibernateManager.SessionFactory); }); CurrentValues.Init(DbConnectionGenerator.Get(Log), Log); DbConnectionPool.ReuseCount = CurrentValues.Instance.ConnectionPoolReuseCount; AConnection.UpdateConnectionPoolMaxSize(CurrentValues.Instance.ConnectionPoolMaxSize); }
public WizardController( IEzbobWorkplaceContext context, ISecurityQuestionRepository questions, CustomerModelBuilder customerModelBuilder, ISession session, IVipRequestRepository vipRequestRepository ) { this.context = context; this.questions = questions; this.customerModelBuilder = customerModelBuilder; this.session = session; this.vipRequestRepository = vipRequestRepository; this.DB = DbConnectionGenerator.Get(Log); } // constructor
public JsonResult FindCustomer(string term) { bool queryDB = false; term = (term ?? string.Empty).Trim(); int id; if (int.TryParse(term, out id)) { queryDB = true; } else { id = 0; if (term.Length > 2) { queryDB = true; term = term.Replace(" ", "%"); } // if } // if var retVal = new HashSet <string>(); if (!queryDB) { return(Json(retVal, JsonRequestBehavior.AllowGet)); } DbConnectionGenerator.Get().ForEachRowSafe( sr => { retVal.Add(string.Format( "{0}: {1}, {2} ({3})", (int)sr["CustomerID"], (string)sr["CustomerName"], (string)sr["Email"], (string)sr["Origin"] )); }, "FindCustomer", CommandSpecies.StoredProcedure, new QueryParameter("Ntoken", id), new QueryParameter("Stoken", term.ToLowerInvariant()) ); return(Json(retVal, JsonRequestBehavior.AllowGet)); } // FindCustomer
} // Read public static void Refresh() { Logger.Info("Refreshing configurations"); try { var oDB = DbConnectionGenerator.Get(Logger); oDB.ForEachRow((row, bRowsetStart) => { RefreshSingleConfiguration(row["CfgKey"].ToString(), row["CfgValue"].ToString()); return(ActionResult.Continue); }, spName); } catch (Exception e) { Logger.Error("Error reading configurations:{0}", e); } // try } // Refresh
} // Init public virtual void Refresh() { Info("Refreshing configurations"); try { AConnection oDB = DbConnectionGenerator.Get(this); oDB.ForEachRow((row, bRowsetStart) => { RefreshSingleConfiguration(row[KeyFieldName].ToString(), row[ValueFieldName].ToString()); return(ActionResult.Continue); }, SpName); } catch (Exception e) { Error("Error reading configurations: {0}", e); } // try } // Refresh
} // CheckForCSSPIE private void InitOnStart() { Init(); if (_isInitialized) { return; } lock (this) { if (_isInitialized) { return; } try { new Log4Net().Init(); Log.NotifyStart(); var db = DbConnectionGenerator.Get(Log); Ezbob.Models.Library.Initialize(db.Env, db, Log); EZBob.DatabaseLib.Library.Initialize(db.Env, db, Log); CurrentValues.Init( db, Log, oLimitations => oLimitations.UpdateWebSiteCfg("Ezbob.Web") ); DbConnectionPool.ReuseCount = CurrentValues.Instance.ConnectionPoolReuseCount; AConnection.UpdateConnectionPoolMaxSize(CurrentValues.Instance.ConnectionPoolMaxSize); Ezbob.RegistryScanner.Scanner.Register(); ConfigureStructureMap(ObjectFactory.Container); } catch (Exception ex) { Log.Error(ex); throw; } // try _isInitialized = true; } // lock } // InitOnStart
} // class Account private void Reload(string actionName) { try { Info("{0} Paypoint accounts configuration started...", actionName); AConnection oDB = DbConnectionGenerator.Get(this); Accounts = oDB.Fill <Account>(SpName, CommandSpecies.StoredProcedure); Info( "{0} Paypoint accounts configuration complete, {1} loaded.", actionName, Grammar.Number(Accounts.Count, "account") ); } catch (Exception e) { Alert(e, "Failed to reload Paypoint accounts configuration."); } // try } // Reload
} // GetReport public FileResult DownloadReportDates(int reportId, DateTime from, DateTime to, string customer, bool?nonCash) { var report = GetReport(reportId); var rptDef = new ReportQuery(report, from, to, customer, nonCash); AConnection oDB = DbConnectionGenerator.Get(); var reportHandler = new ReportHandler(oDB); var excel = reportHandler.GetWorkBook(report, rptDef); var fc = new FileContentResult( excel.GetAsByteArray(), "Application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ) { FileDownloadName = report.Title.Replace(" ", "") + from.ToString("yyyy-MM-dd") + to.ToString("yyyy-MM-dd") + ".xlsx" }; return(fc); } // DownloadReportDates
public ContentResult GetReportDates(int reportId, DateTime from, DateTime to, string customer, bool?nonCash) { var report = GetReport(reportId); from = DateTime.SpecifyKind(from, DateTimeKind.Utc); to = DateTime.SpecifyKind(to, DateTimeKind.Utc); var rptDef = new ReportQuery(report, from, to, customer, nonCash); var oColumnTypes = new List <string>(); AConnection oDB = DbConnectionGenerator.Get(); var reportHandler = new ReportHandler(oDB); bool isError; ATag data = reportHandler.GetReportData(report, rptDef, oColumnTypes, out isError); return(new ContentResult { Content = Newtonsoft.Json.JsonConvert.SerializeObject(new { report = data.ToString(), columns = oColumnTypes, }), ContentType = "application/json", }); } // GetReportDates
} // Init private static void Read() { Logger.Info("Reading configurations"); try { var oDB = DbConnectionGenerator.Get(Logger); oDB.ForEachRow((row, bRowsetStart) => { AddSingleConfiguration(row["CfgKey"].ToString(), row["CfgValue"].ToString()); return(ActionResult.Continue); }, spName); if (readConfigurationsCounter != propertyInfos.Length) { Logger.Error("Couldn't fill all properties"); Environment.Exit(-1); } // if } catch (Exception e) { Logger.Error("Error reading configurations:{0}", e); Environment.Exit(-1); } // try } // Read
public void Init() { _db = DbConnectionGenerator.Get(Log); }
public LogBookController(IWorkplaceContext context) { this.db = DbConnectionGenerator.Get(); this.context = context; } // constructor
} // constructor public void InitFromCustomer(Customer customer) { if (customer == null) { return; } IsBrokerRegulated = (customer.Broker != null) && customer.Broker.FCARegistered; IsWizardComplete = (customer.WizardStep != null) && customer.WizardStep.TheLastOne; Id = customer.Id; SegmentType = customer.SegmentType(); Origin = customer.CustomerOrigin.Name; IsAvoid = customer.IsAvoid; IsAlibaba = customer.IsAlibaba; FraudCheckStatus = customer.FraudStatus.Description(); FraudCheckStatusId = (int)customer.FraudStatus; Website = "www." + customer.Name.Substring(customer.Name.IndexOf('@') + 1); if (customer.PersonalInfo != null) { IsRegulated = customer.PersonalInfo.IsRegulated; if (customer.PersonalInfo.DateOfBirth.HasValue) { DateOfBirth = customer.PersonalInfo.DateOfBirth.Value; Age = MiscUtils.GetFullYears(customer.PersonalInfo.DateOfBirth.Value); Gender = customer.PersonalInfo.Gender.ToString(); FullGender = Gender == "M" ? "Male" : "Female"; FamilyStatus = customer.PersonalInfo.MaritalStatus.ToString(); if (customer.PropertyStatus != null) { PropertyStatus = new PropertyStatusModel { Description = customer.PropertyStatus.Description, Id = customer.PropertyStatus.Id, IsOwnerOfMainAddress = customer.PropertyStatus.IsOwnerOfMainAddress, IsOwnerOfOtherProperties = customer.PropertyStatus.IsOwnerOfOtherProperties }; } } } if (customer.Company != null) { CompanyName = customer.Company.CompanyName; CompanyType = customer.Company.TypeOfBusiness.ToString(); CompanyExperianRefNum = customer.Company.ExperianRefNum; if (customer.Company.Directors != null) { List <Director> oDirList = customer.Company.Directors.Where(x => !x.IsDeleted).ToList(); if (oDirList.Count > 0) { Directors = customer.Company.Directors.Select(d => DirectorModel.FromDirector(d, oDirList)).ToArray(); } } // if } // if if (Directors == null) { Directors = new DirectorModel[0]; } if (customer.FraudStatus != FraudStatus.Ok) { IsFraudInAlertMode = true; } IsTestInAlertMode = customer.IsTest; AmlResult = customer.AMLResult; IsAmlInAlertMode = AmlResult != "Passed"; PromoCode = customer.PromoCode; if (!string.IsNullOrEmpty(PromoCode)) { PromoCodeCss = "promo_code"; } if (customer.PersonalInfo != null) { Name = customer.PersonalInfo.Fullname; FirstName = customer.PersonalInfo.FirstName; Surname = customer.PersonalInfo.Surname; MobilePhone = customer.PersonalInfo.MobilePhone; DaytimePhone = customer.PersonalInfo.DaytimePhone; OverallTurnOver = customer.PersonalInfo.OverallTurnOver; WebSiteTurnOver = customer.PersonalInfo.WebSiteTurnOver; } // if List <CustomerPhone> customerPhones = customerPhoneRepository .GetAll() .Where(x => x.CustomerId == customer.Id && x.IsCurrent) .ToList(); MobileTooltip = "Click to verify"; DaytimeTooltip = "Click to verify"; foreach (CustomerPhone customerPhone in customerPhones) { if (customerPhone.PhoneType == "Mobile") { MobilePhoneVerified = customerPhone.IsVerified; if (MobilePhoneVerified) { if (!string.IsNullOrEmpty(customerPhone.VerifiedBy) && customerPhone.VerificationDate.HasValue) { MobileTooltip = string.Format("Verified by {0} at {1}", customerPhone.VerifiedBy, customerPhone.VerificationDate.Value.ToShortDateString()); } else { MobileTooltip = "Verified"; } } } else if (customerPhone.PhoneType == "Daytime") { DaytimePhoneVerified = customerPhone.IsVerified; if (DaytimePhoneVerified) { if (!string.IsNullOrEmpty(customerPhone.VerifiedBy) && customerPhone.VerificationDate.HasValue) { DaytimeTooltip = string.Format("Verified by {0} at {1}", customerPhone.VerifiedBy, customerPhone.VerificationDate.Value.ToShortDateString()); } else { DaytimeTooltip = "Verified"; } } } } Medal = customer.Medal.HasValue ? customer.Medal.ToString() : ""; Email = customer.Name; EmailState = EmailConfirmationState.Get(customer); if (customer.GreetingMailSentDate != null) { DateTime registrationDate = customer.GreetingMailSentDate.Value; int registrationTimeYears, registrationTimeMonths; MiscUtils.GetFullYearsAndMonths(registrationDate, out registrationTimeYears, out registrationTimeMonths); RegistrationDate = customer.GreetingMailSentDate.Value.ToString("MMM dd, yyyy") + string.Format(" [{0}y {1}m]", registrationTimeYears, registrationTimeMonths); } UserStatus = customer.Status.ToString(); CreditResult = customer.CreditResult.ToString(); CustomerStatusId = customer.CollectionStatus.Id; IsCustomerInEnabledStatus = customer.CollectionStatus.IsEnabled; IsCustomerStatusInAlertMode = customer.CollectionStatus.Name != "Enabled"; CustomerStatusName = customer.CollectionStatus.Name; IsWarning = customer.CollectionStatus.IsWarning; ReferenceSource = customer.ReferenceSource; ABTesting = customer.ABTesting; CompanyEmployeeCountInfo = new CompanyEmployeeCountInfo(customer.Company); ActiveCampaign = ""; var activeCampaigns = customer.ActiveCampaigns .Where(cc => cc.Campaign.EndDate >= DateTime.Today && cc.Campaign.StartDate <= DateTime.Today ) .Select(cc => cc.Campaign.Name) .ToList(); if (activeCampaigns.Any()) { ActiveCampaign = activeCampaigns.Aggregate((i, j) => i + ", " + j); } IsCciMarkInAlertMode = customer.CciMark; BlockTakingLoan = customer.BlockTakingLoan; TrustPilotStatusDescription = customer.TrustPilotStatus.Description; TrustPilotStatusName = customer.TrustPilotStatus.Name; ExternalCollectionStatusName = customer.ExternalCollectionStatus == null ? "" : customer.ExternalCollectionStatus.Name; ExternalCollectionStatusID = customer.ExternalCollectionStatus == null ? "" : Convert.ToString(customer.ExternalCollectionStatus.Id); BrokerID = customer.Broker == null ? 0 : customer.Broker.ID; BrokerName = customer.Broker == null ? "" : customer.Broker.ContactName; BrokerFirmName = customer.Broker == null ? "" : customer.Broker.FirmName; BrokerContactEmail = customer.Broker == null ? "" : customer.Broker.ContactEmail; BrokerContactMobile = customer.Broker == null ? "" : customer.Broker.ContactMobile; CustomerAddress oAddress = customer.AddressInfo.PersonalAddress.FirstOrDefault(); if (oAddress != null) { PostCode = oAddress.Rawpostcode; } DbConnectionGenerator.Get(new SafeILog(this)).ForEachRowSafe( sr => { switch ((string)sr["DocumentName"]) { case "Board resolution": BoardResolutionTemplateID = sr["EsignTemplateID"]; break; case "Personal guarantee": PersonalGuaranteeTemplateID = sr["EsignTemplateID"]; break; } // switch }, "LoadEsignTemplatesByCustomer", CommandSpecies.StoredProcedure, new QueryParameter("CustomerID", customer.Id) ); } // InitFromCustomer
public MvcApplication() { base.Init(); CurrentValues.Init(DbConnectionGenerator.Get(Log), Log); }
public GridsController() { this.db = DbConnectionGenerator.Get(); } // constructor
static ABrokerBaseController() { ms_oLog = new SafeILog(typeof(BrokerHomeController)); m_oDB = DbConnectionGenerator.Get(ms_oLog); } // static constructor
} // ValidateMpUniqueness private void SaveMarketplace(AddAccountState oState, AccountModel model, Customer oCustomer) { try { model.id = this.mpTypes.GetAll().First(a => a.InternalId == this.vendorInfo.Guid()).Id; model.displayName = model.displayName ?? model.name; SafeReader sr = DbConnectionGenerator.Get(log).GetFirst( "CreateOrLoadUploadedHmrcMarketplace", CommandSpecies.StoredProcedure, new QueryParameter("@CustomerID", oCustomer.Id), new QueryParameter("@SecurityData", new Encrypted(new Serialized(model))), new QueryParameter("@Now", DateTime.UtcNow) ); int spExitCode = sr["ExitCode"]; oState.CustomerMarketPlaceID = 0; switch (spExitCode) { case 0: oState.CustomerMarketPlaceID = sr["MpID"]; log.Info( "Successfully created uploaded/manual HMRC marketplace {0} for customer {1}.", oState.CustomerMarketPlaceID, oCustomer.Stringify() ); break; case -1: log.Alert( "Failed to create uploaded/manual HMRC marketplace for customer {0}.", oCustomer.Stringify() ); break; case -2: log.Alert( "Uploaded/manual HMRC marketplace with email '{0}' that should belong to customer {1}" + "already exists with id {2} and belongs to customer {3}.", oCustomer.Name, oCustomer.Stringify(), sr["MpID"], sr["OtherCustomerID"] ); break; default: log.Alert( "Other error while creating uploaded/manual HMRC marketplace for customer {0}.", oCustomer.Stringify() ); break; } // switch if (spExitCode < 0) { throw new Exception("Failed to save VAT return data."); } } catch (Exception e) { log.Error(e); oState.Error = new HmrcManualAccountManagerException(e); } // try if (oState.Error != null) { return; } try { // This is done to for two reasons: // 1. update Customer.WizardStep to WizardStepType.Marketplace // 2. insert entries into EzServiceActionHistory this.serviceClient.Instance.UpdateMarketplace( oCustomer.Id, oState.CustomerMarketPlaceID, true, this.context.UserId ); } catch (Exception e) { log.Warn(e, "Failed to start UpdateMarketplace strategy for customer [{0}: {1}] with marketplace id {2}," + " if this is the only customer marketplace underwriter should run this strategy manually" + " (otherwise Main strategy will be stuck).", oCustomer.Id, oCustomer.Name, oState.CustomerMarketPlaceID ); } // try } // SaveMarketplace
} // BuildWizardModel private void BuildProfileModel(CustomerModel customerModel, Customer customer) { customerModel.FirstName = string.Empty; customerModel.MiddleName = string.Empty; customerModel.LastName = string.Empty; if (customer.PersonalInfo != null) { customerModel.FirstName = customer.PersonalInfo.FirstName; customerModel.MiddleName = customer.PersonalInfo.MiddleInitial; customerModel.LastName = customer.PersonalInfo.Surname; } // if customerModel.bankAccountAdded = customer.HasBankAccount; if (customer.HasBankAccount) { customerModel.BankAccountNumber = customer.BankAccount.AccountNumber; customerModel.SortCode = customer.BankAccount.SortCode; } // if customerModel.LastApprovedLoanTypeID = 0; customerModel.LastApprovedRepaymentPeriod = 0; customerModel.IsLastApprovedLoanSourceEu = false; customerModel.IsLastApprovedLoanSourceCOSME = false; customerModel.SignedLegalID = 0; customerModel.LastApprovedAmount = 0; customerModel.HasApprovalChance = customer.HasApprovalChance; customerModel.IsLoanTypeSelectionAllowed = customer.IsLoanTypeSelectionAllowed; if (customer.LastCashRequest != null) { customerModel.LastApprovedAmount = (int)(customer.LastCashRequest.ManagerApprovedSum ?? 0); customerModel.LastApprovedLoanTypeID = customer.LastCashRequest.LoanType.Id; customerModel.LastRepaymentPeriod = customer.LastCashRequest.RepaymentPeriod; customerModel.LastApprovedRepaymentPeriod = customer.LastCashRequest.ApprovedRepaymentPeriod ?? customer.LastCashRequest.RepaymentPeriod; customerModel.IsLastApprovedLoanSourceEu = customer.LastCashRequest.LoanSource.Name == LoanSourceName.EU.ToString(); customerModel.IsLastApprovedLoanSourceCOSME = customer.LastCashRequest.LoanSource.Name == LoanSourceName.COSME.ToString(); LoanLegal lastll = customer.LastCashRequest.LoanLegals.LastOrDefault(); customerModel.SignedLegalID = (lastll == null) ? 0 : lastll.Id; customerModel.IsCustomerRepaymentPeriodSelectionAllowed = customer.LastCashRequest.IsCustomerRepaymentPeriodSelectionAllowed; } // if customerModel.Medal = customer.Medal.HasValue ? customer.Medal.ToString() : ""; customerModel.OfferStart = customer.OfferStart; customerModel.OfferValidUntil = customer.OfferValidUntil; customerModel.Loans = customer.Loans .OrderBy(l => l.Status) .ThenByDescending(l => l.Date) .Select(l => LoanModel.FromLoan(l, new LoanRepaymentScheduleCalculator(l, null, CurrentValues.Instance.AmountToChargeFrom), new LoanRepaymentScheduleCalculator(l, DateTime.UtcNow, CurrentValues.Instance.AmountToChargeFrom))) .ToList(); customerModel.TotalBalance = customerModel.Loans.Sum(l => l.Balance); customerModel.PrincipalBalance = customer.ActiveLoans.Sum(l => l.LoanAmount); customerModel.TotalEarlyPayment = customerModel.Loans.Sum(l => l.TotalEarlyPayment); customerModel.TotalLatePayment = customerModel.Loans .Where(l => l.Status == LoanStatus.Late.ToString()) .Sum(l => l.Late); var nextPayment = ( from loan in customer.ActiveLoans from repayment in loan.Schedule where repayment.AmountDue > 0 where repayment.Status == LoanScheduleStatus.StillToPay || repayment.Status == LoanScheduleStatus.Late orderby repayment.Date select repayment ).FirstOrDefault(); if (nextPayment != null) { customerModel.NextPayment = nextPayment.AmountDue; customerModel.NextPaymentDate = nextPayment.Date; customerModel.IsEarly = nextPayment.Date > DateTime.UtcNow && ( nextPayment.Date.Year != DateTime.UtcNow.Year || nextPayment.Date.Month != DateTime.UtcNow.Month || nextPayment.Date.Day != DateTime.UtcNow.Day ); } // if try { customerModel.TotalPayEarlySavings = new LoanPaymentFacade().CalculateSavings(customer, DateTime.UtcNow); } catch (Exception) { //do nothing } // try var payments = from loan in customer.Loans from tran in loan.Transactions where tran is PaypointTransaction orderby tran.PostDate descending select tran; var lastPayment = payments.OfType <PaypointTransaction>().FirstOrDefault(); if (lastPayment != null) { customerModel.LastPaymentTotal = lastPayment.Amount; customerModel.LastPaymentPrincipal = lastPayment.Principal; customerModel.LastPaymentInterest = lastPayment.Interest; customerModel.LastPaymentFees = lastPayment.Fees; } // if var isDefault = customer.CollectionStatus != null && customer.CollectionStatus.IsDefault; customerModel.BlockTakingLoan = customer.BlockTakingLoan; //customerModel.Perks = isDefault ? null : m_oPerksRepository.GetActivePerk(); customerModel.TrustPilotStatusID = customer.TrustPilotStatus.ID; // Currently disabled trust pilot for EVL customers customerModel.TrustPilotReviewEnabled = CurrentValues.Instance.TrustPilotReviewEnabled && customer.CustomerOrigin.IsEzbob(); customerModel.PayPointCards = FillPayPointCards(customer); customerModel.ActiveRollovers = m_oPaymentRolloverRepository .GetRolloversForCustomer(customer.Id) .Where(x => x.Status == RolloverStatus.New) .Select(x => new RolloverModel { Created = x.Created, CreatorName = x.CreatorName, CustomerConfirmationDate = x.CustomerConfirmationDate, ExpiryDate = x.ExpiryDate, Id = x.Id, LoanScheduleId = x.LoanSchedule.Id, PaidPaymentAmount = x.PaidPaymentAmount, Payment = x.Payment, PaymentDueDate = x.PaymentDueDate, PaymentNewDate = x.PaymentNewDate, Status = x.Status, LoanId = x.LoanSchedule.Loan.Id, RolloverPayValue = GetRolloverPayValue(x.LoanSchedule.Loan) }); customerModel.ApplyCount = customer.ApplyCount; customerModel.IsDefaultCustomerStatus = customer.CollectionStatus.IsDefault; customerModel.HasRollovers = customerModel.ActiveRollovers.Any(); var lastTurnover = customer.Turnovers.OrderByDescending(x => x.Timestamp) .FirstOrDefault(); if (lastTurnover != null) { customerModel.Turnover = lastTurnover.Turnover; customerModel.IsTurnoverExpired = (DateTime.Today - lastTurnover.Timestamp).TotalDays > (365.0 / 2); //half year } else { customerModel.Turnover = 0; customerModel.IsTurnoverExpired = true; } SafeReader sr = DbConnectionGenerator.Get(new SafeILog(this)).GetFirst( "LoadActiveLotteries", CommandSpecies.StoredProcedure, new QueryParameter("UserID", customer.Id), new QueryParameter("Now", DateTime.UtcNow) ); customerModel.LotteryPlayerID = sr.IsEmpty ? string.Empty : ((Guid)sr["UniqueID"]).ToString("N"); customerModel.LotteryCode = sr["LotteryCode"]; } // BuildProfileModel