public override int GetHashCode() { int hash = 1; if (ObjectUuid.Length != 0) { hash ^= ObjectUuid.GetHashCode(); } if (Client.Length != 0) { hash ^= Client.GetHashCode(); } if (PortfolioName.Length != 0) { hash ^= PortfolioName.GetHashCode(); } if (createdAt_ != null) { hash ^= CreatedAt.GetHashCode(); } if (receivedAt_ != null) { hash ^= ReceivedAt.GetHashCode(); } if (value_ != null) { hash ^= Value.GetHashCode(); } return(hash); }
public static PortfolioName Parse(string portfolioName) { var portfolio = new PortfolioName { Value = portfolioName }; return(portfolio); }
private void GetAccountsForClient(string clientsFilePath, string obligationsFilePath) { try { _log.Info($"Gonna try to open file {clientsFilePath}"); if (File.Exists(clientsFilePath)) { var readText = File.ReadAllLines(clientsFilePath, Encoding.UTF8); _log.Info($"There are {readText.Length} accounts in {clientsFilePath}"); foreach (var row in readText) { if (row.Length > 11) { var line = row.ToUpper().Split('\t'); if (line.Length < 7) { throw new Exception( $"Row: {row} in {clientsFilePath} does not have 7 tab-separated columns. It has {line.Length}."); } var portfolioName = new PortfolioName(line[0]); var accountNumber = new AccountNumber(line[1]); var userName = line[2]; double balance; double.TryParse(line[3], out balance); var inventroy = line[4]; var daysDelinquent = double.Parse(line[5]); var lastPaymentAmount = 100.0; var lastPaymentDate = DateTime.Now.AddDays(-10); if (daysDelinquent > 0.0) { lastPaymentAmount = 55.0; lastPaymentDate = DateTime.Now.AddDays(-1 * daysDelinquent); } var delinquentAmount = double.Parse(line[6]); var accountBoarded = new AccountBoardingModel ( line[0], accountNumber, balance, inventroy, userName, lastPaymentAmount: lastPaymentAmount, lastPaymentDate: lastPaymentDate ); if (_accountsInPortfolio.ContainsKey(portfolioName)) { var existingAccounts = _accountsInPortfolio[portfolioName]; existingAccounts.Add(accountNumber, accountBoarded); _accountsInPortfolio[portfolioName] = existingAccounts; } else { var accounts = new Dictionary <AccountNumber, AccountBoardingModel>(); accounts.Add(accountNumber, accountBoarded); _accountsInPortfolio.Add(portfolioName, accounts); } } } _log.Info($"Successfully processing file {clientsFilePath}"); GetObligationsForClient(obligationsFilePath); } else { throw new FileNotFoundException(clientsFilePath); } } catch (Exception e) { _log.Error($"[GetAccountsForClient]: {e.Message} {e.StackTrace}"); Sender.Tell(new FailedToLoadAccounts($"{e.Message} {e.StackTrace}")); } }