public BillingandServiceAccountDto RetrieveCustomerAccountSummary(string usi, HeaderArgs headerArgs)
        {
            BillingandServiceAccountDto billingAndServiceAccounts = null;
            try
            {
                var esbRequest = CreateRequest(usi, headerArgs);
                var esbResponse = _customerInformationInquiry.retrieveCustomerAccountSummary(esbRequest);
                billingAndServiceAccounts = MapResponse(esbResponse);

            }
            catch (System.Exception e)
            {
                var isServiceException = _enterpriseExceptionHandler.HandleGeneralServiceExceptions(e);

                if (!isServiceException)
                {
                    if (_errorLoggingService != null)
                    {
                        _errorLoggingService.LogErrorNoContext(e);
                    }
                    throw;
                }
            }
            return billingAndServiceAccounts;
        }
        /// <summary>
        /// Inspect reply from Roz
        /// </summary>
        /// <param name="reply"></param>
        /// <param name="correlationState"></param>
        void IClientMessageInspector.AfterReceiveReply(ref Message reply, object correlationState)
        {
            try
            {
                if (HttpContext.Current == null
                        || HttpContext.Current.Session == null
                            || HttpContext.Current.Session["LocationsToSync"] == null
                                || HttpContext.Current.Session["Subscriber"] == null
                                    || HttpContext.Current.Session["CurrentUser"] == null) return;

                var locationsToSync = HttpContext.Current.Session["LocationsToSync"] as List<Tuple<string, string, string>>;
                if (locationsToSync == null || locationsToSync.Count == 0) return;
                var currentSub = HttpContext.Current.Session["Subscriber"] as dynamic;
                var currentUser = HttpContext.Current.Session["CurrentUser"] as dynamic;
                var monitoringUsernames = HttpContext.Current.Application["MonitoringUsernames"] as List<string>;

                //If the user requesting the update is a user identified in the config as a monitoring users then skip syncplant
                if (currentUser != null
                        && monitoringUsernames != null
                            && monitoringUsernames.Any()
                                && monitoringUsernames.Any(mu => mu.Equals(currentUser.UniqueId, StringComparison.OrdinalIgnoreCase))) return;

                var esbHeaderArgs = new HeaderArgs(string.Empty, null, string.Empty, string.Empty, string.Empty, "system");

                if (null != currentSub && null != currentUser)
                {
                    esbHeaderArgs.CorpId = currentUser.UniqueId;
                    esbHeaderArgs.CrisId = null;
                    esbHeaderArgs.Name = currentUser.UniqueId;
                    esbHeaderArgs.Email = currentUser.UserEntity.Email;
                    esbHeaderArgs.Role = "system";
                }
                var buffer = reply.CreateBufferedCopy(Int32.MaxValue);
                var copy = buffer.CreateMessage();
                reply = buffer.CreateMessage();
                if (!copy.IsEmpty && !copy.IsFault && locationsToSync.Count > 0)
                {
                    if (ReadRosettianResponse(copy))
                    {
                        Task.Factory.StartNew(() => SyncPlantData(locationsToSync, esbHeaderArgs));
                    }
                }
                HttpContext.Current.Session["LocationsToSync"] = new List<Tuple<string, string, string>>();
            }
            catch (Exception e)
            {
                if (e is AggregateException)
                {
                    var aggregateException = e as AggregateException;
                    foreach (var innerException in aggregateException.InnerExceptions)
                    {
                        _errorLoggingService.LogErrorNoContext(innerException);
                    }
                }
                else
                {
                    _errorLoggingService.LogErrorNoContext(e);
                }
            }
        }
        /// <summary>
        /// Sync Plant Data.
        /// </summary>
        /// <param name="locationId">The locationId.</param>
        /// <param name="headerArgs"></param>
        /// <returns></returns>
        public bool SyncPlantData(string locationId, HeaderArgs headerArgs)
        {
            try
            {
                var response = new syncResourceResponse();

                if (string.IsNullOrWhiteSpace(locationId))
                {
                    throw new EnterpriseServiceException("LocationId cannot be null or empty or whitespace");
                }

                var esbRequest = CreateSyncPlantRequest(locationId, headerArgs);

                using (var client = new ResourceInformationInquiryClient())
                {
                     response = client.syncResource(esbRequest.syncResource);
                }

                if (response == null
                       || response.syncResourceOutput == null
                           || response.syncResourceOutput.Payload == null
                                 || response.syncResourceOutput.Payload.BusinessInteraction == null)
                {
                    throw new EnterpriseServiceException("No response received from ESB");
                }

                bool status;
                var responseStatus =
                    response.syncResourceOutput.Payload.BusinessInteraction.interactionStatus;

                if (bool.TryParse(responseStatus, out status))
                {
                    return status;
                }

                throw new EnterpriseServiceException("Invalid status received from ESB");
            }
            catch (System.Exception e)
            {
                if (_errorLoggingService != null)
                {
                    _errorLoggingService.LogErrorNoContext(e);
                }

                var isServiceException = _enterpriseExceptionHandler.HandleGeneralServiceExceptions(e);

                if (isServiceException)
                {
                    var myException = new System.Exception(Constants.IsServiceExceptionUpperCase, e);
                    throw myException;
                }

                throw;
            }
        }
 /// <summary>
 /// Gets the billing account and service account information.
 /// </summary>
 /// <param name="usi">The usi.</param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public BillingandServiceAccountDto GetBillingServiceAccounts(string usi, HeaderArgs headerArgs)
 {
     var billingAndServiceAccounts = new BillingandServiceAccountDto();
     var request = new LoadSubServiceRequest {USI = usi};
     var esbAccounts = LoadSubscriberServices(request);
     var esbServiceAccounts = (esbAccounts.ServiceAccounts.Any())
         ? esbAccounts.ServiceAccounts
         : new List<ServiceAccount>();
     billingAndServiceAccounts.ServiceAccounts = TypeAdapter.Adapt<List<ServiceAccount>, List<ServiceAccountDto>>(esbServiceAccounts);
     billingAndServiceAccounts.CustomerAccount =  GetAccountInfo(usi, headerArgs);
     return billingAndServiceAccounts;
 }
        /// <summary>
        /// Activates the service order.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="headerArgs"></param>
        /// <returns></returns>
        public ActivateServiceOrderResponseDto ActivateServiceOrder(ActivateServiceOrderRequestDto request, HeaderArgs headerArgs)
        {
            Random random = new Random();
            if (random.Next(0, 1) == 0)
            {
                return new ActivateServiceOrderResponseDto
                {
                    Status = true
                };
            }

            return new ActivateServiceOrderResponseDto
            {
                Status = false
            };
        }
