public bool DeleteSurveyResponseInEditMode(SurveyResponseBO pValue, int Status = -1) { bool result = false; List <SurveyResponseBO> Children = this.GetResponsesHierarchyIdsByRootId(pValue.ResponseId); foreach (var child in Children) { //Get the original copy of the xml SurveyResponseBO ResponseXml = this.SurveyResponseDao.GetResponseXml(child.ResponseId); if (!ResponseXml.IsNewRecord) { child.XML = ResponseXml.XML; this.SurveyResponseDao.UpdateSurveyResponse(child); } else { child.UserId = pValue.UserId; this.SurveyResponseDao.DeleteSurveyResponse(child); } // delete record from ResponseXml Table ResponseXmlBO ResponseXmlBO = new ResponseXmlBO(); ResponseXmlBO.ResponseId = child.ResponseId; this.SurveyResponseDao.DeleteResponseXml(ResponseXmlBO); if (Status > -1) { this.SurveyResponseDao.UpdateRecordStatus(ResponseXmlBO.ResponseId, Status); } } result = true; return(result); }
internal static ResponseXml ToEF(ResponseXmlBO ResponseXmlBO) { ResponseXml ResponseXml = new ResponseXml(); ResponseXml.ResponseId = new Guid(ResponseXmlBO.ResponseId); ResponseXml.Xml = ResponseXmlBO.Xml; ResponseXml.UserId = ResponseXmlBO.User; ResponseXml.IsNewRecord = ResponseXmlBO.IsNewRecord; return(ResponseXml); }
public List <SurveyResponseBO> InsertSurveyResponse(List <SurveyResponseBO> pValue, int UserId, bool IsNewRecord = false) { foreach (var item in pValue) { ResponseXmlBO ResponseXmlBO = new ResponseXmlBO(); ResponseXmlBO.User = UserId; ResponseXmlBO.ResponseId = item.ResponseId; ResponseXmlBO.Xml = item.XML; ResponseXmlBO.IsNewRecord = IsNewRecord; this.SurveyResponseDao.InsertResponseXml(ResponseXmlBO); } return(pValue); }
public void DeleteResponseXml(ResponseXmlBO ResponseXmlBO) { this.SurveyResponseDao.DeleteResponseXml(ResponseXmlBO); }