コード例 #1
0
        static void Main(string[] args)
        {
            BillingSystem          BS  = new BillingSystem();
            AutomaticPhoneExchange ATE = new AutomaticPhoneExchange(BS);
            var lite   = new Rate("Lite", 4, 2);
            var short2 = new Rate("Short", 0, 6);

            ATE.AddNewRate(lite);
            ATE.AddNewRate(short2);
            Terminal t1 = ATE.ConcludeContract("Mihail", "01", 20, lite);
            Terminal t2 = ATE.ConcludeContract("Igor", "02", 30, lite);
            Terminal t3 = ATE.ConcludeContract("Oksana", "03", 25, short2);

            t1.TurnOn();
            t2.TurnOn();
            t3.TurnOn();
            t1.Call("02");
            Thread.Sleep(2000);
            t3.Call("01");
            Thread.Sleep(2000);
            t2.TurnOff();
            Thread.Sleep(2000);
            t1.Call("02");
            Thread.Sleep(2000);
            t1.Call("03");
            Thread.Sleep(2000);
            t1.EndCall();
            Thread.Sleep(2000);
            t1.GetCallsHistory();
            Thread.Sleep(2000);
            t1.GetRateInfo();
            Thread.Sleep(2000);
            t1.ChangeRate("short");
            Thread.Sleep(2000);
            t1.GetCallsHistoryByCost(4);

            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: IIITanbI/EpamProjects
        static void Main(string[] args)
        {
            DateTime dt   = DateTime.Now;
            DateTime add  = new DateTime();
            TimeSpan addd = new TimeSpan(2000000000);

            Console.WriteLine(addd.TotalMinutes);

            add = add.AddMonths(1);
            Console.WriteLine(dt.TimeOfDay.TotalDays);
            Console.WriteLine(DateTime.MaxValue.TimeOfDay.TotalDays);
            PhoneNumber n1        = new PhoneNumber("123");
            ITerminal   terminal1 = new Terminal(n1);

            PhoneNumber n2        = new PhoneNumber("256");
            ITerminal   terminal2 = new Terminal(n2);

            PhoneNumber n3        = new PhoneNumber("512");
            ITerminal   terminal3 = new Terminal(n3);

            Station station = new Station(new List <IPort>(), new List <ITerminal>());

            station.Add(new Port());
            station.Add(new Port());
            station.Add(new Port());



            station.Add(terminal1);
            station.Add(terminal2);
            station.Add(terminal3);
            //station.Remove(terminal1);
            terminal1.Plug();
            //terminal2.Plug();
            terminal3.Plug();
            //terminal1.UnPlug();
            terminal1.Call(terminal2.PhoneNumber);
            terminal3.Call(terminal1.PhoneNumber);
            // terminal1.Interrupt();
            station.Remove(terminal1);
            Console.Read();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: IIITanbI/EpamProjects
        static void Main(string[] args)
        {
            DateTime dt = DateTime.Now;
            DateTime add = new DateTime();
            TimeSpan addd = new TimeSpan(2000000000);
            Console.WriteLine(addd.TotalMinutes);

            add = add.AddMonths(1);
            Console.WriteLine(dt.TimeOfDay.TotalDays);
            Console.WriteLine(DateTime.MaxValue.TimeOfDay.TotalDays);
            PhoneNumber n1 = new PhoneNumber("123");
            ITerminal terminal1 = new Terminal(n1);

            PhoneNumber n2 = new PhoneNumber("256");
            ITerminal terminal2 = new Terminal(n2);

            PhoneNumber n3 = new PhoneNumber("512");
            ITerminal terminal3 = new Terminal(n3);

            Station station = new Station(new List<IPort>(), new List<ITerminal>());
            station.Add(new Port());
            station.Add(new Port());
            station.Add(new Port());

            station.Add(terminal1);
            station.Add(terminal2);
            station.Add(terminal3);
            //station.Remove(terminal1);
            terminal1.Plug();
            //terminal2.Plug();
            terminal3.Plug();
            //terminal1.UnPlug();
            terminal1.Call(terminal2.PhoneNumber);
            terminal3.Call(terminal1.PhoneNumber);
               // terminal1.Interrupt();
            station.Remove(terminal1);
            Console.Read();
        }