Beispiel #6
0
    public void Add(
        int number,
        [InterpolatedStringHandlerArgument("")]
        ref IPropertyList.InterpolatedStringHandler handler)
    {
        if (number == 0)
        {
            return;
        }

        var chars = _arrayToReturnToPool.AsSpan(0, _pos);

        if (Header == 0)
        {
            Header     = number;
            HeaderArgs = chars.ToString();
            HeaderArgs.GetHashCode(StringComparison.Ordinal);
        }

        AddHash(number);
        if (chars.Length > 0)
        {
            AddHash(string.GetHashCode(chars, StringComparison.Ordinal));
        }

        int strLength = chars.Length * 2;
        int length    = _bufferPos + 6 + strLength;

        while (length > _buffer.Length)
        {
            Flush();
        }

        var writer = new SpanWriter(_buffer.AsSpan(_bufferPos));

        writer.Write(number);
        writer.Write((ushort)strLength);
        writer.Write(chars, TextEncoding.UnicodeLE);

        _bufferPos += writer.BytesWritten;
    }
        public GetFacilitiesResponseDto RetrieveFacilitiesDesign(GetFacilitiesRequestDto request, HeaderArgs headerArgs)
        {
            GetFacilitiesResponseDto facilitiesDesign = null;
            try
            {
                var esbRequest = _getFacilitiesMappers.CreateGetFacilitiesRequest(request, headerArgs);
                var esbResponse = _rsdClient.invoke(esbRequest);
                facilitiesDesign = _getFacilitiesMappers.MapGetFacilitiesResponse(esbResponse);
            }
            catch (System.Exception e)
            {
                var isServiceException = _enterpriseExceptionHandler.HandleGeneralServiceExceptions(e);

                if (!isServiceException)
                {
                    if (_errorLoggingService != null)
                    {
                        _errorLoggingService.LogErrorNoContext(e);
                    }
                    throw;
                }
            }
            return facilitiesDesign;
        }
        public GetFacilitiesResponseDto RetrieveFacilitiesDesign(GetFacilitiesRequestDto request, HeaderArgs headerArgs)
        {
            GetFacilitiesResponseDto facilitiesConfiguration = null;
            try
            {
                var esbRequest = CreateRequest(request, headerArgs);
                var esbResponse = _serviceDesignInquiry.retrieveServiceDesign(esbRequest);
                facilitiesConfiguration = MapResponse(esbResponse);
            }
            catch (System.Exception e)
            {
                var isServiceException = _enterpriseExceptionHandler.HandleGeneralServiceExceptions(e);

                if (!isServiceException)
                {
                    if (_errorLoggingService != null)
                    {
                        _errorLoggingService.LogErrorNoContext(e);
                    }
                    throw;
                }
            }
            return facilitiesConfiguration;
        }
        public string RetrieveServiceConfiguration(string emailAddress4IpRequest, HeaderArgs headerArgs)
        {
            string serviceConfiguration = string.Empty;
            try
            {
                var esbRequest = CreateRequest(emailAddress4IpRequest, headerArgs);
                var esbResponse = _consolidatedClient.retrieveCustomerServiceConfiguration(esbRequest);
                serviceConfiguration = MapResponse(esbResponse);
            }
            catch (System.Exception e)
            {
                var isServiceException = _enterpriseExceptionHandler.HandleGeneralServiceExceptions(e);

                if (!isServiceException)
                {
                    if (_errorLoggingService != null)
                    {
                        _errorLoggingService.LogErrorNoContext(e);
                    }
                    throw;
                }
            }
            return serviceConfiguration;
        }
 // ToDo: Jim Fisher Added on May 19 2014 #Backlog:8265 is tracking whether or not we need unit or integration tests
 public GetFacilitiesResponseDto GetFacilitiesData(GetFacilitiesRequestDto request, HeaderArgs headerArgs)
 {
     var enterpriseRequest = TypeAdapter.Adapt<GetFacilitiesRequestDto, GetFacilitiesRequest>(request);
     var facilitiesResponse = base.GetFacilities(enterpriseRequest);
     return TypeAdapter.Adapt<GetFacilitiesResponse, GetFacilitiesResponseDto>(facilitiesResponse);
 }
