Beispiel #1
0
        public Report GetReport(int telephoneNumber)
        {
            var calls = _storage.GetInfoList().
                Where(x => x.MyNumber == telephoneNumber || x.TargetNumber == telephoneNumber).
                ToList();
            var report = new Report();

            foreach(var call in calls)
            {
                CallType callType;
                int number;
                if(call.MyNumber == telephoneNumber)
                {
                    callType = CallType.OutgoingCall;
                    number = call.TargetNumber;
                }
                else
                {
                    callType = CallType.IncomingCall;
                    number = call.MyNumber;
                }
                var record = new ReportRecord(callType, number, call.BeginCall, new DateTime((call.EndCall - call.BeginCall).Ticks), call.Cost); // TimeSpan.FromTicks((call.EndCall - call.BeginCall).Ticks) .TotalMinutes
                report.AddRecord(record);
            }
            return report;
        }
Beispiel #2
0
 public void AddRecord(ReportRecord record)
 {
     _listRecords.Add(record);
 }