public Contract(Subscriber subscriber, TariffType tariffType) { LastTariffUpdateDate = DateTime.Now; Subscriber = subscriber; Number = rnd.Next(1000000, 9999999); Tariff = new Tariff(tariffType); }
public bool ChangeTariff(TariffType tariffType) { if(DateTime.Now.AddMonths(-1) >= LastTariffUpdateDate) { LastTariffUpdateDate = DateTime.Now; Tariff = new Tariff(tariffType); Console.WriteLine("Tariff has changed!"); return true; } else { Console.WriteLine("Цait until the end of the month!"); return false; } }