Example #1
0
        public Service1()
        {
            mMP = new DBAL.MemoryPersistence(@"C:\__debug.txt");
            mMP.LoadFromFile();

            var daoFactory = new DBAL.DAOFactory(mMP);

            mDAO = daoFactory.GetTransactionDAO();
            iDAO = daoFactory.GetInvestorDAO();
            bDAO = daoFactory.GetBrockerDAO();

            Refresh();
        }
Example #2
0
        public InvestorDAO GetInvestorDAO()
        {
            var dao = new InvestorDAO(mMP);

            return(dao);
        }
Example #3
0
        public bool LoadFromFile()
        {
            if (mFilePath.Equals(""))
            {
                return(false);
            }

            //@see http://philcurnow.wordpress.com/2013/12/29/serializing-and-deserializing-json-in-c/

            // Brockers
            mBrockers.Add(new Brocker("Deutsche Bank DB Makler", 1));
            mBrockers.Add(new Brocker("mBank Biuro Maklerskie", 2));

            // Transactions
            Random rand = new Random();

            mData.Add(new Transaction(9.1f, mockAmount(rand), 1));
            mData.Add(new Transaction(9.2f, mockAmount(rand), 2));
            mData.Add(new Transaction(9.3f, mockAmount(rand), 3));
            mData.Add(new Transaction(9.4f, mockAmount(rand), 4));
            mData.Add(new Transaction(9.0f, mockAmount(rand), 5));
            mData.Add(new Transaction(9.1f, mockAmount(rand), 6));
            mData.Add(new Transaction(9.2f, mockAmount(rand), 7));
            mData.Add(new Transaction(9.8f, mockAmount(rand), 8));
            mData.Add(new Transaction(9.8f, mockAmount(rand), 9));
            mData.Add(new Transaction(9.6f, mockAmount(rand), 10));
            mData.Add(new Transaction(9.6f, mockAmount(rand), 11));
            mData.Add(new Transaction(9.1f, mockAmount(rand), 12));
            mData.Add(new Transaction(9.2f, mockAmount(rand), 13));
            mData.Add(new Transaction(9.2f, mockAmount(rand), 14));
            mData.Add(new Transaction(9.22f, mockAmount(rand), 15));
            mData.Add(new Transaction(9.58f, mockAmount(rand), 16));
            mData.Add(new Transaction(9.8f, mockAmount(rand), 17));
            mData.Add(new Transaction(9.77f, mockAmount(rand), 18));
            mData.Add(new Transaction(9.76f, mockAmount(rand), 19));
            mData.Add(new Transaction(9.60f, mockAmount(rand), 20));
            mData.Add(new Transaction(9.50f, mockAmount(rand), 21));
            mData.Add(new Transaction(9.3f, mockAmount(rand), 22));
            mData.Add(new Transaction(9.2f, mockAmount(rand), 23));
            mData.Add(new Transaction(9.1f, mockAmount(rand), 24));
            mData.Add(new Transaction(9.0f, mockAmount(rand), 25));
            mData.Add(new Transaction(8.95f, mockAmount(rand), 26));
            mData.Add(new Transaction(8.8f, mockAmount(rand), 27));
            mData.Add(new Transaction(9.0f, mockAmount(rand), 28));
            mData.Add(new Transaction(9.0f, mockAmount(rand), 29));
            mData.Add(new Transaction(9.1f, mockAmount(rand), 30));
            mData.Add(new Transaction(9.2f, mockAmount(rand), 31));
            mData.Add(new Transaction(9.3f, mockAmount(rand), 32));
            mData.Add(new Transaction(9.2f, mockAmount(rand), 33));
            mData.Add(new Transaction(9.1f, mockAmount(rand), 34));
            mData.Add(new Transaction(9.0f, mockAmount(rand), 35));

            // Investors
            var iDAO = new InvestorDAO(this);

            mInvestors.Add(new InvestorCE(iDAO, new Person("Jan", "Kowalski", 1), mData.GetRange(0, 5)));
            mInvestors.Add(new InvestorCE(iDAO, new Person("Adam", "Kulczyk", 2), mData.GetRange(5, 5)));
            mInvestors.Add(new InvestorCE(iDAO, new Person("Joanna", "Smith", 3), mData.GetRange(10, 5)));

            return(true);
        }
Example #4
0
 public InvestorsTOA(DBAL.BrockerDAO bDAO, DBAL.InvestorDAO iDAO)
 {
     mBrockerDAO  = bDAO;
     mInvestorDAO = iDAO;
 }
Example #5
0
 public InvestorCE(DBAL.InvestorDAO dao, Person person = null, List <Transaction> transactions = null)
 {
     mTransactions = transactions;
     Person        = person;
     mDAO          = dao;
 }