public ActiveRing(PhoneNumberStruct source, PhoneNumberStruct destination, DateTime ringTime) { _phoneSource = source; _phoneDestination = destination; _ringTime = ringTime; _state = ActiveRingState.Ring; }
public Client(PhoneNumberStruct phoneNumber, String userName, IBillingType billingType, DateTime billingChangeDate) { _phoneNumber = phoneNumber; _userName = userName; _billingType = billingType; _billingChangeDate = billingChangeDate; }
public void PlugTerminal(PhoneNumberStruct number) { var source = _pbxPorts.FirstOrDefault(x => x.PhoneNumber == number); if (source != null) { source.PbxTerminal.Plug(); } }
public void Call(PhoneNumberStruct phoneSource, PhoneNumberStruct phoneDestination) { var source = _pbxPorts.FirstOrDefault(x => x.PhoneNumber == phoneSource); if (source != null) { source.PbxTerminal.CallTo(phoneDestination); } }
public CallStatisticsItem(PhoneNumberStruct phoneSource, PhoneNumberStruct phoneDestination, IBillingType billingType, DateTime startTimeCall, DateTime finishTimeCall) { _phoneSource = phoneSource; _phoneDestination = phoneDestination; _billingType = billingType; _startTimeCall = startTimeCall; _finishTimeCall = finishTimeCall; }
public void SetNewBillingType(PhoneNumberStruct number,IBillingType billingType, DateTime billingChangeDate) { var clientBuff = _clients.FirstOrDefault(x=>x.PhoneNumber == number); if (clientBuff != null) { clientBuff.SetNewBillingType(billingType,billingChangeDate); } }
public void AddCallStatistics(PhoneNumberStruct phoneSource,PhoneNumberStruct phoneDestination, DateTime startTimeCall, DateTime finishTimeCall) { var user = _clients.FirstOrDefault(x => x.PhoneNumber == phoneSource); if (user != null && user.BillingType != null) { _callStatistics.AddItem(new CallStatisticsItem(phoneSource, phoneDestination, user.BillingType, startTimeCall, finishTimeCall)); } }
// Methods public bool IsContainsPhoneNumber(PhoneNumberStruct item) { if(PhoneSource == item || PhoneDestination == item ) { return true; } else { return false; } }
public bool CallTo(PhoneNumberStruct number) { if (State == TerminalState.Available) { CallingEventArgs callingEventArgs = new CallingEventArgs(); callingEventArgs.PhoneNumberArg = number; callingEventArgs.TerminalStateArg = TerminalState.Available; OnCallingTo(callingEventArgs); _state = callingEventArgs.TerminalStateArg; } return false; }
public PhoneNumberStruct GetSecondValueIfExist(PhoneNumberStruct item) { if (PhoneSource == item) { return PhoneDestination; } else { if (PhoneDestination == item) { return PhoneSource; } else { return new PhoneNumberStruct(); } } }
public IEnumerable<CallStatisticsItem> GetStatisticsByNumber(PhoneNumberStruct number) { return _callStatistics.Where(x=> x.PhoneSource == number); }
public void SetNewBillingType(PhoneNumberStruct number, IBillingType billingType) { _billingSystem.SetNewBillingType(number,billingType,System.DateTime.Now); }
public IEnumerable<CallStatisticsItem> GetStatisticsByNumber(PhoneNumberStruct number) { return _billingSystem.GetStatisticsByNumber(number); }
private void Disconnect(PhoneNumberStruct number) { var portBuff = _pbxPorts.FirstOrDefault(x => x.PhoneNumber == number); if (portBuff != null) { portBuff.Disconnect(); } }
private bool Connecting(PhoneNumberStruct number) { var portDestination = _pbxPorts.FirstOrDefault(x => x.PhoneNumber == number); if (portDestination != null) { return portDestination.Ring(); } else { return false; } }
// Constructor public PBXPort(PhoneNumberStruct number) { PhoneNumber = number; _state = PortState.Available; }