public AccountCredit(Terminal terminal, string firstName, string secondName) { Terminal = terminal; FirstName = firstName; SecondName = secondName; Calls = new List <CallInfo>(); BillingSystem.Get().ChangeDateEvent += CheckBalance; BlockForDebtEvent += Terminal.TerminalBlock; UnBlockEvent += Terminal.TerminalUnBlock; }
private void CheckBalance(object o, EventArgs e) { if (BillingSystem.Get().CurrentDate.Day == 1) { DateTime LastMonth = BillingSystem.Get().CurrentDate.AddMonths(-1); LastMonthDebt = SumForPeriod(new DateTime(LastMonth.Year, LastMonth.Month, 1), new DateTime(LastMonth.Year, LastMonth.Month, BillingSystem.Get().CurrentDate.AddDays(-1).Day)); } if (BillingSystem.Get().CurrentDate.Day == 25 && LastMonthDebt > 0) { BlockForDebtEvent?.Invoke(this, e); } }
public void SetTariff(double pricePerSecond, int freeMinutes) { if ((BillingSystem.Get().CurrentDate - DateSignTariff).Days > 30) { PricePerSecond = pricePerSecond; FreeMinutes = freeMinutes; DateSignTariff = BillingSystem.Get().CurrentDate; } else { Console.WriteLine("You have already changed tarif this month!"); } }