public CallHistory GetCallHistory(int telephoneNumber)
        {
            var calls = _data.GetInformationList().
                        Where(x => x.Number == telephoneNumber || x.TargetNumber == telephoneNumber).ToList();
            var callHistory = new CallHistory();

            foreach (var call in calls)
            {
                TypeOfCall callType;
                int        number;
                if (call.Number == telephoneNumber)
                {
                    callType = TypeOfCall.OutgoingCall;
                    number   = call.TargetNumber;
                }
                else
                {
                    callType = TypeOfCall.IncomingCall;
                    number   = call.Number;
                }
                var callRecord = new CallRecord(callType, number, call.StartOfCall, new DateTime((call.EndOfCall - call.StartOfCall).Ticks), call.CostOfCall);
                callHistory.AddCallRecord(callRecord);
            }
            return(callHistory);
        }
 public void Compiler(CallHistory report)
 {
     foreach (CallRecord record in report.GetRecords())
     {
         Console.WriteLine("Calls:\n Type of Call {0} | Number: {1} |\n Date of Call: {2} |\n Duration of Call: {3} | CostOfCall: {4} ",
                           record.TypeOfCall, record.Number, record.Date, record.Time.ToString("mm:ss"), record.Amount);
     }
 }
        public IEnumerable <CallRecord> SortCalls(CallHistory report, TypeOfSort typeOfSort)
        {
            var tempReport = report.GetRecords();

            switch (typeOfSort)
            {
            case TypeOfSort.SortByTypeOfCall:
                return(tempReport = tempReport.OrderBy(x => x.TypeOfCall).ToList());

            case TypeOfSort.SortByDate:
                return(tempReport = tempReport.OrderBy(x => x.Date).ToList());

            case TypeOfSort.SortByAmount:
                return(tempReport = tempReport.OrderBy(x => x.Amount).ToList());

            case TypeOfSort.SortByNumber:
                return(tempReport = tempReport.OrderBy(x => x.Number).ToList());

            default:
                return(tempReport);
            }
        }