public void Activate()
        {
            // Receive an access code
            string accessCode = null;

            if (!telephoneDevice.GetAccessCode(ref accessCode))
            {
                return;
            }
            //Here I need to validate the existance of the access codes. So I need to figure out the lamda expressions.
            if (apartment.checkAccessCode(accessCode, out currUser))
            {
                // Recieve a telephone number
                string areaCode = null;
                string exchange = null;
                string number   = null;
                if (!telephoneDevice.GetTelephoneNumber(ref areaCode, ref exchange, ref number))
                {
                    return;
                }
                string phoneNumber = areaCode + exchange + number;
                if (!currUser.CheckBarred(phoneNumber, areaCode))
                {
                    Call currentCall = currUser.addCall(phoneNumber, areaCode);
                    // Connect the phone
                    telephoneDevice.ConnectPhone();
                    // User has terminated the call
                    currentCall.Disconnected();
                }
            }
        }
Exemplo n.º 2
0
        public void Activate()
        {
            // Receive an access code
            string accessCode = null;

            if (!telephoneDevice.GetAccessCode(ref accessCode))
            {
                return;
            }


            // Recieve a telephone number
            string areaCode = null;
            string exchange = null;
            string number   = null;

            if (!telephoneDevice.GetTelephoneNumber(ref areaCode, ref exchange, ref number))
            {
                return;
            }


            // Connect the phone
            telephoneDevice.ConnectPhone();
            // User has terminated the call
        }
Exemplo n.º 3
0
        public void Activate()
        {
            tenants = Manager.ObtainList();
            // Receive an access code
            string accessCode = null;

            if (!telephoneDevice.GetAccessCode(ref accessCode))
            {
                return;
            }
            if (tenants == null)
            {
                return;
            }
            tenant = tenants.Find(x => x.AccessCode == accessCode);
            if (tenant == null)
            {
                return;
            }


            // Recieve a telephone number
            string areaCode = null;
            string exchange = null;
            string number   = null;

            if (!telephoneDevice.GetTelephoneNumber(ref areaCode, ref exchange, ref number))
            {
                return;
            }
            if (tenants.Any(x => x.VerifyBarNumber(areaCode, exchange, number)))
            {
                return;
            }

            startCall = DateTime.Now;
            // Connect the phone
            telephoneDevice.ConnectPhone();
            // User has terminated the call
            endCall = DateTime.Now;

            tenant.AddCall(areaCode, exchange, number, startCall, endCall);
        }
        public void Activate()
        {
            // Receive an access code
            _tenants = _term._tenants;
            string accessCode = null;

            if (!telephoneDevice.GetAccessCode(ref accessCode))
            {
                return;
            }
            foreach (Tenant t in _tenants)
            {
                if (t._accessCode.Equals(accessCode))
                {
                    _tenant = t;
                    // Recieve a telephone number
                    string areaCode = null;
                    string exchange = null;
                    string number   = null;
                    if (!telephoneDevice.GetTelephoneNumber(ref areaCode, ref exchange, ref number))
                    {
                        return;
                    }
                    if (_tenant.checkBar(areaCode, exchange, number) == false)
                    {
                        DateTime beginCall = DateTime.Now;
                        // Connect the phone
                        telephoneDevice.ConnectPhone();
                        // User has terminated the call
                        DateTime endCall = DateTime.Now;
                        Calls    call    = new Calls(areaCode, exchange, number, beginCall, endCall);
                        _tenant.addCall(call);
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
        public void Activate()
        {
            // Receive an access code
            string accessCode = null;

            if (!telephoneDevice.GetAccessCode(ref accessCode))
            {
                return;
            }
            if (TenantData.FindTenantByAC(accessCode, ref currentTenant))
            {
                // Receive a telephone number
                string areaCode = null;
                string exchange = null;
                string number   = null;
                if (!telephoneDevice.GetTelephoneNumber(ref areaCode, ref exchange, ref number))
                {
                    return;
                }
                StringBuilder sb = new StringBuilder();
                sb.Append(areaCode);
                sb.Append("-");
                sb.Append(exchange);
                sb.Append("-");
                sb.Append(number);
                if (!currentTenant.barredList.checkIfBarred(areaCode) && !currentTenant.barredList.checkIfBarred(sb.ToString()))
                {
                    DateTime date = DateTime.Now;
                    currentTenant.callData.StartCall(areaCode, exchange, number, date.ToString());
                    // Connect the phone
                    telephoneDevice.ConnectPhone();
                    // User has terminated the call
                    DateTime localDate = DateTime.Now;
                    currentTenant.callData.EndCall(localDate.ToString());
                }
            }
        }
Exemplo n.º 6
0
 public void Connect()
 {
     telephoneDevice.ConnectPhone();
 }