Ejemplo n.º 1
0
        public static IEnumerable <string> GetListOfAvailableIccids(this IExternalCellularService cellularService, List <dynamic> devices)
        {
            var fullIccidList = cellularService.GetTerminals().Select(i => i.Id);
            var usedIccidList = GetUsedIccidList(devices).Select(i => i.Id);

            return(fullIccidList.Except(usedIccidList));
        }
Ejemplo n.º 2
0
        public IEnumerable <string> GetListOfAvailableIccids(IList <DeviceModel> devices, string providerName)
        {
            var fullIccidList = providerName == ApiRegistrationProviderTypes.Ericsson ?
                                _iccidRepository.GetIccids().Select(e => e.Id) :
                                _cellularService.GetTerminals().Select(i => i.Id);

            var usedIccidList = GetUsedIccidList(devices).Select(i => i.Id);

            return(fullIccidList.Except(usedIccidList));
        }
Ejemplo n.º 3
0
        public bool SaveRegistration(ApiRegistrationModel apiModel)
        {
            _apiRegistrationRepository.AmendRegistration(apiModel);

            //use a simple call to verify creds
            try
            {
                _cellularService.GetTerminals();
            }
            catch (CellularConnectivityException exception)
            {
                //API does not give error code for the remote name.
                if (exception.Message.Contains(Strings.RemoteNameNotResolved) ||
                    exception.Message == Strings.CellularInvalidCreds)
                {
                    _apiRegistrationRepository.DeleteApiDetails();
                    return(false);
                }

                //the user may have valid creds but no devices. Which throws exception from API this is ok.
            }
            return(true);
        }