Beispiel #11
0
        /// <summary>
        /// Create the ESB Request method for ActivateService Order using WPS endpoints.
        /// </summary>
        /// <param name="request">Contains Subscriber Telephone Number to Activate</param>
        /// <param name="headerArgs">Contains User Info</param>
        /// <returns></returns>
        private static UpdateLineNumberPortabilityRequest CreateWpsActivateServiceOrderRequest(ActivateServiceOrderRequestDto request, HeaderArgs headerArgs)
        {
            try
            {
                var _executionContext = new ExecutionContext();
                if (request.ExecutionContext == null)
                {
                    var consumerInfo = new ConsumerInfo();
                    consumerInfo.ApplicationID = ApplicationIDEnum.SIMPL;
                    consumerInfo.EmployeeID = headerArgs.CrisId;
                    consumerInfo.UserID = headerArgs.CorpId ?? String.Empty;

                    var esbHeader = new ESBHeader();
                    esbHeader.ConsumerInfo = consumerInfo;
                    _executionContext.ESBHeader = esbHeader;
                    _executionContext.ESBHeader.ConsumerInfo.ApplicationID = ApplicationIDEnum.SIMPL;
                    _executionContext.ESBHeader.ConsumerInfo.EmployeeID = headerArgs.CrisId;
                    _executionContext.ESBHeader.ConsumerInfo.UserID = headerArgs.CorpId ?? String.Empty;
                }
                else
                {
                    _executionContext.ESBHeader.ConsumerInfo.ApplicationID = ApplicationIDEnum.SIMPL;
                    _executionContext.ESBHeader.ConsumerInfo.EmployeeID =
                        request.ExecutionContext.EsbHeader.ConsumerInfo.EmployeeID;
                    _executionContext.ESBHeader.ConsumerInfo.UserID =
                        request.ExecutionContext.EsbHeader.ConsumerInfo.UserID ?? String.Empty;
                }

                var _requestCriteria = new NumberRegistrationRequest();
                _requestCriteria.Action = NumberRegistrationActionEnum.Activate;
                _requestCriteria.RequestDateTimeSpecified = true;
                _requestCriteria.RequestDateTime = DateTime.Now;
                _requestCriteria.PortedTelephoneNumber = new TelephoneNumber();
                _requestCriteria.PortedTelephoneNumber.Item = request.TN;
                _requestCriteria.PortAction = PortActionEnum.SOAOnlyPortIn;

                var _request = new UpdateLineNumberPortabilityRequest();
                _request.ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest =
                    new ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest();
                _request.ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest.ExecutionContext =
                    _executionContext;
                _request.ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest.RequestCriteria = _requestCriteria;

                return _request;
            }
            catch (System.Exception ex)
            {
                var myException = new System.Exception("Error Creating ActivateServiceOrderRequest", ex);
                throw myException;
            }
        }
 /// <summary>
 /// Calls ESB to generate a unique passcode
 /// </summary>
 /// <returns></returns>
 public string GeneratePasscode(string phoneNumber, HeaderArgs headerArgs)
 {
     return "445356";
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="billingOrderNumber"></param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public bool DetermineIfOrderExists(string billingOrderNumber, HeaderArgs headerArgs)
 {
     return true;
 }
        private void SyncPlantData(IEnumerable<Tuple<string, string, string>> locations, HeaderArgs headerArgs)
        {
            if (!Convert.ToBoolean(ConfigurationManager.AppSettings["SyncPlantEnabled"])) return;

            //Only submit a distinct list on non inventory locations
            var myRegex = new Regex(@"[a-zA-Z]");

            locations = locations.Where(x => !myRegex.IsMatch(x.Item1)).Distinct();

            // In the tuple, Item1 is LocationId, Item2 is State and Item3 is DpiRegion.
            foreach (var location in locations)
            {
                try
                {
                    if (string.IsNullOrWhiteSpace(location.Item3))
                    {
                        throw new Exception(
                            string.Format(
                                "SyncPlant: DPIRegion for LocationId {0} could not be determined. Syncplant was not called",
                                location.Item1));
                    }
                    headerArgs.DpiRegion = location.Item3;
                    _syncPlant.SyncPlantData(location.Item1, headerArgs);
                }
                catch (Exception ex)
                {
                    var exception =
                        new Exception(string.Format("{0} - Update for Location Failed", location.Item1), ex);
                    _errorLoggingService.LogErrorNoContext(exception);
                }
            }
        }
        public bool ScheduleServiceDiagnosticTest(string lineTestId, string phoneNumber, HeaderArgs headerArgs)
        {
            Header header = null;
            Service[] service = null;
            scheduleServiceDiagnosticTestRequest esbRequest = null;

            try
            {
                // construct header
                header = new Header
                {
                    Source = "SIMPL",
                    Security_T = new CharacteristicSpecification[2],
                    ConsumerInfo = new CharacteristicSpecification[4],
                    Timestamp = DateTime.Now,
                    MessageId = lineTestId,
                    CorrelationId_T = phoneNumber
                };

                header.Security_T[0] = new CharacteristicSpecification
                {
                    name = "employeeID",
                    Value = new CharacteristicValue
                    {
                        value = headerArgs.CrisId
                    }
                };

                header.Security_T[1] = new CharacteristicSpecification
                {
                    name = "userID",
                    Value = new CharacteristicValue
                    {
                        value = headerArgs.CorpId ?? string.Empty
                    }
                };

                header.ConsumerInfo[0] = new CharacteristicSpecification
                {
                    name = "DPIEnvironment",
                    Value = new CharacteristicValue
                    {
                        value = headerArgs.DpiRegion ?? string.Empty
                    }
                };

                header.ConsumerInfo[1] = new CharacteristicSpecification
                {
                    name = "name",
                    Value = new CharacteristicValue
                    {
                        value = headerArgs.Name ?? string.Empty
                    }
                };

                header.ConsumerInfo[2] = new CharacteristicSpecification
                {
                    name = "email",
                    Value = new CharacteristicValue
                    {
                        value = headerArgs.Email ?? string.Empty
                    }
                };

                header.ConsumerInfo[3] = new CharacteristicSpecification
                {
                    name = "role",
                    Value = new CharacteristicValue
                    {
                        value = headerArgs.Role ?? string.Empty
                    }
                };

                header.CorrelationId_T = string.Format("phoneNbr={0}", phoneNumber);

                // construct payload
                service = new Service[1];
                service[0] = new Service
                {
                    ServiceIdentification = new IBMTelecomRootObject
                    {
                        ID = phoneNumber
                    },
                    hasStarted = false,
                    ServiceLocation = new Place
                    {
                        GeographicAddress = new GeographicAddress
                        {
                            GeographicAddressExtension = new GeographicAddressExtension
                            {
                                isInFootprint = false
                            }
                        }
                    },
                    ServiceDescribedBy = new[]
                    {
                        new CharacteristicSpecification
                        {
                            name = "testType",
                            Value = new CharacteristicValue
                            {
                                value = "DSLDIG"
                            }
                        }
                    }
                };

                esbRequest = new scheduleServiceDiagnosticTestRequest
                {
                    scheduleServiceDiagnosticTest = new scheduleServiceDiagnosticTest
                    {
                        scheduleServiceDiagnosticTestInput = new msg_Service
                        {
                            Header = header,
                            Payload = service
                        }
                    }

                };
            }
            catch (System.Exception ex)
            {
                if (_errorLoggingService != null)
                {
                    _errorLoggingService.LogErrorNoContext(ex);
                }
                var myException = new System.Exception("Error getting data for line test", ex);
                throw myException;
            }

            try
            {
                _lineTestClient.scheduleServiceDiagnosticTest(esbRequest);
            }
            catch (System.Exception e)
            {
                var isServiceException = _enterpriseExceptionHandler.HandleGeneralServiceExceptions(e);

                if ((isServiceException) && (_errorLoggingService != null))
                {
                    _errorLoggingService.LogErrorNoContext(e);
                }

                return false;
            }

            return true;
        }
Beispiel #16
0
        /// <summary>
        /// Loads the composite subscriber.
        /// </summary>
        /// <param name="usi">The usi.</param>
        /// <param name="dpiRegion"></param>
        /// <param name="userDto">The user dto.</param>
        /// <returns></returns>
        public CompositeSubscriber LoadCompositeSubscriber(string usi, string dpiRegion, UserDto userDto)
        {
            var compositeSubscriber = new CompositeSubscriber();
            var rosettianResults = new SubscriberDto();
            var provisionedPhonesResults = new List<PhoneDto>();
            BillingandServiceAccountDto esbResults;
            var esbResultsEnterpriseServiceExceptionFound = false;
            var headerArgs = new HeaderArgs(dpiRegion, userDto.Name, String.Empty, userDto.Name, userDto.Email, userDto.Role);
            Task<SubscriberDto> rosettianResponse = null;
            Task<BillingandServiceAccountDto> esbGetAccountResponse = null;
            Task<List<PhoneDto>> provisioningSubPhonesReponse = null;

            try
            {
                rosettianResponse = Task.Factory.StartNew(() => _rosettianService.LoadSubscriber(usi, userDto));
                esbGetAccountResponse = Task.Factory.StartNew(() => _enterpriseService.GetBillingServiceAccounts(usi, headerArgs));
                provisioningSubPhonesReponse = Task.Factory.StartNew(() => _rosettianService.LoadSubscriberPhones(usi, userDto));
                Task.WaitAll(rosettianResponse, esbGetAccountResponse, provisioningSubPhonesReponse);

            }
            catch (AggregateException ae)
            {
                foreach (var e in ae.InnerExceptions)
                {
                    var handled = false;
                    var isFaultException = (e is FaultException<ValidationFaultDto>);
                    var isServiceError = (e is MessageSecurityException || e is ServerTooBusyException || e is CommunicationException || e is TimeoutException);

                    // Note: if you reverse the order below, VS2013 warns you that isFaultException is always false.
                    if ((isFaultException) || (isServiceError))
                    {
                        // Throw exception if LoadSubscriber and not LoadSubscriberPhones
                        if ((e.StackTrace.Contains("LoadSubscriber")) && (!(e.StackTrace.Contains("LoadSubscriberPhones"))))
                        {
                            var myException = new Exception("Error retrieving Provisioning information for subscriber from Triad, unable to proceed.", e);
                            _errorLoggingService.LogErrorNoContext(myException);
                            throw myException;
                        }

                        // Do not throw exception if LoadSubscriberPhones
                        if (e.StackTrace.Contains("LoadSubscriberPhones"))
                        {
                            var myException = new Exception("Error retrieving Provisioning information for subscriber's phones from Triad, preceeding with loading the subscriber.", e);
                            _errorLoggingService.LogErrorNoContext(myException);
                            handled = true;
                        }
                    }

                    if (!handled)
                    {
                        const string baseErrorMessage = "Error retrieving DPI information for subscriber";
                        if (e is EnterpriseServiceException)
                        {
                            esbResultsEnterpriseServiceExceptionFound = true;
                            var myException = new Exception(String.Format("{0}, as error is an EnterpriseServiceException we are going to proceed", baseErrorMessage));
                            _errorLoggingService.LogErrorNoContext(myException);
                            handled = true;
                        }
                        else if (!isFaultException)
                        {
                            var myException = new Exception(String.Format("{0}, unable to proceed.", baseErrorMessage), e);
                            _errorLoggingService.LogErrorNoContext(myException);
                            throw myException;
                        }
                    }

                    if (!handled)
                    {
                        var myException = new Exception("Unknown error condition retrieving either Provisioning or DPI information for subscriber, unable to proceed.", e);
                        _errorLoggingService.LogErrorNoContext(myException);
                        throw myException;
                    }
                }
            }
            catch (Exception e)
            {
                var myException = new Exception("Unknown error condition retrieving either Provisioning or DPI information for subscriber, unable to proceed.", e);
                _errorLoggingService.LogErrorNoContext(myException);
                throw myException;
            }

            rosettianResults = ((rosettianResponse != null) && (!rosettianResponse.IsFaulted)) ? rosettianResponse.Result : null;
            provisionedPhonesResults = ((provisioningSubPhonesReponse != null) && (!provisioningSubPhonesReponse.IsFaulted)) ? provisioningSubPhonesReponse.Result : null;
            esbResults = ((esbGetAccountResponse != null) && (!esbGetAccountResponse.IsFaulted)) ? esbGetAccountResponse.Result : null;
            compositeSubscriber = FacadeExtensions.Merge(rosettianResults, esbResults, provisionedPhonesResults);
            compositeSubscriber.BillingRegion = dpiRegion;
            compositeSubscriber.ProvisionedUsi = usi;
            // User Story 11766 and Bug 11769 - Adding a new error message for the case where ESB errors out or times out and we don't get any response
            if ((esbResults == null) && (!esbResultsEnterpriseServiceExceptionFound))
            {
                compositeSubscriber.SubscriberErrorMessages = "DPI data request timed out";
            }

            return compositeSubscriber;
        }
 /// <summary>
 /// Retrieve Ip Address assignments
 /// </summary>
 /// <param name="emailAddress"></param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public string GetStaticIpAddressAssignment(string emailAddress, HeaderArgs headerArgs)
 {
     return "50.125.115.12/26";
 }
        private retrieveServiceDesignRequest CreateRequest(GetFacilitiesRequestDto request, HeaderArgs headerArgs)
        {
            //Null checked in caller
            var usi = request.USI;

            #region construct header
            var header = new Header
            {
                Source = "SIMPL",
                Security_T = new CharacteristicSpecification[2],
                ConsumerInfo = new CharacteristicSpecification[4]
            };

            header.Security_T[0] = new CharacteristicSpecification
            {
                name = "employeeID",
                Value = new CharacteristicValue
                {
                    value = headerArgs.CrisId
                }
            };

            header.Security_T[1] = new CharacteristicSpecification
            {
                name = "userID",
                Value = new CharacteristicValue
                {
                    value = headerArgs.CorpId ?? string.Empty
                }
            };

            header.ConsumerInfo[0] = new CharacteristicSpecification
            {
                name = "DPIEnvironment",
                Value = new CharacteristicValue
                {
                    value = headerArgs.DpiRegion ?? string.Empty
                }
            };

            header.ConsumerInfo[1] = new CharacteristicSpecification
            {
                name = "name",
                Value = new CharacteristicValue
                {
                    value = headerArgs.Name ?? string.Empty
                }
            };

            header.ConsumerInfo[2] = new CharacteristicSpecification
            {
                name = "email",
                Value = new CharacteristicValue
                {
                    value = headerArgs.Email ?? string.Empty
                }
            };

            header.ConsumerInfo[3] = new CharacteristicSpecification
            {
                name = "role",
                Value = new CharacteristicValue
                {
                    value = headerArgs.Role ?? string.Empty
                }
            };

            #endregion

            #region construct payload
            var searchCharacteristic = new CharacteristicSpecification[1];

            searchCharacteristic[0] = new CharacteristicSpecification
            {
                name = "uniqueServiceIdentifier",
                Value = new CharacteristicValue { value = usi }
            };

            var searchCriteria = new Entity[1];

            searchCriteria[0] = new Entity
            {
                type = "accountId",
                Characteristics = searchCharacteristic
            };

            var payload = new LookupRequest
            {
                SearchCriteria = searchCriteria
            };
            #endregion

            var esbRequest = new retrieveServiceDesignRequest
            {
                retrieveServiceDesign = new retrieveServiceDesign
                {
                    retrieveServiceDesignInput = new msg_LookupRequest
                    {
                        Header = header,
                        Payload = payload
                    }
                }
            };

            return esbRequest;
        }
 /// <summary>
 /// Gets the plant remarks.
 /// </summary>
 /// <param name="requestDto"></param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public List<PlantRemarkDto> GetPlantRemarks(GetPlantRemarksRequestDto requestDto, HeaderArgs headerArgs)
 {
     var request = TypeAdapter.Adapt<GetPlantRemarksRequestDto, GetPlantRemarksRequest>(requestDto);
     var esbRemarks = base.GetPlantRemarks(request);
     return TypeAdapter.Adapt<List<PlantRemark>,List<PlantRemarkDto>>(esbRemarks);
 }
 /// <summary>
 /// Gets status of SOA Activation for TN
 /// </summary>
 /// <param name="request">contains TN</param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public LineNumberPortabilityStatusDto GetLineNumberPortabilityStatus(ActivateServiceOrderRequestDto request,
     HeaderArgs headerArgs)
 {
     return new LineNumberPortabilityStatusDto()
     {
         StatusCode = "FakeStatusCode",
         StatusSource = "FakeStatusSource",
         Message = "FakeMessage"
     };
 }
