Пример #1
0
        private static void Main(string[] args)
        {
            MobileOperator kyivstar = new MobileOperator();
            var            acc1     = kyivstar.CreateAccount(0930575259);
            var            acc2     = kyivstar.CreateAccount(1234565656);
            var            acc3     = kyivstar.CreateAccount(0930575258);
            var            acc4     = kyivstar.CreateAccount(23423423);
            var            acc5     = kyivstar.CreateAccount(234234234);
            var            acc6     = kyivstar.CreateAccount(234423432);
            var            acc7     = kyivstar.CreateAccount(234234);
            var            acc8     = kyivstar.CreateAccount(12312332);
            var            acc9     = kyivstar.CreateAccount(123123243);
            var            acc10    = kyivstar.CreateAccount(324234324);


            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            for (int i = 0; i < 10; i++)
            {
                kyivstar.BinarySerialize();
            }
            stopWatch.Stop();
            Console.WriteLine("Serialization type binary {0} ms", stopWatch.ElapsedMilliseconds);
            stopWatch.Reset();

            stopWatch.Start();
            for (int i = 0; i < 10; i++)
            {
                kyivstar.JsonSerialize();
            }
            stopWatch.Stop();
            Console.WriteLine("Serialization type JSON {0} ms", stopWatch.ElapsedMilliseconds);
            stopWatch.Reset();

            stopWatch.Start();
            for (int i = 0; i < 10; i++)
            {
                kyivstar.XmlSerialize();
            }
            stopWatch.Stop();
            Console.WriteLine("Serialization type XML {0} ms", stopWatch.ElapsedMilliseconds);

            Console.ReadLine();
        }
Пример #2
0
 public MobileAccount(int number, string firstName, string lastName, DateTime birthday, string email, MobileOperator mobileOperator)
 {
     _number   = number;
     FirstName = firstName;
     LastName  = lastName;
     Birthday  = birthday;
     Email     = email;
 }
Пример #3
0
 public MobileAccount(int number, MobileOperator mobileOperator)
 {
     _number = number;
 }
Пример #4
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Andrii");
            Console.ResetColor();

            MobileOperator kyivstar = new MobileOperator();
            var            acc1     = kyivstar.CreateAccount(1241, "Adam", "Levin", new DateTime(1998, 6, 23), "*****@*****.**");

            Validate(acc1);
            var acc2 = kyivstar.CreateAccount(2652, "Paul", "Graph", new DateTime(1985, 4, 7), "*****@*****.**");

            Validate(acc2);
            var acc3 = kyivstar.CreateAccount(3123, "Carl", "Monic", new DateTime(1988, 6, 27), "armron.com");

            Validate(acc3);
            var acc4 = kyivstar.CreateAccount(4244, "Jam", "Seric", new DateTime(1969, 8, 7), "*****@*****.**");

            Validate(acc4);
            var acc5 = kyivstar.CreateAccount(5655, "Resida", "Wist", new DateTime(1978, 10, 7), "*****@*****.**");

            Validate(acc5);
            var acc6 = kyivstar.CreateAccount(6126, "Wenda", "Room", new DateTime(1987, 1, 17), "*****@*****.**");

            Validate(acc6);
            Console.WriteLine();
            acc2.AddContact(acc1.Number, "First", "Contact");
            acc1.Call(acc2.Number);
            Console.WriteLine();

            acc1.Call(acc2.Number);
            acc2.Call(acc6.Number);
            acc3.Call(acc4.Number);
            acc4.Call(acc5.Number);
            acc5.Call(acc1.Number);
            acc4.Call(acc6.Number);

            acc3.Call(acc4.Number);
            acc4.Call(acc6.Number);
            acc3.Call(acc4.Number);
            acc6.Call(acc2.Number);
            acc5.Call(acc1.Number);
            acc5.Call(acc6.Number);


            acc1.AddContact(acc3.Number, "Third", "Contact");
            acc3.SendMessage(acc1.Number, "Hello");

            var nums = kyivstar.Get5MostCallingNumbers();

            Console.WriteLine("\n5 Most Calling Accounts: ");
            foreach (var n in nums)
            {
                Console.WriteLine(n);
            }
            kyivstar.Get5MostCallingNumbers();

            var dums = kyivstar.Get5MostActiveNumbers();

            Console.WriteLine("\n5 Most Active Accounts: ");
            foreach (var n in dums)
            {
                Console.WriteLine(n);
            }
            kyivstar.Get5MostActiveNumbers();
            Console.ReadLine();
        }