Example #1
0
        public GetLookUpsDataResponse GetLookUpsByType(GetLookUpsDataRequest request)
        {
            GetLookUpsDataResponse response = new GetLookUpsDataResponse();
            ILookUpRepository      repo     = Factory.GetRepository(request, RepositoryType.LookUp);
            List <IdNamePair>      data     = repo.GetLookps(request.Name);

            if (data != null)
            {
                response.LookUpsData = data;
            }
            return(response);
        }
Example #2
0
        public void GetLookUpByType_Test()
        {
            // Arrange
            double      version        = 1.0;
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            IRestClient client         = new JsonServiceClient();

            JsonServiceClient.HttpWebRequestFilter = x =>
                                                     x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "531f2df9072ef727c4d2a3df"));

            // Act
            GetLookUpsDataResponse response = client.Get <GetLookUpsDataResponse>
                                                  (string.Format("{0}/{1}/{2}/{3}/{4}",
                                                                 "http://localhost:8888/LookUp/", context, version, contractNumber, "FocusArea"));

            // Assert
            Assert.AreNotEqual(0, response.LookUpsData.Count);
        }
Example #3
0
        public void GetLookUpsByType_Test()
        {
            // Arrange
            double version                = 1.0;
            string contractNumber         = "InHealth001";
            string context                = "NG";
            GetLookUpsDataRequest request = new GetLookUpsDataRequest {
                Context = context, ContractNumber = contractNumber, Version = version, Name = "reaction"
            };

            // Act
            LookUpDataManager lm = new LookUpDataManager {
                Factory = new LookUpRepositoryFactory()
            };
            GetLookUpsDataResponse response = lm.GetLookUpsByType(request);

            // Assert
            Assert.IsTrue(response.LookUpsData.Count > 0);
        }
Example #4
0
        public GetLookUpsDataResponse Get(GetLookUpsDataRequest request)
        {
            GetLookUpsDataResponse response = new GetLookUpsDataResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("LookUpDD:Get()::Unauthorized Access");
                }

                response         = LookUpDataManager.GetLookUpsByType(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Common.Helper.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }