示例#1
0
 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
 // 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
 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;
 }