/// <summary> /// Injectinting ISurveyInfoRepository through Constructor /// </summary> /// <param name="iSurveyInfoRepository"></param> public TestSurveyFacade(ISurveyInfoRepository iSurveyInfoRepository, ISurveyAnswerRepository iSurveyResponseRepository, Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest, Epi.Web.Common.Message.SurveyAnswerRequest surveyResponseRequest, Common.DTO.SurveyAnswerDTO surveyAnswerDTO, SurveyResponseXML surveyResponseXML) { _iSurveyInfoRepository = iSurveyInfoRepository; _iSurveyResponseRepository = iSurveyResponseRepository; _surveyInfoRequest = surveyInfoRequest; _surveyAnswerRequest = surveyResponseRequest; _surveyAnswerDTO = surveyAnswerDTO; _surveyResponseXML = surveyResponseXML; }
/// <summary> /// Creates the first survey response in the response table /// </summary> /// <param name="surveyId"></param> /// <param name="responseId"></param> /// <param name="surveyAnswerRequest"></param> /// <param name="surveyAnswerDTO"></param> /// <param name="surveyResponseXML"></param> /// <param name="iSurveyAnswerRepository"></param> public static Epi.Web.Common.DTO.SurveyAnswerDTO CreateSurveyResponse(string surveyId, string responseId, SurveyAnswerRequest surveyAnswerRequest1, Common.DTO.SurveyAnswerDTO surveyAnswerDTO, SurveyResponseXML surveyResponseXML, ISurveyAnswerRepository iSurveyAnswerRepository, int UserId, bool IsChild = false, string RelateResponseId = "", bool IsEditMode = false, int CurrentOrgId = -1) { bool AddRoot = false; SurveyAnswerRequest surveyAnswerRequest = new SurveyAnswerRequest(); surveyAnswerRequest.Criteria.SurveyAnswerIdList.Add(responseId.ToString()); surveyAnswerDTO.ResponseId = responseId.ToString(); //surveyAnswerDTO.DateCompleted = DateTime.Now; surveyAnswerDTO.DateCreated = DateTime.Now; surveyAnswerDTO.SurveyId = surveyId; surveyAnswerDTO.Status = (int)Constant.Status.InProgress; surveyAnswerDTO.RecordSourceId = 4; if (IsEditMode) { surveyAnswerDTO.ParentRecordId = RelateResponseId; } //if (IsEditMode) // { // surveyAnswerDTO.Status = (int)Constant.Status.Complete; // } //else // { // surveyAnswerDTO.Status = (int)Constant.Status.InProgress; // } surveyAnswerDTO.XML = surveyResponseXML.CreateResponseXml(surveyId, AddRoot, 0, "0").InnerXml; surveyAnswerDTO.RelateParentId = RelateResponseId; surveyAnswerRequest.Criteria.UserId = UserId; surveyAnswerRequest.Criteria.UserOrganizationId = CurrentOrgId; surveyAnswerRequest.SurveyAnswerList.Add(surveyAnswerDTO); if (!IsChild) { surveyAnswerRequest.Action = Epi.Web.MVC.Constants.Constant.CREATE; } else { if (IsEditMode) { surveyAnswerRequest.SurveyAnswerList[0].ParentRecordId = null; } surveyAnswerRequest.Action = Epi.Web.MVC.Constants.Constant.CREATECHILD; } iSurveyAnswerRepository.SaveSurveyAnswer(surveyAnswerRequest); return(surveyAnswerDTO); }
/// <summary> /// Injectinting ISurveyInfoRepository through Constructor /// </summary> /// <param name="iSurveyInfoRepository"></param> public SurveyFacade(ISurveyInfoRepository iSurveyInfoRepository, ISurveyAnswerRepository iSurveyResponseRepository, Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest, Epi.Web.Common.Message.SurveyAnswerRequest surveyResponseRequest, Common.DTO.SurveyAnswerDTO surveyAnswerDTO, SurveyResponseXML surveyResponseXML, UserAuthenticationRequest surveyAuthenticationRequest, Epi.Web.Common.DTO.PassCodeDTO PassCodeDTO, IOrganizationAccountRepository iOrgAccountRepository) { _iSurveyInfoRepository = iSurveyInfoRepository; _iSurveyAnswerRepository = iSurveyResponseRepository; _surveyInfoRequest = surveyInfoRequest; _surveyAnswerRequest = surveyResponseRequest; _surveyAnswerDTO = surveyAnswerDTO; _surveyResponseXML = surveyResponseXML; _surveyAuthenticationRequest = surveyAuthenticationRequest; _PassCodeDTO = PassCodeDTO; _iOrgAccountRepository = iOrgAccountRepository; }
public ActionResult Index(PassCodeModel Model, string responseId, string ReturnUrl) { //parse and get the responseId responseId = GetResponseId(ReturnUrl); Common.DTO.SurveyAnswerDTO R = _isurveyFacade.GetSurveyAnswerResponse(responseId).SurveyResponseList[0]; Session["RootFormId"] = R.SurveyId.ToString(); Session["RootResponseId"] = responseId; // Get Last Page visited else send to page 1 - Begin XDocument Xdoc = XDocument.Parse(R.XML); int PageNumber = 0; if (Xdoc.Root.Attribute("LastPageVisited") != null) { if (!int.TryParse(Xdoc.Root.Attribute("LastPageVisited").Value, out PageNumber)) { PageNumber = 1; } } else { PageNumber = 1; } //if (ReturnUrl.EndsWith("/")) //{ // ReturnUrl = ReturnUrl + PageNumber.ToString(); //} //else //{ // ReturnUrl = ReturnUrl + "/" + PageNumber.ToString(); //} // Get Last Page visited else send to page 1 - End //get the surveyId string SurveyId = R.SurveyId; //put surveyId in viewbag so can be retrieved in Login/Index.cshtml ViewBag.SurveyId = SurveyId; Epi.Web.Common.Message.UserAuthenticationResponse result = _isurveyFacade.ValidateUser(responseId, Model.PassCode); if (result.UserIsValid) { FormsAuthentication.SetAuthCookie(Model.PassCode, false); // return RedirectToRoute(new { Controller = "Survey", Action = "Index", responseid = responseId }); return(Redirect(ReturnUrl)); } else { ModelState.AddModelError("", "Pass code is incorrect."); return(View()); } }
public void Update(Common.DTO.SurveyAnswerDTO t) { throw new NotImplementedException(); }