Beispiel #1
0
 public void FindCallWithMoreTime(PaymentForCall somecall)
 {
     foreach (PaymentForCall call in callPayments)
     {
         if ((call.timeOfEnding.hour - call.timeOfBeginning.hour) * 60 +
             call.timeOfEnding.minute - call.timeOfBeginning.minute >
             (somecall.timeOfEnding.hour - somecall.timeOfBeginning.hour) * 60 +
             somecall.timeOfEnding.minute - somecall.timeOfBeginning.minute)
         {
             Console.WriteLine($"Платеж, длительностью {call.timeOfEnding.hour - call.timeOfBeginning.hour}:{call.timeOfEnding.minute - call.timeOfBeginning.minute}");
         }
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            CallPayments newCallPayments = new CallPayments();

            //вношу данные о платежах
            PaymentForCall first = new PaymentForCall();

            first.fullName               = "Владимир Дегтярев Андреевич";
            first.phoneNumber            = "+795156756780";
            first.dateOfCall.year        = 2021;
            first.dateOfCall.month       = 10;
            first.dateOfCall.day         = 20;
            first.oneMinuteRate          = 5;
            first.timeOfBeginning.hour   = 16;
            first.timeOfBeginning.minute = 30;
            first.timeOfEnding.hour      = 17;
            first.timeOfEnding.minute    = 10;
            newCallPayments.callPayments.Add(first);

            PaymentForCall two = new PaymentForCall();

            two.fullName               = "Богатырева Вероника Олеговна";
            two.phoneNumber            = "+79555375775";
            two.dateOfCall.year        = 2020;
            two.dateOfCall.month       = 10;
            two.dateOfCall.day         = 24;
            two.oneMinuteRate          = 5;
            two.timeOfBeginning.hour   = 17;
            two.timeOfBeginning.minute = 40;
            two.timeOfEnding.hour      = 18;
            two.timeOfEnding.minute    = 10;
            newCallPayments.callPayments.Add(two);

            PaymentForCall third = new PaymentForCall();

            third.fullName               = "Иванов Иван Иванович";
            third.phoneNumber            = "+795456686570";
            third.dateOfCall.year        = 2021;
            third.dateOfCall.month       = 12;
            third.dateOfCall.day         = 29;
            third.oneMinuteRate          = 15;
            third.timeOfBeginning.hour   = 14;
            third.timeOfBeginning.minute = 30;
            third.timeOfEnding.hour      = 16;
            third.timeOfEnding.minute    = 40;
            newCallPayments.callPayments.Add(third);

            //тестирую программу
            Console.WriteLine("Вывод всех платежей");
            newCallPayments.PrintCallPayments();

            Console.WriteLine("Поиск по ФИО: ");
            string name = Console.ReadLine();

            newCallPayments.SearchWithFullName(name);

            Console.WriteLine("Поиск по Дате(xx.xx.xxxx): ");
            string data = Console.ReadLine();

            newCallPayments.SearchWithDateOfCall(data);

            Console.WriteLine("Сортировка по фамилии");
            newCallPayments.SortWithFullName();
            newCallPayments.PrintCallPayments();

            Console.WriteLine("Сортировка по дате");
            newCallPayments.SortWithDate();
            newCallPayments.PrintCallPayments();

            Console.WriteLine("Поиск разговоров со временем разговора больше, чем у Владимира Дегтярева:");
            newCallPayments.FindCallWithMoreTime(first);
        }