Beispiel #21
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="headerArgs"></param>
        /// <returns></returns>
        public ActivateServiceOrderResponseDto ActivateServiceOrder(ActivateServiceOrderRequestDto request, HeaderArgs headerArgs)
        {
            if (string.IsNullOrWhiteSpace(request.TN)) throw new ArgumentNullException(request.TN);

            var getActivateServiceOrderResponse = new ActivateServiceOrderResponseDto()
            {
                Status = false
            };

            try
            {
                if (Boolean.Parse(ConfigurationManager.AppSettings["NewPerformSOAEnabled"]))
                {
                    var esbRequest = CreateWpsActivateServiceOrderRequest(request, headerArgs);
                    var client = new ManageTelephoneNumberRegistrationClient();
                    var esbResponse = client.UpdateLineNumberPortability(esbRequest.ManageTelephoneNumberRegistrationUpdateLineNumberPortabilityRequest);

                    // Handle any unsuccessful conditions
                    if (esbResponse.ExecutionContext.ExecutionStatus.ExecutionStatusSuccessFlag == false)
                    {
                        var messages = esbResponse.ExecutionContext.ExecutionStatus.ExecutionStatusMessage;
                        var errorMessage = String.Empty;
                        var sb = new StringBuilder();

                        for (int i = 0; i < messages.Length; i++)
                        {
                            sb.AppendLine(String.Format("Error {0}:: Severity: {1}, Code: {2}, Message: {3}",
                                i + 1,
                                messages[i].ExecutionStatusSeverity.ToString(),
                                messages[i].ExecutionStatusCode,
                                messages[i].ExecutionStatusDescription));
                        }

                        if (sb.ToString().Length > 0)
                        {
                            errorMessage =
                                String.Concat(
                                    String.Format(
                                        "The activation process for TN # {0} has failed with the following errors: \n\n",
                                        request.TN), sb.ToString());
                        }
                        else
                        {
                            errorMessage = String.Format(
                                "The activation process for TN # {0} has failed for unknown reasons.",
                                request.TN);
                        }

                        throw new EnterpriseServiceException(errorMessage);
                    }
                }
                else
                {
                    var esbRequest = CreateActivateServiceOrderRequest(request, headerArgs);
                    _serviceOrderOrchestration.resumeServiceOrder(esbRequest);
                }

               getActivateServiceOrderResponse.Status = true;
            }
            catch (System.Exception e)
            {
                var isServiceException = _enterpriseExceptionHandler.HandleGeneralServiceExceptions(e);
                if (isServiceException)
                {
                    var myException = new System.Exception(Constants.IsServiceExceptionUpperCase, e);
                    throw myException;
                }

                throw;
            }

            return getActivateServiceOrderResponse;
        }
