public static IStrategy GetClientAssessmentAdminStrategy(ClientAssessment clientAssessment, dynamic args = null)
        {
            if (clientAssessment != null)
            {
                switch (clientAssessment.DataCaptureModeType)
                {
                case DataCaptureModeType.Email:
                {
                    var assessmentForm = GetAssessmentForm(clientAssessment.AssessmentFormKey);
                    //var clientAssessmentByEmailAdminStategy = new ClientAssessmentByEmailAdminStrategy();
                    return(new ClientAssessmentByEmailAdminStrategy(clientAssessment, assessmentForm, args));
                }

                case DataCaptureModeType.EmailNonBranded:
                {
                    var assessmentForm = GetAssessmentForm(clientAssessment.AssessmentFormKey);
                    return(new ClientAssessmentByEmailAdminStrategy(clientAssessment, assessmentForm, args));
                }
                    //case DataCaptureModeType.OnSite:
                    //    {
                    //        return new ClientAssessmentByOnSiteAdminStrategy(clientAssessment, args);
                    //    }
                    //case DataCaptureModeType.ManualEntry:
                    //    {
                    //        return new ClientAssessmentByManualEntryStrategy(clientAssessment);
                    //    }
                }
            }
            return(null);
            //throw new ClientAssessmentAdministrationException("Unable to find a suitable strategy ");
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ClientAssessmentId,StandarizedScore,DateAdministered,ClientId,AssessmentId")] ClientAssessment clientAssessment)
        {
            if (id != clientAssessment.ClientAssessmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clientAssessment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientAssessmentExists(clientAssessment.ClientAssessmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AssessmentId"] = new SelectList(_context.Assessments, "AssessmentId", "TestName", clientAssessment.AssessmentId);
            ViewData["ClientId"]     = new SelectList(_context.Clients, "ClientId", "FirstInitial", clientAssessment.ClientId);
            return(View(clientAssessment));
        }
Beispiel #3
0
        public async Task <ClientAssessment> SaveClientAssessmentDemographics(ClientAssessment clientAssessment)
        {
            ///TODO: Convert clientAssessment to AssessmentReview
            AssessmentReview assessmentReview = new AssessmentReview();

            //return await _assessmentReviewData.AddAssessmentReview(assessmentReview).Result;
            clientAssessment.ClientAssessmentKey = 9999;
            return(await Task.Run(() => clientAssessment));
        }
Beispiel #4
0
        private void ShowAssessmentReport(ClientAssessment clientAssessment)
        {
            ClientAssessmentReport assessmentReport = new ClientAssessmentReport
            {
                objectDataSourceAssessmentData = { DataSource = clientAssessment }
            };

            documentViewerMain.PrintingSystem = assessmentReport.PrintingSystem;
            assessmentReport.CreateDocument();
        }
        public static string BuildAdminURL(ClientAssessment client_assessment, AssessmentForm assessment_form = null)
        {
            if (assessment_form == null)
            {
                assessment_form = get_assessment_form(client_assessment.AssessmentFormKey);
            }

            //return ((string.IsNullOrWhiteSpace(assessment_form.AdminURL)) ? _def_admin_url : assessment_form.AdminURL) + "?arg=" + client_assessment.UrlToken;
            return(client_assessment.UrlToken);
        }
        public async Task <ClientAssessment> SaveClientAssessmentDemographics(ClientAssessment clientAssessment)
        {
            var loggedInUserID   = _userService.GetCurrentUserId();
            var loggedInUserName = _userService.GetCurrentUserName();

            clientAssessment.OrgUserMappingKey = int.Parse(loggedInUserID);
            clientAssessment.TestDate          = DateTime.Now;
            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var clientAssessmentResult = await coreServiceClient.SaveClientAssessmentDemographicsAsync(int.Parse(loggedInUserID), clientAssessment, loggedInUserID);     //.SaveOrUpdateClientAsync(client, int.Parse(loggedInUserID), clientGroup, loggedInUserName);

            return(clientAssessmentResult);
        }
Beispiel #7
0
        public async Task <IActionResult> Create([Bind("ClientAssessmentId,StandarizedScore,DateAdministered,ClientId,AssessmentId")] ClientAssessment clientAssessment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clientAssessment);
                await _context.SaveChangesAsync();

                return(Redirect($"/Clients/Details/{clientAssessment.ClientId}"));
            }
            ViewData["AssessmentId"] = new SelectList(_context.Assessments, "AssessmentId", "TestName", clientAssessment.AssessmentId);
            ViewData["ClientId"]     = clientAssessment.ClientId;
            return(RedirectToRoute("/Clients/Details", new { clientId = clientAssessment.ClientId }));
        }
 private void simpleButtonSave_Click(object sender, EventArgs e)
 {
     ClientAssessment = clientAssessmentBindingSource.DataSource as ClientAssessment;
     if (ClientAssessment != null)
     {
         if (ClientAssessment.Id == 0)
         {
             ClientAssessment.Insert();
         }
         else
         {
             ClientAssessment.Update();
         }
     }
     DialogResult = DialogResult.OK;
 }
        public IActionResult SaveDemoInput([FromBody] dynamic model) ///int[] assessments, int[] clients, string[] clientDataTable, string[] testDataTable)
        //public IActionResult SaveDemoInput(int[] assessments, int[] clients, string[] clientDataTable, string[] testDataTable)
        {
            //var test = model.assessments[0];
            ClientAssessment result = new ClientAssessment();

            for (var i = 0; i < model.clients.Count; i++)
            {
                //var test = model.clientDataTable.Count;
                var clientAssessment = new ClientAssessment
                {
                    ClientKey           = model.clients[i],
                    AssessmentFormKey   = model.assessments[0],
                    DataCaptureModeType = DataCaptureModeType.EmailNonBranded,
                    NotifyOnAdminDone   = model.emailTemplateData.notify.Value,
                    ExpirationDays      = 0,//model.emailTemplateData.expirationDays.Value,
                    StatusKey           = 13,
                    ClientData          = string.Join(",", model.clientDataTable[i]),
                    TestInfo            = string.Join(",", model.testDataTable[i])
                };
                result = _clientAssessmentData.SaveClientAssessmentDemographics(clientAssessment).Result;
                if (result.ClientAssessmentKey > 0)
                {
                    var strategy = ClientAssessmentStrategyFactory
                                   .GetClientAssessmentAdminStrategy(
                        result,
                        new
                    {
                        Body                  = model.emailTemplateData.template.Value,
                        IncludeProduct        = model.emailTemplateData.product.Value,
                        IncludeAssessmentTime = model.emailTemplateData.assessmentTime.Value,
                        IncludeExpiration     = model.emailTemplateData.expiration.Value,
                        ExpirationDays        = model.emailTemplateData.expirationDays.Value,
                        Subject               = model.emailTemplateData.subject.Value,
                        RaterEmail            = model.clientDemoTable[i].primaryEmail.Value,
                        SendCopy              = model.emailTemplateData.sendCopy.Value
                                                //,OrgUserEmailAddress = "*****@*****.**"
                    });
                    strategy.Execute();
                }
            }

            return(Json(new { someValue = "It's ok" }));
        }
Beispiel #10
0
        private void barButtonItemClientAssessment_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int currentId = GetSelectedNodeId();

            if (currentId < 0)
            {
                currentId = ProgressNoteInformation.ReturnClientIdFromNote(Math.Abs(currentId));
            }

            if (currentId > 0)
            {
                ClientAssessment clientAssessment = ClientAssessment.GetAssessment(currentId) ??
                                                    ClientAssessment.CreateNewClientAssessment(currentId);

                // call the form
                ClientAssessmentForm assessmentForm = new ClientAssessmentForm {
                    ClientAssessment = clientAssessment
                };
                if (assessmentForm.ShowDialog() == DialogResult.OK)
                {
                    ShowAssessmentReport(assessmentForm.ClientAssessment);
                }
            }
        }
Beispiel #11
0
 public ClientAssessmentByEmailAdminStrategy(ClientAssessment clientAssessment, CoreServiceDevReference.AssessmentForm assessmentForm, dynamic args)
 {
     _clientAssessment = clientAssessment;
     _assessmentForm   = assessmentForm;
     _args             = args;
 }