Example #1
0
        private void OnCallRecordSend(object sender, CallEventArgs e)
        {
            IAbonent abonent = _abonentList.FirstOrDefault(a => a.PhoneNumber == e.CallerPhoneNumber);
            Call     call    = new Call(e, abonent.Tariff);

            abonent.Balance -= call.Cost;
            _callList.Add(call);
        }
Example #2
0
        public void DeleteAbonent(IAbonent abonent)
        {
            IStation station = GetStationByPhoneNumberContains(abonent.PhoneNumber);
            IPort    port    = station.Ports.FirstOrDefault(p => p.PhoneNumber == abonent.PhoneNumber);

            port.OutcomingCall -= station.CallingRequest;
            port.CallTerminate -= station.OnCallTerminate;
            _abonentList.Remove(abonent);
        }
Example #3
0
        public IReport GetReportForAbonentSinceDate(IAbonent abonent, DateTime date)
        {
            IReport report = new Report()
            {
                Abonent = abonent,
                Calls   = callsService.GetCallsForAbonentFrom(abonent, date)
            };

            return(report);
        }
Example #4
0
        public void AddAbonent(IAbonent abonent, IStation station)
        {
            _abonentList.Add(abonent);
            abonent.CallReportRequest += OnCallReportRequest;
            IPort port = new Port(abonent.PhoneNumber, abonent.Terminal);

            station.Ports.Add(port);
            port.OutcomingCall += station.CallingRequest;
            port.CallTerminate += station.OnCallTerminate;
        }
Example #5
0
        public IReport GetReportForAbonent(IAbonent abonent)
        {
            IReport report = new Report()
            {
                Abonent = abonent,
                Calls   = callsService.GetCallsForAbonent(abonent)
            };

            return(report);
        }
Example #6
0
 public void AddAbonent(IAbonent abonent)
 {
     if (abonent != null && abonents.Where(x => x.Equals(abonent)).FirstOrDefault() == null)
     {
         abonents.Add(abonent);
         Console.WriteLine($"Abonent: {abonent.Name} added");
     }
     else
     {
         Console.WriteLine($"Abonent: {abonent.Name} not added");
     }
 }
Example #7
0
 public void RegisterAbonent(IAbonent abonent)
 {
     abonentsService.AddAbonent(abonent);
 }
Example #8
0
 public ICollection <CallInfo> GetCallsForAbonentFrom(IAbonent abonent, DateTime from)
 {
     return(calls.Where(x => (x.From.Equals(abonent) || x.To.Equals(abonent)) && x.ATSCall.CallDate >= from).ToList());
 }
Example #9
0
 public ICollection <CallInfo> GetCallsForAbonent(IAbonent abonent)
 {
     return(calls.Where(x => x.From.Equals(abonent) || x.To.Equals(abonent)).ToList());
 }