Beispiel #22
0
 /// <summary>
 /// Activates the service order.
 /// TODO:Logic inside this method will be changed later when we have operation ready in 
 /// either Rosettian or ESB.
 /// </summary>
 /// <param name="tn">The tn.</param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public bool ActivateServiceOrder(string tn, HeaderArgs headerArgs)
 {
     return _enterpriseService.ActivateServiceOrder(new ActivateServiceOrderRequestDto
     {
         TN = tn
     }, headerArgs).Status;
 }
 /// <summary>
 /// Gets the account information.
 /// </summary>
 /// <param name="usi">The usi.</param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 private CustomerAccountDto GetAccountInfo(string usi, HeaderArgs headerArgs)
 {
     var customerAccount = base.GetAccountInfo(usi);
     return TypeAdapter.Adapt<CustomerAccount, CustomerAccountDto>(customerAccount);
 }
Beispiel #24
0
 /// <summary>
 /// Activates the service order.
 /// TODO:Logic inside this method will be changed later when we have operation ready in 
 /// either Rosettian or ESB.
 /// </summary>
 /// <param name="tn">telephone number</param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public LineNumberPortabilityStatusDto GetLineNumberPortabilityStatus(string tn, HeaderArgs headerArgs)
 {
     var request = new ActivateServiceOrderRequestDto()
     {
         TN = tn
     };
     return _enterpriseService.GetLineNumberPortabilityStatus(request, headerArgs);
 }
 /// <summary>
 /// Loads the subscriber services.
 /// </summary>
 /// <param name="request">The request.</param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 private List<ServiceAccountDto> LoadSubscriberServices(LoadSubServiceRequestDto request, HeaderArgs headerArgs)
 {
     var enterpriseRequest = TypeAdapter.Adapt<LoadSubServiceRequestDto, LoadSubServiceRequest>(request);
     var esbAccounts = base.LoadSubscriberServices(enterpriseRequest).ServiceAccounts;
     return TypeAdapter.Adapt<List<ServiceAccount>, List<ServiceAccountDto>>(esbAccounts);
 }
