예제 #1
0
        public object FindByID(string entityID)
        {
            GetYesNoStepDataResponse response = null;

            using (YesNoStepMongoContext ctx = new YesNoStepMongoContext(_dbName))
            {
                List <IMongoQuery> queries = new List <IMongoQuery>();
                queries.Add(Query.EQ(MEYesNo.IdProperty, ObjectId.Parse(entityID)));
                queries.Add(Query.EQ(MEYesNo.DeleteFlagProperty, false));
                IMongoQuery mQuery  = Query.And(queries);
                MEYesNo     meYesNo = ctx.YesNoSteps.Collection.Find(mQuery).FirstOrDefault();
                if (meYesNo != null)
                {
                    response = new GetYesNoStepDataResponse();
                    API.DataDomain.Step.DTO.YesNoData yesnoStep = new API.DataDomain.Step.DTO.YesNoData
                    {
                        ID       = meYesNo.Id.ToString(),
                        Type     = meYesNo.Type.ToString(),
                        Status   = Helper.ToFriendlyString(meYesNo.Status),
                        Question = meYesNo.Question,
                        Notes    = meYesNo.Notes
                    };
                    response.YesNoStep = yesnoStep;
                }
            }
            return(response);
        }
예제 #2
0
        public static GetYesNoStepDataResponse GetYesNoStepByID(GetYesNoStepDataRequest request)
        {
            GetYesNoStepDataResponse result = new GetYesNoStepDataResponse();

            IStepRepository <GetYesNoStepDataResponse> repo = StepRepositoryFactory <GetYesNoStepDataResponse> .GetStepRepository(request.ContractNumber, request.Context, yesnostep);

            repo.UserId = request.UserId;
            result      = repo.FindByID(request.YesNoStepID) as GetYesNoStepDataResponse;

            return(result != null ? result : new GetYesNoStepDataResponse());
        }
예제 #3
0
        public void GetYesNoStepByID_Test()
        {
            // Arrange
            double version                  = 1.0;
            string contractNumber           = "InHealth001";
            string context                  = "NG";
            GetYesNoStepDataRequest request = new GetYesNoStepDataRequest {
                YesNoStepID = "52a641e8d433231824878c8f", Context = context, ContractNumber = contractNumber, Version = version
            };

            // Act
            GetYesNoStepDataResponse response = StepDataManager.GetYesNoStepByID(request);

            // Assert
            Assert.IsTrue(response.YesNoStep.Question == "Are you an ABC Employee?");
        }
예제 #4
0
        public GetYesNoStepDataResponse Get(GetYesNoStepDataRequest request)
        {
            GetYesNoStepDataResponse response = new GetYesNoStepDataResponse();

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

                response         = StepDataManager.GetYesNoStepByID(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);
        }