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); }
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); }
public IReport GetReportForAbonentSinceDate(IAbonent abonent, DateTime date) { IReport report = new Report() { Abonent = abonent, Calls = callsService.GetCallsForAbonentFrom(abonent, date) }; return(report); }
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; }
public IReport GetReportForAbonent(IAbonent abonent) { IReport report = new Report() { Abonent = abonent, Calls = callsService.GetCallsForAbonent(abonent) }; return(report); }
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"); } }
public void RegisterAbonent(IAbonent abonent) { abonentsService.AddAbonent(abonent); }
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()); }
public ICollection <CallInfo> GetCallsForAbonent(IAbonent abonent) { return(calls.Where(x => x.From.Equals(abonent) || x.To.Equals(abonent)).ToList()); }