Ejemplo n.º 1
0
        public void WriteTransactionTimer(object obj)
        {
            var      lastMinuteTrans = Parking.GetParkingInstance().GetLastMinuteTransactions();
            FileInfo fi = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "\\Transaction.log");

            if (!fi.Exists)
            {
                fi.Create();
            }
            decimal sum = 0;

            foreach (var trn in lastMinuteTrans)
            {
                sum += trn._debit;
            }
            string msg = "Datetime: " + DateTime.Now.ToShortDateString() + " => SUM: " + sum.ToString() + "";

            System.IO.File.AppendAllText(fi.FullName, msg + "\r\n");
        }
Ejemplo n.º 2
0
        public IEnumerable <Transaction> GetLastMinuteTransactions()
        {
            var lastMinuteTrans = Parking.GetParkingInstance().allTransaction.Where <Transaction>(t => DateTime.Now == DateTime.Now.AddMinutes(-1));

            return(lastMinuteTrans);
        }