Esempio n. 1
0
        static void Main(string[] args)
        {
            IATE           ate     = new ATE();
            CallHandler    handler = new CallHandler();
            IBillingSystem bs      = new BillingSystem(ate);

            IContract c1 = ate.SignContract(new Client("Vasya", "Topolev"), TypeOfTariff.Mini);
            IContract c2 = ate.SignContract(new Client("Petya", "Sosnov"), TypeOfTariff.Maxi);
            IContract c3 = ate.SignContract(new Client("Gena", "Beresov"), TypeOfTariff.Mini);

            c1.Client.PutMoney(5000);
            c1.Client.WithdrawMoney(30);
            Terminal t1 = ate.NewTerminal(c1);
            Terminal t2 = ate.NewTerminal(c2);
            Terminal t3 = ate.NewTerminal(c3);

            t1.ConnectToATS();
            t2.ConnectToATS();
            t3.ConnectToATS();
            t1.Call(t2.Number);
            Thread.Sleep(1111);
            t2.EndCall();
            t3.Call(t1.Number);
            Thread.Sleep(2222);
            t3.EndCall();
            t2.Call(t1.Number);
            Thread.Sleep(3333);
            t1.EndCall();
            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            IATE           aTEx   = new ATE();
            IBillingSystem bs     = new BillingSys(aTEx);
            IReportCreator report = new ReportCreator();

            IContract con1 = aTEx.RegisterContract(new User("Anton", "Goncharuk"), TypeOffTariffPlan.Business);
            IContract con2 = aTEx.RegisterContract(new User("Olga", "Gordeeva"), TypeOffTariffPlan.Smart);
            IContract con3 = aTEx.RegisterContract(new User("Alex", "Kulesh"), TypeOffTariffPlan.SmartUnlim);
            IContract con4 = aTEx.RegisterContract(new User("Misha", "Antonov"), TypeOffTariffPlan.SmartMini);

            Console.WriteLine(new string('=', 75));
            Console.WriteLine("Abonents: =>");
            Console.WriteLine(con1.User.FirstName + "  " + con1.User.LastName + "  " + con1.Number + " " + con1.Tariff.TypeOffTariffPlan + "  " + con1.User.Money);
            Console.WriteLine(con2.User.FirstName + "  " + con2.User.LastName + "  " + con2.Number + " " + con2.Tariff.TypeOffTariffPlan + "  " + con2.User.Money);
            Console.WriteLine(con3.User.FirstName + "  " + con3.User.LastName + "  " + con3.Number + " " + con3.Tariff.TypeOffTariffPlan + "  " + con3.User.Money);
            Console.WriteLine(con4.User.FirstName + "  " + con4.User.LastName + "  " + con4.Number + " " + con4.Tariff.TypeOffTariffPlan + "  " + con4.User.Money);
            Console.WriteLine(new string('=', 75));

            con4.ChangeTariff(TypeOffTariffPlan.Business);
            Console.WriteLine(new string('=', 75));

            var ter1 = aTEx.NewTerminal(con1);
            var ter2 = aTEx.NewTerminal(con2);
            var ter3 = aTEx.NewTerminal(con3);
            var ter4 = aTEx.NewTerminal(con4);

            ter1.ConnectToPort();
            ter2.ConnectToPort();
            ter3.ConnectToPort();
            ter4.ConnectToPort();

            ter1.Call(ter2.Number);
            ter3.Call(ter1.Number);
            //ter4.DisconnectFromPort();
            ter1.Call(ter4.Number);

            Console.WriteLine(new string('=', 75));
            Console.WriteLine("Report by number: {0}", ter1.Number);
            report.Create(bs.GetReport(ter1.Number), TypeOfSort.SortByDate);
            Console.WriteLine(new string('=', 75));
            //report.Create(bs.GetReport(ter1.Number), TypeOfSort.SortByCallType);
            //Console.WriteLine(new string('=', 75));
            //report.Create(bs.GetReport(ter1.Number), TypeOfSort.SortByNumber);
            //Console.WriteLine(new string('=', 75));
            //report.Create(bs.GetReport(ter1.Number), TypeOfSort.SortByCost);
            //Console.WriteLine(new string('=', 75));

            //Console.WriteLine(con1.User.FirstName + "  " + con1.User.LastName + "  " + con1.Number + " " + con1.Tariff.TypeOffTariffPlan + "  " + con1.User.Money);
            //Console.WriteLine(con2.User.FirstName + "  " + con2.User.LastName + "  " + con2.Number + " " + con2.Tariff.TypeOffTariffPlan + "  " + con2.User.Money);
            //Console.WriteLine(con3.User.FirstName + "  " + con3.User.LastName + "  " + con3.Number + " " + con3.Tariff.TypeOffTariffPlan + "  " + con3.User.Money);
            //Console.WriteLine(con4.User.FirstName + "  " + con4.User.LastName + "  " + con4.Number + " " + con4.Tariff.TypeOffTariffPlan + "  " + con4.User.Money);
            //Console.WriteLine(new string('=', 75));
        }