Beispiel #26
0
        public string ResetVoicemailPassword(string subId, string phoneNumber, UserDto user, HeaderArgs headerArgs)
        {
            var passcode = String.Empty;
            try
            {
                if (String.IsNullOrEmpty(phoneNumber) || String.IsNullOrEmpty(subId))
                {
                    throw new BusinessFacadeFaultException(500, "Phone Number or SubscriberId was null or empty");
                }

                passcode = _enterpriseService.GeneratePasscode(phoneNumber, headerArgs);

                int n;
                if (String.IsNullOrWhiteSpace(passcode) || passcode.Length != 6 || !Int32.TryParse(passcode, out n))
                {
                    throw new BusinessFacadeFaultException(500, "Passcode returned from ESB was null or empty");
                }

                var phone = _rosettianService.LoadSubscriberPhones(subId, user).Find(ph => ph.PhoneNumber == phoneNumber);

                if (phone != null && phone.PhoneProvSpec != null)
                {

                    phone.PhoneProvSpec.VoicemailPIN = passcode;
                    if (!_rosettianService.UpdateSubscriberPhone(subId, phone, user)) throw new BusinessFacadeFaultException(500, "Rosettian was unable to update phone object");
                    _rosettianService.PerformPhoneOperation(
                        new List<PhoneOperationDto>
                        {
                            new PhoneOperationDto
                            {
                                PhoneNumber = phone.PhoneNumber,
                                Type = PhoneOperationTypeDto.Refresh
                            }
                        }, user
                    );
                }
                else
                {
                    throw new BusinessFacadeFaultException(500, "Rosettian was unable to find the phonenumber to be updated.");
                }
            }
            catch (Exception ex)
            {
                _errorLoggingService.LogErrorNoContext(ex);

                throw new Exception("Unable to Reset VM Password at current time, please try again.", ex);
            }
            return passcode;
        }
