private void InitializeObserver() { TransactionManager tmgr = new TransactionManager(new List<Observer>() ,new List<Product>()); LuceneManager productIndexer = new LuceneManager(tmgr); ProductTotalizer productTotalizer = new ProductTotalizer(tmgr); Session[Constants.TransactionManager] = tmgr; Session[Constants.ProductIndexer] = productIndexer; Session[Constants.ProductTotalizer] = productTotalizer; }
//private static readonly string filePath = @"C:\Users\vbhujan\Documents\Transactions.txt"; static void Main(string[] args) { List<Observer> listOfObservers = new List<Observer>(); List<Product> listOfProducts = new List<Product>(); TransactionManager tm = new TransactionManager(listOfObservers, listOfProducts); ProductTotalizer transactionTotals = new ProductTotalizer(tm); //ProductIndexer productIndexer = new ProductIndexer(tm); tm.ReadTransactionsFromFile(new StreamReader(@"C:\Users\vbhujan\Documents\Cart.txt")); //Reads file and notifies observers Console.WriteLine("Total Sales: " + transactionTotals.totalSales); Console.WriteLine("Total Tax: " + transactionTotals.totalTax); Console.WriteLine("Total Amount: " + transactionTotals.totalAmount); Console.ReadLine(); }
public LuceneManager(TransactionManager tm) { this.transactionManager = tm; this.transactionManager.attach(this); }
public ProductTotalizer(TransactionManager tm) { this.transactionManager = tm; this.transactionManager.attach(this); }