static void Main(string[] args) { // initialize _investors = new List <Investor>(); _salesReps = new List <SalesRep>(); _transactions = new List <Transaction>(); using (var reader = new StreamReader($@"{Directory.GetCurrentDirectory()}/Data.csv")) using (var csv = new CsvReader(reader)) { var transactionMap = new TransactionMap(_investors, _salesReps); csv.Configuration.RegisterClassMap(transactionMap); _transactions = csv.GetRecords <Transaction>().ToList(); } // create reports var salesSummaryReport = new SalesSummaryReport(_transactions, _investors, _salesReps); salesSummaryReport.GenerateReport(); var assetsUnderManagementReport = new AssetsUndermanagementReport(_transactions, _investors, _salesReps); assetsUnderManagementReport.GenerateReport(); var breakReport = new BreakReport(_transactions, _investors, _salesReps); breakReport.GenerateReport(); var investorProfitLossReport = new InvestorProfitLossReport(_transactions, _investors, _salesReps); investorProfitLossReport.GenerateReport(); }
TType CreateTransaction <TType>(TransactionMap <TType> mapper, string transactionType, string transactionString) where TType : ITransactionEntry { // Parse, map and add to listi var transaction = mapper.Parse <TType>(transactionString); transaction.Type = transactionType; return(transaction); }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); ProductMap.Map(modelBuilder.Entity <Product>()); ServiceMap.Map(modelBuilder.Entity <Service>()); TransactionMap.Map(modelBuilder.Entity <Transaction>()); ItemTransactionMap.Map(modelBuilder.Entity <ItemTransaction>()); ItemTransactionChargeMap.Map(modelBuilder.Entity <ItemTransactionCharge>()); }
void CreateAndAddTransaction <TType>(IList <ITransactionEntry> transactions, TransactionMap <TType> mapper, string transactionType, string transactionString) where TType : ITransactionEntry { if (string.IsNullOrEmpty(transactionString) || transactionString.StartsWith("!")) { return; } var transactionToAdd = CreateTransaction(mapper, transactionType, transactionString); if (string.IsNullOrEmpty(transactionToAdd.PayeeAccount) && transactionToAdd.Date <= DateTime.MinValue) { return; } transactions.Add((TType)Convert.ChangeType(transactionToAdd, typeof(TType))); }