Beispiel #27
0
        private retrieveCustomerAccountOrderDetailsRequest MaptoRetrieveCustomerAccountOrderDetailsRequest(string billingOrderNumber, HeaderArgs headerArgs)
        {
            // construct header
            var header = new CustomerOrderInformation.Header
            {
                Source = "SIMPL",
                Security_T = new CustomerOrderInformation.CharacteristicSpecification[2],
                ConsumerInfo = new CustomerOrderInformation.CharacteristicSpecification[4]
            };

            header.Security_T[0] = new CustomerOrderInformation.CharacteristicSpecification
            {
                name = "employeeID",
                Value = new CustomerOrderInformation.CharacteristicValue
                {
                    value = headerArgs.CrisId
                }
            };

            header.Security_T[1] = new CustomerOrderInformation.CharacteristicSpecification
            {
                name = "userID",
                Value = new CustomerOrderInformation.CharacteristicValue
                {
                    value = headerArgs.CorpId ?? string.Empty
                }
            };

            var request = new CustomerOrderInformation.retrieveCustomerAccountOrderDetailsRequest()
            {
                retrieveCustomerAccountOrderDetails = new retrieveCustomerAccountOrderDetails()
                {
                    retrieveCustomerAccountOrderDetailsInput = new CustomerOrderInformation.msg_LookupRequest()
                    {
                        Header = header,
                        Payload = new CustomerOrderInformation.LookupRequest()
                        {
                            SearchCriteria = new[]
                            {
                                new CustomerOrderInformation.Entity()
                                {
                                    Characteristics = new[]
                                    {
                                        new CustomerOrderInformation.CharacteristicSpecification()
                                        {
                                            name = "environment",
                                            Value = new CustomerOrderInformation.CharacteristicValue()
                                            {
                                                value = headerArgs.DpiRegion
                                            }
                                        },
                                        new CustomerOrderInformation.CharacteristicSpecification()
                                        {
                                            name = "orderId",
                                            Value = new CustomerOrderInformation.CharacteristicValue()
                                            {
                                                value = billingOrderNumber
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };
            return request;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lineTestId"></param>
        /// <param name="phoneNumber"></param>
        /// <param name="headerArgs"></param>
        public bool InitiateLineTest(string lineTestId, string phoneNumber, HeaderArgs headerArgs)
        {
            var securityT = new CharacteristicSpecification[2];
            var service = new ScheduleServiceDiagnosticTest.Service[1];

            securityT[0] = new CharacteristicSpecification
            {
                name = "employeeID",
                Value = new CharacteristicValue { value = headerArgs.CrisId }
            };

            securityT[1] = new CharacteristicSpecification
            {
                name = "userID",
                Value = new CharacteristicValue { value = headerArgs.CorpId }
            };

            service[0] = new ScheduleServiceDiagnosticTest.Service
            {
                ServiceIdentification = new IBMTelecomRootObject
                {
                    ID = lineTestId
                },
                hasStarted = false,
                ServiceLocation = new Place
                {
                    GeographicAddress = new GeographicAddress
                    {
                        GeographicAddressExtension = new GeographicAddressExtension
                        {
                            isInFootprint = false
                        }
                    }
                }
            };

            var esbRequest = new invokeRequest
            {
                scheduleServiceDiagnosticTestInput = new msg_Service
                {
                    Header = new Header
                    {
                        CorrelationId_T = "CORRELID",
                        Source = "SIMPL",
                        MessageId = lineTestId,
                        Security_T = securityT,
                        Timestamp = DateTime.Now
                    },
                    Payload = service
                }

            };

            _lineTestClient.invoke(esbRequest);

            return true;
        }
        private retrieveCustomerAccountSummaryRequest CreateRequest(string usi, HeaderArgs headerArgs)
        {
            // construct header
            var header = new Header
            {
                Source = "SIMPL",
                Security_T = new CharacteristicSpecification[2],
                ConsumerInfo = new CharacteristicSpecification[4]
            };

            header.Security_T[0] = new CharacteristicSpecification
            {
                name = "employeeID",
                Value = new CharacteristicValue
                {
                    value = headerArgs.CrisId
                }
            };

            header.Security_T[1] = new CharacteristicSpecification
            {
                name = "userID",
                Value = new CharacteristicValue
                {
                    value = headerArgs.CorpId ?? string.Empty
                }
            };

            header.ConsumerInfo = new CharacteristicSpecification[4];
            header.ConsumerInfo[0] = new CharacteristicSpecification
            {
                name = "DPIEnvironment",
                Value = new CharacteristicValue
                {
                    value = headerArgs.DpiRegion ?? string.Empty
                }
            };

            header.ConsumerInfo[1] = new CharacteristicSpecification
            {
                name = "name",
                Value = new CharacteristicValue
                {
                    value = headerArgs.Name ?? string.Empty
                }
            };

            header.ConsumerInfo[2] = new CharacteristicSpecification
            {
                name = "email",
                Value = new CharacteristicValue
                {
                    value = headerArgs.Email ?? string.Empty
                }
            };

            header.ConsumerInfo[3] = new CharacteristicSpecification
            {
                name = "role",
                Value = new CharacteristicValue
                {
                    value = headerArgs.Role ?? string.Empty
                }
            };

            // construct payload
            var searchCharacteristic = new CharacteristicSpecification[1];

            searchCharacteristic[0] = new CharacteristicSpecification
            {
                name = "uniqueServiceIdentifier",
                Value = new CharacteristicValue { value = usi }
            };

            var searchCriteria = new Entity[1];

            searchCriteria[0] = new Entity
            {
                type = "accountId",
                Characteristics = searchCharacteristic
            };

            var filterCriteria = new Entity[1];
            var filterCharacteristics = new CharacteristicSpecification[5];
            filterCharacteristics[0] = new CharacteristicSpecification
            {
                name = "retrieveRelatedWTNAccounts",
                Value = new CharacteristicValue { value = "true" }
            };
            filterCharacteristics[1] = new CharacteristicSpecification
            {
                name = "retrieveServiceAddress",
                Value = new CharacteristicValue { value = "true" }
            };
            filterCharacteristics[2] = new CharacteristicSpecification
            {
                name = "retrieveServiceList",
                Value = new CharacteristicValue { value = "true" }
            };

            //TODO: Add paging
            filterCharacteristics[3] = new CharacteristicSpecification
            {
                name = "startIndex",
                Value = new CharacteristicValue { value = "0" }
            };
            filterCharacteristics[4] = new CharacteristicSpecification
            {
                name = "recordCount",
                Value = new CharacteristicValue { value = "10" }
            };

            filterCriteria[0] = new Entity
            {
                type = "accountId",
                Characteristics = filterCharacteristics
            };

            var request = new retrieveCustomerAccountSummaryRequest()
            {
                retrieveCustomerAccountSummary = new retrieveCustomerAccountSummary()
                {
                    retrieveCustomerAccountSummaryInput = new msg_LookupRequest
                    {
                        Header = header,
                        Payload = new LookupRequest
                        {
                            SearchCriteria = searchCriteria,
                            FilterCriteria = filterCriteria
                        }
                    }
                }
            };
            return request;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="locationId"></param>
        /// <param name="headerArgs"></param>
        /// <returns></returns>
        private static invokeRequest CreateSyncPlantRequest(string locationId, HeaderArgs headerArgs)
        {
            // construct header
            var header = new Header
            {
                Source = "SIMPL",
                Security_T = new CharacteristicSpecification[2],
                ConsumerInfo = new CharacteristicSpecification[4]
            };

            header.Security_T[0] = new CharacteristicSpecification
            {
                name = "employeeID",
                Value = new CharacteristicValue
                {
                    value = headerArgs.CrisId
                }
            };

            header.Security_T[1] = new CharacteristicSpecification
            {
                name = "userID",
                Value = new CharacteristicValue
                {
                    value = headerArgs.CorpId ?? string.Empty
                }
            };

            header.ConsumerInfo[0] = new CharacteristicSpecification
            {
                name = "DPIEnvironment",
                Value = new CharacteristicValue
                {
                    value = headerArgs.DpiRegion ?? string.Empty
                }
            };

            header.ConsumerInfo[1] = new CharacteristicSpecification
            {
                name = "name",
                Value = new CharacteristicValue
                {
                    value = headerArgs.Name ?? string.Empty
                }
            };

            header.ConsumerInfo[2] = new CharacteristicSpecification
            {
                name = "email",
                Value = new CharacteristicValue
                {
                    value = headerArgs.Email ?? string.Empty
                }
            };

            header.ConsumerInfo[3] = new CharacteristicSpecification
            {
                name = "role",
                Value = new CharacteristicValue
                {
                    value = headerArgs.Role ?? string.Empty
                }
            };

            // construct payload
            var searchCharacteristic = new CharacteristicSpecification[1];
            searchCharacteristic[0] = new CharacteristicSpecification
            {
                name = "locationId",
                Value = new CharacteristicValue {value = locationId}
            };

            var searchCriteria = new Entity[1];

            searchCriteria[0] = new Entity
            {
                type = "ResourceId",
                Characteristics = searchCharacteristic
            };

            var esbRequest = new invokeRequest
            {
                invoke = new invoke
                {
                    syncResourceInput = new msg_LookupRequest
                    {
                        Header = header,
                        Payload = new LookupRequest
                        {
                            SearchCriteria = searchCriteria
                        }
                    }
                }
            };
            return esbRequest;
        }
 /// <summary>
 /// Sync Plant Data.
 /// </summary>
 /// <param name="locationId">The locaitonId.</param>
 /// <param name="headerArgs"></param>
 /// <returns></returns>
 public bool SyncPlantData(string locationId, HeaderArgs headerArgs)
 {
     return !string.IsNullOrWhiteSpace(locationId);
 }