Ejemplo n.º 1
0
        public void SessionUpdateUpdatesSession()
        {
            var sur     = new SessionUpdateRequest();
            var session = new ValidatedSession();

            session.CaseID                   = 522;
            session.DateOfService            = DateTime.Today;
            session.Duration                 = TimeSpan.FromMinutes(45);
            session.LocationID               = 2;
            session.ServerValidatedSessionID = 0;
            session.ServiceID                = 9;
            session.StartTime                = DateTime.Now.TimeOfDay;

            sur.SessionDetails    = session;
            sur.QuestionResponses = new System.Collections.Generic.List <NoteQuestionResponse>();
            sur.QuestionResponses.Add(new NoteQuestionResponse()
            {
                Answer         = "This is my answer.  It has to be enough characters.  It has to have words and sentences and periods.",
                NoteQuestionID = 15
            });

            var sut = _repo.SessionUpdate(sur);

            Assert.IsTrue(sut.Success);
        }
Ejemplo n.º 2
0
 public CaseValidation(ValidatedSession validatedSession)
 {
     ServerValidatedSessionID = validatedSession.ServerValidatedSessionID;
     CaseID              = validatedSession.CaseID;
     DateOfService       = validatedSession.DateOfService;
     StartTime           = validatedSession.StartTime;
     Duration            = validatedSession.Duration;
     ServiceID           = validatedSession.ServiceID;
     LocationID          = validatedSession.LocationID;
     LocationDescription = validatedSession.LocationDescription;
     ServiceDescription  = validatedSession.ServiceDescription;
 }
Ejemplo n.º 3
0
        public async Task <ValidationResponse> ValidateRequest(ValidatedSession caseAuthorizationRequest, bool save = true)
        {
            try
            {
                var communicationHelper = new CommunicationHelper <ValidationResponse, ErrorResponse> {
                    Timeout = GetTimeout()
                };

                var authenticationHeader = await _accountService.GetAuthenticationHeader();

                var validationRequest = new ValidationRequest {
                    RequestedValidatedSession = caseAuthorizationRequest
                };

                var queryStringValues = new Dictionary <string, string>();
                queryStringValues["save"] = save.ToString();

                var response = await communicationHelper.PostRequest(_urlHelper.BuildUrl("api/Cases/Validate", queryStringValues), JsonConvert.SerializeObject(validationRequest), authenticationHeader);

                if (response == null)
                {
                    throw new CommunicationException(communicationHelper.ErrorResponse?.ToStringList());
                }

                return(response);
            }
            catch (Exception ex)
            {
                var validationResponse = new ValidationResponse()
                {
                    Errors = new List <string>()
                };

#if DEBUG
                string errorMessage = "Unable to validate request : " + ex.GetType().Name + " " + ex.Message;
#else
                string errorMessage = "Unable to validate request.";
#endif
                validationResponse.Errors.Add(errorMessage);

                return(validationResponse);
            }
        }
Ejemplo n.º 4
0
        public static ValidatedSession MapSession(Domain2.Hours.Hours source, CaseValidationState state)
        {
            var session = new ValidatedSession
            {
                CaseID                   = source.CaseID,
                DateOfService            = source.Date,
                Duration                 = source.EndTime - source.StartTime,
                LocationDescription      = source.ServiceLocation.Name,
                LocationID               = source.ServiceLocationID.Value, // ensure all validated sessions have a Location
                ServerValidatedSessionID = source.ID,
                ServiceDescription       = source.Service.Name,
                ServiceID                = source.ServiceID.Value,
                SsgCaseIds               = source.SSGCaseIDs == null ? string.Empty : string.Join(",", source.SSGCaseIDs),
                StartTime                = source.StartTime,
                State = state
            };

            return(session);
        }
Ejemplo n.º 5
0
        public void ValidateProcessesSessionValidationRequest()
        {
            var vr      = new ValidationRequest();
            var session = new ValidatedSession();

            session.CaseID                   = 522;
            session.DateOfService            = DateTime.Today;
            session.Duration                 = TimeSpan.FromMinutes(45);
            session.LocationID               = 2;
            session.ServerValidatedSessionID = 0;
            session.ServiceID                = 9;
            session.StartTime                = DateTime.Now.TimeOfDay;

            vr.RequestedValidatedSession = session;

            var sut = _repo.Validate(vr, false);

            Assert.IsTrue(sut.ServerValidatedSessionID == 0);
            Assert.IsTrue(sut.NoteQuestions.Count == 1);
        }