Exemple #1
0
        public SurveyResponseBO UpdateSurveyResponse(SurveyResponseBO pValue)
        {
            SurveyResponseBO result = pValue;
            //Check if this respose has prent
            string ParentId     = SurveyResponseDao.GetResponseParentId(pValue.ResponseId);
            Guid   ParentIdGuid = Guid.Empty;

            if (!string.IsNullOrEmpty(ParentId))
            {
                ParentIdGuid = new Guid(ParentId);
            }
            Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao ISurveyInfoDao = new EF.EntitySurveyInfoDao();
            Epi.Web.BLL.SurveyInfo Implementation = new Epi.Web.BLL.SurveyInfo(ISurveyInfoDao);
            var List = Implementation.GetSurveyControlList(pValue.SurveyId);
            SurveyResponseJson SurveyResponseJson = new SurveyResponseJson();
            var json = SurveyResponseJson.GetSurveyResponseJson(pValue, List);

            pValue.Json = json;
            //if ( pValue.Status == 2 && ParentIdGuid!= Guid.Empty )
            //{
            //if (!string.IsNullOrEmpty(ParentId) && ParentId != Guid.Empty.ToString() && pValue.Status == 2)
            //    {
            //    //read the child

            //    SurveyResponseBO Child = this.SurveyResponseDao.GetSingleResponse(pValue.ResponseId);
            //    // read the parent
            //    SurveyResponseBO Parent = this.SurveyResponseDao.GetSingleResponse(ParentId);
            //    //copy and update
            //    Parent.XML = Child.XML;
            //    this.SurveyResponseDao.UpdateSurveyResponse(Parent);
            //    result = Parent;
            //    //Check if this child has a related form (subchild)
            //    List<SurveyResponseBO> Children = this.GetResponsesHierarchyIdsByRootId(Child.ResponseId);
            //    if (Children.Count() > 1)
            //    {
            //        SurveyResponseBO NewChild = Children[1];
            //        NewChild.RelateParentId = Parent.ResponseId;
            //        this.SurveyResponseDao.UpdateSurveyResponse(NewChild);
            //    }
            //    // Set  child recod UserId
            //    Child.UserId = pValue.UserId;
            //    // delete the child
            //    this.DeleteSingleSurveyResponse(Child);

            //}
            //else
            //{
            //Check if the record existes.If it does update otherwise insert new
            this.SurveyResponseDao.UpdateSurveyResponse(pValue);

            SurveyResponseBO SurveyResponseBO = SurveyResponseDao.GetResponseXml(pValue.ResponseId);



            //  }
            return(result);
        }
Exemple #2
0
        public string GetSurveyResponseJson(Epi.Web.Common.DTO.SurveyAnswerDTO surveyAnswerDTO, List <FormsHierarchyDTO> FormsHierarchyDTOList, SurveyControlsResponse List)
        {
            SurveyResponseJson Implementation = new SurveyResponseJson();

            return(Implementation.GetSurveyResponseJson(surveyAnswerDTO, FormsHierarchyDTOList, List));
        }