Пример #1
0
 public SurveyTemplateService(ISurveyTemplateRepository SurveyTemplateRepository, ISurveyQuestionRepository SurveyQuestionRepository,
                              ICorporateAccountRepository corporateAccountRepository, ISurveyQuestionAnswerEditModelFactory SurveyQuestionAnswerEditModelFactory,
                              ISurveyAnswerRepository surveyAnswerRepository)
 {
     _SurveyTemplateRepository             = SurveyTemplateRepository;
     _SurveyQuestionRepository             = SurveyQuestionRepository;
     _corporateAccountRepository           = corporateAccountRepository;
     _SurveyQuestionAnswerEditModelFactory = SurveyQuestionAnswerEditModelFactory;
     _surveyAnswerRepository = surveyAnswerRepository;
 }
Пример #2
0
 /// <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;
 }
Пример #3
0
 /// <summary>
 /// Injectinting ISurveyInfoRepository through Constructor
 /// </summary>
 /// <param name="iSurveyInfoRepository"></param>
 public SurveyFacade(ISurveyInfoRepository iSurveyInfoRepository, ISurveyAnswerRepository iSurveyResponseRepository,
                     Epi.Web.Enter.Common.Message.SurveyInfoRequest surveyInfoRequest, Epi.Web.Enter.Common.Message.SurveyAnswerRequest surveyResponseRequest,
                     Enter.Common.DTO.SurveyAnswerDTO surveyAnswerDTO,
                     SurveyResponseXML surveyResponseXML, UserAuthenticationRequest surveyAuthenticationRequest, Epi.Web.Enter.Common.DTO.PassCodeDTO PassCodeDTO, FormInfoDTO FormInfoDTO)
 {
     _iSurveyInfoRepository       = iSurveyInfoRepository;
     _iSurveyAnswerRepository     = iSurveyResponseRepository;
     _surveyInfoRequest           = surveyInfoRequest;
     _surveyAnswerRequest         = surveyResponseRequest;
     _surveyAnswerDTO             = surveyAnswerDTO;
     _surveyResponseXML           = surveyResponseXML;
     _surveyAuthenticationRequest = surveyAuthenticationRequest;
     _PassCodeDTO = PassCodeDTO;
     _FormInfoDTO = FormInfoDTO;
 }
Пример #4
0
 /// <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;
 }
Пример #5
0
 public SurveyAnswerService(ISurveyAnswerRepository surveyAnswerRepository,
                            IQuestionAnswerRepository questionAnswerRepository,
                            IFieldDataAnswerRepository fieldDataAnswerRepository,
                            IChoiceOptionAnswerRepository choiceOptionAnswerRepository,
                            IRowAnswerRepository rowAnswerRepository,
                            IRowChoiceOptionAnswerRepository rowChoiceOptionAnswerRepository,
                            IQuestionReportRepository questionReportRepository,
                            ISurveyReportRepository surveyReportRepository,
                            IDataSetRepository dataSetRepository)
 {
     _surveyAnswerRepository          = surveyAnswerRepository;
     _questionAnswerRepository        = questionAnswerRepository;
     _fieldDataAnswerRepository       = fieldDataAnswerRepository;
     _choiceOptionAnswerRepository    = choiceOptionAnswerRepository;
     _rowAnswerRepository             = rowAnswerRepository;
     _rowChoiceOptionAnswerRepository = rowChoiceOptionAnswerRepository;
     _questionReportRepository        = questionReportRepository;
     _surveyReportRepository          = surveyReportRepository;
     _dataSetRepository = dataSetRepository;
 }
 public SurveyAnswerAppService(ISurveyAnswerRepository context)
 {
     _repository = context;
 }
