Example #1
0
        public ActionResult ResearcherSearch()
        {
            ResearcherClient rc = new ResearcherClient();
            var searchData      = rc.GetSearchData();

            if (!searchData.Succeeded)
            {
                ViewBag.ErrorMessage = searchData.ErrorMessages;
                return(View());
            }
            else
            {
                ResearcherModel c = new ResearcherModel();
                c.PatientFields       = searchData.PatientTags;
                c.QuestionnaireFields = searchData.QuestionnaireNames;
                return(View(c));
            }
        }
Example #2
0
        public ActionResult ResearcherSearch(string modelSubmit)
        {
            ViewBag.model = modelSubmit;
            //var x2 = System.Web.Helpers.Json.Decode(modelSubmit);
            var group           = new System.Web.Script.Serialization.JavaScriptSerializer(new ResearcherModelResolver()).Deserialize <group>(modelSubmit);
            ResearcherClient rc = new ResearcherClient();
            var result          = rc.Search(this.ProcessGroup(group));

            if (!result.Succeeded)
            {
                ViewBag.ErrorMessage = result.ErrorMessages;
                return(View());
            }

            var             searchData = rc.GetSearchData();
            ResearcherModel c          = new ResearcherModel();

            c.PatientFields       = searchData.PatientTags;
            c.QuestionnaireFields = searchData.QuestionnaireNames;

            StringBuilder output = new StringBuilder();

            output.Append("<table>");
            output.Append("<tr><th>Patient Id</th><th>Response Group Id</th><th>Start Time</th><th>End Time</th></tr>");
            foreach (var responses in result.QuestionnaireUserResponseGroups)
            {
                output.Append("<tr>");
                output.Append("<td>").Append(responses.Patient.Id).Append("</td>");
                output.Append("<td>").Append(responses.Id).Append("</td>");
                output.Append("<td>").Append(responses.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss")).Append("</td>");
                output.Append("<td>").Append(responses.DateTimeCompleted.Value.ToString("yyyy-MM-dd HH:mm:ss")).Append("</td>");
                output.Append("</tr>");
            }
            output.Append("</table>");
            ViewBag.Result = output.ToString();

            return(View(c));
        }