Exemple #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);
        }
Exemple #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);
        }
Exemple #3
0
        public IReport GetReportForAbonentSinceDate(IAbonent abonent, DateTime date)
        {
            IReport report = new Report()
            {
                Abonent = abonent,
                Calls   = callsService.GetCallsForAbonentFrom(abonent, date)
            };

            return(report);
        }
Exemple #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;
        }
Exemple #5
0
        public IReport GetReportForAbonent(IAbonent abonent)
        {
            IReport report = new Report()
            {
                Abonent = abonent,
                Calls   = callsService.GetCallsForAbonent(abonent)
            };

            return(report);
        }
Exemple #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");
     }
 }
Exemple #7
0
 public void RegisterAbonent(IAbonent abonent)
 {
     abonentsService.AddAbonent(abonent);
 }
Exemple #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());
 }
Exemple #9
0
 public ICollection <CallInfo> GetCallsForAbonent(IAbonent abonent)
 {
     return(calls.Where(x => x.From.Equals(abonent) || x.To.Equals(abonent)).ToList());
 }