Пример #7
0
        public static void UpdateSurveyResponse(SurveyInfoModel surveyInfoModel, MvcDynamicForms.Form form, SurveyAnswerRequest surveyAnswerRequest,
                                                SurveyResponseXML surveyResponseXML,
                                                ISurveyAnswerRepository iSurveyAnswerRepository,
                                                SurveyAnswerResponse surveyAnswerResponse, string responseId, Epi.Web.Common.DTO.SurveyAnswerDTO surveyAnswerDTO, bool IsSubmited, bool IsSaved, int PageNumber, int UserId = -1)
        {
            // 1 Get the record for the current survey response
            // 2 update the current survey response
            // 3 save the current survey response
            if (!IsSubmited)
            {
                // 2 a. update the current survey answer request
                surveyAnswerRequest.SurveyAnswerList = surveyAnswerResponse.SurveyResponseList;

                surveyResponseXML.Add(form);
                XDocument SavedXml = XDocument.Parse(surveyAnswerDTO.XML);
                bool      AddRoot  = false;
                if (SavedXml.Root.FirstAttribute.Value.ToString() == "0")
                {
                    AddRoot = true;
                }
                surveyAnswerRequest.SurveyAnswerList[0].XML = surveyResponseXML.CreateResponseXml(surveyInfoModel.SurveyId, AddRoot, form.CurrentPage, form.PageId).InnerXml;
                // 2 b. save the current survey response
                surveyAnswerRequest.Action = Epi.Web.MVC.Constants.Constant.UPDATE;  //"Update";
                //Append to Response Xml

                XDocument CurrentPageResponseXml = XDocument.Parse(surveyAnswerRequest.SurveyAnswerList[0].XML);
                if (SavedXml.Root.FirstAttribute.Value.ToString() != "0")
                {
                    surveyAnswerRequest.SurveyAnswerList[0].XML = MergeXml(SavedXml, CurrentPageResponseXml, form.CurrentPage).ToString();
                }
            }
            ////Update page number before saving response XML

            XDocument Xdoc = XDocument.Parse(surveyAnswerRequest.SurveyAnswerList[0].XML);

            if (PageNumber != 0)
            {
                Xdoc.Root.Attribute("LastPageVisited").Value = PageNumber.ToString();
            }
            ////Update Hidden Fields List before saving response XML
            if (form.HiddenFieldsList != null)
            {
                Xdoc.Root.Attribute("HiddenFieldsList").Value = "";
                Xdoc.Root.Attribute("HiddenFieldsList").Value = form.HiddenFieldsList.ToString();
            }
            if (form.HighlightedFieldsList != null)
            {
                Xdoc.Root.Attribute("HighlightedFieldsList").Value = "";
                Xdoc.Root.Attribute("HighlightedFieldsList").Value = form.HighlightedFieldsList.ToString();
            }
            if (form.DisabledFieldsList != null)
            {
                Xdoc.Root.Attribute("DisabledFieldsList").Value = "";
                Xdoc.Root.Attribute("DisabledFieldsList").Value = form.DisabledFieldsList.ToString();
            }
            if (form.RequiredFieldsList != null)
            {
                Xdoc.Root.Attribute("RequiredFieldsList").Value = "";
                Xdoc.Root.Attribute("RequiredFieldsList").Value = form.RequiredFieldsList.ToString();
            }
            if (surveyAnswerDTO.RecordBeforeFlag)
            {
                Xdoc.Root.Attribute("RecordBeforeFlag").Value = "True";
            }
            //  AssignList
            List <KeyValuePair <string, String> > FieldsList = new List <KeyValuePair <string, string> >();

            FieldsList = GetHiddenFieldsList(form);
            if (FieldsList != null)
            {
                IEnumerable <XElement> XElementList = Xdoc.XPathSelectElements("SurveyResponse/Page/ResponseDetail");
                for (var i = 0; i < FieldsList.Count; i++)
                {
                    foreach (XElement Element in XElementList)
                    {
                        if (Element.Attribute("QuestionName").Value.ToString().Equals(FieldsList[i].Key, StringComparison.OrdinalIgnoreCase))
                        {
                            if (FieldsList[i].Value != null)
                            {
                                Element.Value = FieldsList[i].Value;
                            }
                            break;
                        }
                    }
                }
            }



            ////Update survey response Status
            if (IsSubmited)
            {
                surveyAnswerRequest.SurveyAnswerList[0].Status        = 3;
                surveyAnswerRequest.SurveyAnswerList[0].DateCompleted = DateTime.Now;
                surveyAnswerRequest.SurveyAnswerList[0].Json          = surveyAnswerResponse.SurveyResponseList[0].Json;
                // Xdoc.Root.Attribute("LastPageVisited").Remove();
                // Xdoc.Root.Attribute("HiddenFieldsList").Remove();
                // Xdoc.Root.Attribute("HighlightedFieldsList").Remove();
                //Xdoc.Root.Attribute("DisabledFieldsList").Remove();
                //Xdoc.Root.Attribute("RequiredFieldsList").Remove();
                //   Xdoc.Root.Attribute("RecordBeforeFlag").Remove();
                //RemovePageNumAtt(Xdoc);
            }
            if (IsSaved)
            {
                surveyAnswerRequest.SurveyAnswerList[0].Status = 2;
            }
            surveyAnswerRequest.SurveyAnswerList[0].XML = Xdoc.ToString();
            /////Update Survey Mode ////////////////////
            surveyAnswerRequest.SurveyAnswerList[0].IsDraftMode = surveyAnswerDTO.IsDraftMode;
            iSurveyAnswerRepository.SaveSurveyAnswer(surveyAnswerRequest);
        }
Пример #8
0
 public static void UpdatePassCode(UserAuthenticationRequest AuthenticationRequest, ISurveyAnswerRepository iSurveyAnswerRepository)
 {
     iSurveyAnswerRepository.UpdatePassCode(AuthenticationRequest);
 }
Пример #9
0
        /// <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);
        }