コード例 #1
0
        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();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: TestDbContext.cs プロジェクト: Adipa-G/ndbgate
        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>());
        }
コード例 #4
0
        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)));
        }