Example #1
0
        public void GetProgramByID()
        {
            GetProgramRequest request = new GetProgramRequest {
                ProgramID = "5"
            };

            GetProgramResponse response = pm.GetProgramByID(request);

            Assert.IsTrue(response.Program.ProgramID == "Tony");
        }
Example #2
0
        public void Get_AllActivePrograms()
        {
            string      url            = "http://localhost:8888/Program";
            string      ProgramID      = "52a0da34fe7a5915485bdfd6";
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            double      version        = 1.0;
            IRestClient client         = new JsonServiceClient();

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

            GetProgramResponse response = client.Get <GetProgramResponse>(
                string.Format("{0}/{1}/{2}/{3}/Programs/Active", url, context, version, contractNumber, ProgramID));

            //Assert.AreEqual(ProgramID, response.Program.ProgramID);
        }
Example #3
0
        public GetProgramResponse GetProgramByID(GetProgramRequest request)
        {
            try
            {
                GetProgramResponse programResponse = new GetProgramResponse();
                DTO.Program        result;

                IProgramRepository repo = Factory.GetRepository(request, RepositoryType.Program);

                result = repo.FindByID(request.ProgramID) as DTO.Program;

                programResponse.Program = result;
                return(programResponse != null ? programResponse : new GetProgramResponse());
            }
            catch (Exception ex)
            {
                throw new Exception("DD:DataProgramManager:GetProgramByID()::" + ex.Message, ex.InnerException);
            }
        }
Example #4
0
        public GetProgramResponse Post(GetProgramRequest request)
        {
            GetProgramResponse response = new GetProgramResponse();

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

                response         = ProgramDataManager.GetProgramByID(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);
        }
Example #5
0
        private async Task <PostAccountTransactionResponse> FlipAccountState(CrmClient client, GetCustomerResponse customer, GetProgramResponse program)
        {
            var accountNumber = (string)customer.Rows[0].Columns["PRIMARYPOSREF"];
            var accountState  = (bool)customer.Rows[0].Columns["ACTIVE"];
            var programCode   = (string)program.Rows[0].Columns["PROGRAMCODE"];

            var kind        = accountState ? Type.Kind.CloseAccount : Type.Kind.ReopenAccount;
            var transaction =
                new CloseReopenTransactionBuilder()
                .WithType(kind)
                .WithCustomerFriendlyDescription("Updated by test")
                .WithProgramCode(programCode)
                .WithAccountPosRef(accountNumber);

            return(await client.PostAccountTransactionAsync(transaction));
        }