Exemple #1
0
        internal static List <CustomAttribute> GetAttributesLibraryByType(IAppDomainRequest request, int typeId)
        {
            List <CustomAttribute> attrList = new List <CustomAttribute>();

            try
            {
                IRestClient client = new JsonServiceClient();

                string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Attributes/{4}", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, typeId), request.UserId);

                GetCustomAttributesDataResponse response = client.Get <GetCustomAttributesDataResponse>(url);

                if (response != null && response.CustomAttributes != null)
                {
                    response.CustomAttributes.ForEach(ca =>
                    {
                        attrList.Add(new CustomAttribute
                        {
                            Id = ca.Id, Name = ca.Name, ControlType = ca.ControlType, Order = ca.Order, Options = GoalsUtil.ConvertToOptionList(ca.Options), Required = ca.Required
                        });
                    });
                }
                return(attrList);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:GetAttributesLibraryByType()::" + ex.Message, ex.InnerException);
            }
        }
Exemple #2
0
        public void GeCustomAttributesByType()
        {
            GetCustomAttributesDataRequest request = new GetCustomAttributesDataRequest {
                TypeId = 2
            };

            GetCustomAttributesDataResponse response = m.GetCustomAttributesByType(request);

            Assert.IsNotNull(response.CustomAttributes);
        }
Exemple #3
0
        public GetCustomAttributesDataResponse GetCustomAttributesByType(GetCustomAttributesDataRequest request)
        {
            GetCustomAttributesDataResponse result = null;

            try
            {
                result = new GetCustomAttributesDataResponse();
                IAttributeRepository repo = AttrFactory.GetRepository(request, RepositoryType.AttributeLibrary);

                result.CustomAttributes = repo.FindByType(request.TypeId) as List <CustomAttributeData>;
                result.Version          = request.Version;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public GetCustomAttributesDataResponse Get(GetCustomAttributesDataRequest request)
        {
            GetCustomAttributesDataResponse response = new GetCustomAttributesDataResponse();

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

                response         = Manager.GetCustomAttributesByType(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);
        }