Ejemplo n.º 1
0
        public void Insert_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"));

            PutProgramAttributesResponse resp =
                client.Put <PutProgramAttributesResponse>(
                    string.Format("{0}/{1}/{2}/{3}/Program/Attributes/Insert/",
                                  url,
                                  context,
                                  version,
                                  contractNumber,
                                  planElementId), new PutProgramAttributesRequest
            {
                ProgramAttributes = new ProgramAttributeData
                {
                    PlanElementId = planElementId,
                    //AssignedBy = "test",
                    //EligibilityEndDate = System.DateTime.UtcNow,
                    RemovedReason = "This is a removed reason!"
                }
            } as object);
        }
Ejemplo n.º 2
0
        public PutProgramAttributesResponse InsertProgramAttributes(PutProgramAttributesRequest request)
        {
            try
            {
                PutProgramAttributesResponse response = new PutProgramAttributesResponse();

                IProgramRepository progAttr = Factory.GetRepository(request, RepositoryType.PatientProgramAttribute);//.GetProgramAttributesRepository(request);

                bool resp = (bool)progAttr.Insert((object)request.ProgramAttributes);
                response.Result = resp;

                return(response);
            }
            catch (Exception ex)
            {
                throw new Exception("DD:DataProgramManager:InsertProgramAttributes()::" + ex.Message, ex.InnerException);
            }
        }
Ejemplo n.º 3
0
        internal static bool InsertNewProgramAttribute(ProgramAttributeData pa, 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/Insert/",
                                                                  DDProgramServiceUrl,
                                                                  context,
                                                                  version,
                                                                  contractNumber,
                                                                  pa.PlanElementId), request.UserId);

                PutProgramAttributesResponse resp =
                    client.Put <PutProgramAttributesResponse>(
                        url, new PutProgramAttributesRequest
                {
                    ProgramAttributes = pa
                } as object);

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

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

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

                response         = ProgramDataManager.InsertProgramAttributes(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);
        }