Ejemplo n.º 1
0
 public ActiveRing(PhoneNumberStruct source, PhoneNumberStruct destination, DateTime ringTime)
 {
     _phoneSource = source;
     _phoneDestination = destination;
     _ringTime = ringTime;
     _state = ActiveRingState.Ring;
 }
Ejemplo n.º 2
0
 public Client(PhoneNumberStruct phoneNumber, String userName, IBillingType billingType, DateTime billingChangeDate)
 {
     _phoneNumber = phoneNumber;
     _userName = userName;
     _billingType = billingType;
     _billingChangeDate = billingChangeDate;
 }
Ejemplo n.º 3
0
Archivo: PBX.cs Proyecto: choob207/Epam
 public void PlugTerminal(PhoneNumberStruct number)
 {
     var source = _pbxPorts.FirstOrDefault(x => x.PhoneNumber == number);
     if (source != null)
     {
         source.PbxTerminal.Plug();
     }
 }
Ejemplo n.º 4
0
Archivo: PBX.cs Proyecto: choob207/Epam
 public void Call(PhoneNumberStruct phoneSource, PhoneNumberStruct phoneDestination)
 {
     var source = _pbxPorts.FirstOrDefault(x => x.PhoneNumber == phoneSource);
     if (source != null)
     {
         source.PbxTerminal.CallTo(phoneDestination);
     }
 }
Ejemplo n.º 5
0
 public CallStatisticsItem(PhoneNumberStruct phoneSource, PhoneNumberStruct phoneDestination, IBillingType billingType, DateTime startTimeCall, DateTime finishTimeCall)
 {
     _phoneSource = phoneSource;
     _phoneDestination = phoneDestination;
     _billingType = billingType;
     _startTimeCall = startTimeCall;
     _finishTimeCall = finishTimeCall;
 }
Ejemplo n.º 6
0
 public void SetNewBillingType(PhoneNumberStruct number,IBillingType billingType, DateTime billingChangeDate)
 {
     var clientBuff = _clients.FirstOrDefault(x=>x.PhoneNumber == number);
     if (clientBuff != null)
     {
         clientBuff.SetNewBillingType(billingType,billingChangeDate);
     }
 }
Ejemplo n.º 7
0
 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));
     }
 }
Ejemplo n.º 8
0
 // Methods
 public bool IsContainsPhoneNumber(PhoneNumberStruct item)
 {
     if(PhoneSource == item || PhoneDestination == item )
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Ejemplo n.º 9
0
        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;
        }
Ejemplo n.º 10
0
 public PhoneNumberStruct GetSecondValueIfExist(PhoneNumberStruct item)
 {
     if (PhoneSource == item)
     {
         return PhoneDestination;
     }
     else
     {
         if (PhoneDestination == item)
         {
             return PhoneSource;
         }
         else
         {
             return new PhoneNumberStruct();
         }
     }
 }
Ejemplo n.º 11
0
 public IEnumerable<CallStatisticsItem> GetStatisticsByNumber(PhoneNumberStruct number)
 {
     return _callStatistics.Where(x=> x.PhoneSource == number);
 }
Ejemplo n.º 12
0
Archivo: PBX.cs Proyecto: choob207/Epam
 public void SetNewBillingType(PhoneNumberStruct number, IBillingType billingType)
 {
     _billingSystem.SetNewBillingType(number,billingType,System.DateTime.Now);
 }
Ejemplo n.º 13
0
Archivo: PBX.cs Proyecto: choob207/Epam
 public IEnumerable<CallStatisticsItem> GetStatisticsByNumber(PhoneNumberStruct number)
 {
     return _billingSystem.GetStatisticsByNumber(number);
 }
Ejemplo n.º 14
0
Archivo: PBX.cs Proyecto: choob207/Epam
 private void Disconnect(PhoneNumberStruct number)
 {
     var portBuff = _pbxPorts.FirstOrDefault(x => x.PhoneNumber == number);
     if (portBuff != null)
     {
         portBuff.Disconnect();
     }
 }
Ejemplo n.º 15
0
Archivo: PBX.cs Proyecto: choob207/Epam
        private bool Connecting(PhoneNumberStruct number)
        {
            var portDestination = _pbxPorts.FirstOrDefault(x => x.PhoneNumber == number);

            if (portDestination != null)
            {
                return portDestination.Ring();
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 16
0
 // Constructor
 public PBXPort(PhoneNumberStruct number)
 {
     PhoneNumber = number;
     _state = PortState.Available;
 }