Ejemplo n.º 1
0
        public void Update_Attribute_Test()
        {
            string url            = "http://localhost:8888/Program";
            string contractNumber = "InHealth001";
            string context        = "NG";
            double version        = 1.0;
            string planElementId  = "52ede291fe7a590728e1a382";

            IRestClient client = new JsonServiceClient();

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

            PutUpdateProgramAttributesResponse resp =
                client.Put <PutUpdateProgramAttributesResponse>(
                    string.Format("{0}/{1}/{2}/{3}/Program/Attributes/Update/",
                                  url,
                                  context,
                                  version,
                                  contractNumber,
                                  planElementId), new PutUpdateProgramAttributesRequest
            {
                ProgramAttributes = new ProgramAttributeData {
                    PlanElementId = planElementId,
                    //AssignedBy = "test",
                    //EligibilityEndDate = System.DateTime.UtcNow,
                    RemovedReason = "This is a removed reason!"
                }
            } as object);
        }
Ejemplo n.º 2
0
        public PutUpdateProgramAttributesResponse PutUpdateProgramAttributes(PutUpdateProgramAttributesRequest request)
        {
            try
            {
                PutUpdateProgramAttributesResponse result = new PutUpdateProgramAttributesResponse();
                IProgramRepository responseRepo           = Factory.GetRepository(request, RepositoryType.PatientProgramAttribute);//.GetProgramAttributesRepository(request);

                ProgramAttributeData pa = request.ProgramAttributes;
                result.Result = (bool)responseRepo.Update(pa);

                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception("DD:DataProgramManager:PutUpdateProgramAttributes()::" + ex.Message, ex.InnerException);
            }
        }
Ejemplo n.º 3
0
        internal static bool UpdateProgramAttributes(ProgramAttributeData pAtt, IAppDomainRequest request)
        {
            bool result = false;

            try
            {
                double version        = request.Version;
                string contractNumber = request.ContractNumber;
                string context        = "NG";


                IRestClient client = new JsonServiceClient();

                string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Program/Attributes/Update/",
                                                                  DDProgramServiceUrl,
                                                                  context,
                                                                  version,
                                                                  contractNumber,
                                                                  pAtt.PlanElementId), request.UserId);

                PutUpdateProgramAttributesResponse resp =
                    client.Put <PutUpdateProgramAttributesResponse>(
                        url, new PutUpdateProgramAttributesRequest
                {
                    ProgramAttributes = pAtt
                } as object);

                if (resp.Result)
                {
                    result = true;
                }

                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception("AD:PlanElementEndpointUtil:UpdateProgramAttributes()::" + ex.Message, ex.InnerException);
            }
        }
Ejemplo n.º 4
0
        public PutUpdateProgramAttributesResponse Put(PutUpdateProgramAttributesRequest request)
        {
            PutUpdateProgramAttributesResponse response = new PutUpdateProgramAttributesResponse();

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

                response         = ProgramDataManager.PutUpdateProgramAttributes(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex);

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