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

            if (portDestination != null)
            {
                return portDestination.Ring();
            }
            else
            {
                return false;
            }
        }
예제 #16
0
파일: PBXPort.cs 프로젝트: choob207/Epam
 // Constructor
 public PBXPort(PhoneNumberStruct number)
 {
     PhoneNumber = number;
     _state = PortState.Available;
 }