Example #1
0
 public Client(string name, BillingCompany company, int number)
 {
     Name  = name;
     Phone = new Terminal(number);
     company.AddClient(this);
     this.company     = company;
     TariffPlan       = Tariffs.Standart;
     Balance          = 0;
     calls            = new List <Call>();
     tariffChangeDate = DateTime.Now;
     balancePayDate   = DateTime.Now;
 }
Example #2
0
        private static void DoCalls(BillingCompany company)
        {
            Random random = new Random();

            for (int i = 0; i < 300; i++)
            {
                var clients = company.GetClientList();
                var client  = clients[random.Next(clients.Count)];
                var number  = random.Next(101, 106);
                if (client.Phone.Number != number)
                {
                    client.Call(number, (ushort)random.Next(1, 30));
                }
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            BillingCompany company = new BillingCompany("A1");
            Client         bob     = new Client("Bob", company, 101);
            Client         tom     = new Client("Tom", company, 102);
            Client         anna    = new Client("Anna", company, 103);
            Client         elza    = new Client("Elza", company, 104);
            Client         fill    = new Client("Fill", company, 105);

            Client.Notify += DisplayMessage;

            DoCalls(company);

            tom.ChangeTariff(Tariffs.Standart);
            tom.ChangeTariff(Tariffs.Premium);
            tom.PayTheBill(3000);
            tom.SaveReportToFile();
            bob.SaveReportToFile(bob.GenerateReport("tom"));
            anna.OutputReportToConsole(anna.GenerateReport(50));
            elza.OutputReportToConsole();
            fill.OutputReportToConsole(fill.GenerateReport("elza"));
        }