/// <summary> /// executes program start /// </summary> /// <returns>object</returns> public override object Execute() { if (CheckCodeBlocks != null) { CheckCodeBlocks.Execute(); } return(null); }
/// <summary> /// Call Statment rule /// </summary> /// <returns>object</returns> public override object Execute() { if (this.Context.Subroutine.ContainsKey(this.Identifier.ToLower())) { EnterRule Sub = this.Context.Subroutine[this.Identifier]; return(Sub.Execute()); } return(null); }
/// <summary> /// executes the enclosed expressions /// </summary> /// <returns>object</returns> public override object Execute() { object results = null; if (this.statements != null) { results = statements.Execute(); } return(results); }
/// <summary> /// performs execute command /// </summary> /// <returns>object</returns> public override object Execute() { object result = Define_Statement_Type.Execute(); if (Define_Statement_Group != null) { result = Define_Statement_Group.Execute(); } return(result); }
/// <summary> /// performs the negation or pass-thru operation /// </summary> /// <returns>object</returns> public override object Execute() { object result = null; if (this.op != null) { if (this.op == "-") { result = -1.0 * double.Parse(Value.Execute().ToString()); } else { result = double.Parse(Value.Execute().ToString()); } } else { result = Value.Execute(); } return(result); }
/// <summary> /// performs execute command /// </summary> /// <returns>object</returns> public override object Execute() { //if (define_Statements_Group != null && define_Statements_Group.Define_Statement_Type != null && this.Context.EnterCheckCodeInterface.IsExecutionEnabled) if (define_Statements_Group != null && this.Context.EnterCheckCodeInterface.IsExecutionEnabled) { this.Context.DefineVariablesCheckcode = this; return(define_Statements_Group.Execute()); } else { this.Context.DefineVariablesCheckcode = null; return(null); } }
/// <summary> /// performs execution of the If...Then...Else command /// </summary> /// <returns>object</returns> public override object Execute() { object result = null; if (Expression.Execute().ToString().ToLower() == "true") { result = Statements1.Execute(); } else { if (Statements2 != null) { result = Statements2.Execute(); } } return(result); }
/// <summary> /// performs execution of the If...Then...Else command /// </summary> /// <returns>object</returns> public override object Execute() { object result = null; if (IfClause.Execute().ToString().ToLower() == "true") { result = ThenClause.Execute(); } else { if (ElseClause != null) { result = ElseClause.Execute(); } } return(result); }
public ActionResult Index(string surveyid, string AddNewFormId, string EditForm) { int UserId = SurveyHelper.GetDecryptUserId(Session["UserId"].ToString()); int CuurentOrgId = int.Parse(Session["SelectedOrgId"].ToString()); Guid ResponseID = Guid.NewGuid(); Session["FormValuesHasChanged"] = ""; TempData[Epi.Web.MVC.Constants.Constant.RESPONSE_ID] = Session["RootResponseId"] = ResponseID.ToString(); if (string.IsNullOrEmpty(EditForm) && Session["EditForm"] != null) { EditForm = Session["EditForm"].ToString(); } if (!string.IsNullOrEmpty(EditForm) && string.IsNullOrEmpty(AddNewFormId)) { Session["RootResponseId"] = EditForm.ToLower(); Session["IsEditMode"] = true; Epi.Web.Enter.Common.DTO.SurveyAnswerDTO surveyAnswerDTO = GetSurveyAnswer(EditForm, Session["RootFormId"].ToString()); Session["RequestedViewId"] = surveyAnswerDTO.ViewId; if (Session["RecoverLastRecordVersion"] != null) { surveyAnswerDTO.RecoverLastRecordVersion = bool.Parse(Session["RecoverLastRecordVersion"].ToString()); } string ChildRecordId = GetChildRecordId(surveyAnswerDTO); Session["RecoverLastRecordVersion"] = false; return(RedirectToAction(Epi.Web.MVC.Constants.Constant.INDEX, Epi.Web.MVC.Constants.Constant.SURVEY_CONTROLLER, new { responseid = ChildRecordId, PageNumber = 1, Edit = "Edit" })); } else { Session["IsEditMode"] = false; } bool IsMobileDevice = this.Request.Browser.IsMobileDevice; if (IsMobileDevice == false) { IsMobileDevice = Epi.Web.MVC.Utility.SurveyHelper.IsMobileDevice(this.Request.UserAgent.ToString()); } FormsAuthentication.SetAuthCookie("BeginSurvey", false); Session["RootFormId"] = AddNewFormId; //create the responseid Epi.Web.Enter.Common.DTO.SurveyAnswerDTO SurveyAnswer = _isurveyFacade.CreateSurveyAnswer(AddNewFormId, ResponseID.ToString(), UserId, false, "", false, CuurentOrgId); MvcDynamicForms.Form form = _isurveyFacade.GetSurveyFormData(SurveyAnswer.SurveyId, 1, SurveyAnswer, IsMobileDevice, null, null, false, false); TempData["Width"] = form.Width + 100; SurveyInfoModel surveyInfoModel = Mapper.ToFormInfoModel(form.SurveyInfo); // set the survey answer to be production or test SurveyAnswer.IsDraftMode = form.SurveyInfo.IsDraftMode; XDocument xdoc = XDocument.Parse(form.SurveyInfo.XML); ///////////////////////////// Execute - Record Before - start////////////////////// Dictionary <string, string> ContextDetailList = new Dictionary <string, string>(); EnterRule FunctionObject_B = (EnterRule)form.FormCheckCodeObj.GetCommand("level=record&event=before&identifier="); SurveyResponseXML SurveyResponseXML = new SurveyResponseXML(PageFields, RequiredList); if (FunctionObject_B != null && !FunctionObject_B.IsNull()) { try { SurveyAnswer.XML = SurveyResponseXML.CreateResponseDocument(xdoc, SurveyAnswer.XML); Session["RequiredList"] = SurveyResponseXML._RequiredList; //SurveyAnswer.XML = Epi.Web.MVC.Utility.SurveyHelper.CreateResponseDocument(xdoc, SurveyAnswer.XML, RequiredList); this.RequiredList = SurveyResponseXML._RequiredList; form.RequiredFieldsList = this.RequiredList; FunctionObject_B.Context.HiddenFieldList = form.HiddenFieldsList; FunctionObject_B.Context.HighlightedFieldList = form.HighlightedFieldsList; FunctionObject_B.Context.DisabledFieldList = form.DisabledFieldsList; FunctionObject_B.Context.RequiredFieldList = form.RequiredFieldsList; FunctionObject_B.Execute(); // field list form.HiddenFieldsList = FunctionObject_B.Context.HiddenFieldList; form.HighlightedFieldsList = FunctionObject_B.Context.HighlightedFieldList; form.DisabledFieldsList = FunctionObject_B.Context.DisabledFieldList; form.RequiredFieldsList = FunctionObject_B.Context.RequiredFieldList; ContextDetailList = Epi.Web.MVC.Utility.SurveyHelper.GetContextDetailList(FunctionObject_B); form = Epi.Web.MVC.Utility.SurveyHelper.UpdateControlsValuesFromContext(form, ContextDetailList); _isurveyFacade.UpdateSurveyResponse(surveyInfoModel, ResponseID.ToString(), form, SurveyAnswer, false, false, 0, SurveyHelper.GetDecryptUserId(Session["UserId"].ToString())); } catch (Exception ex) { // do nothing so that processing // can continue } } else { SurveyAnswer.XML = SurveyResponseXML.CreateResponseDocument(xdoc, SurveyAnswer.XML);//, RequiredList); this.RequiredList = SurveyResponseXML._RequiredList; Session["RequiredList"] = SurveyResponseXML._RequiredList; form.RequiredFieldsList = RequiredList; _isurveyFacade.UpdateSurveyResponse(surveyInfoModel, SurveyAnswer.ResponseId, form, SurveyAnswer, false, false, 0, SurveyHelper.GetDecryptUserId(Session["UserId"].ToString())); } return(RedirectToAction(Epi.Web.MVC.Constants.Constant.INDEX, Epi.Web.MVC.Constants.Constant.SURVEY_CONTROLLER, new { responseid = ResponseID, PageNumber = 1, surveyid = surveyInfoModel.SurveyId })); }
public ActionResult Index(Epi.Web.MVC.Models.SurveyInfoModel surveyModel) { try { bool IsMobileDevice = this.Request.Browser.IsMobileDevice; if (IsMobileDevice == false) { IsMobileDevice = Epi.Web.MVC.Utility.SurveyHelper.IsMobileDevice(this.Request.UserAgent.ToString()); } FormsAuthentication.SetAuthCookie("BeginSurvey", false); Session["RootResponseId"] = surveyModel.ResponseId; string ResponseID = surveyModel.ResponseId; //string.Empty; //object tempDataValue; //if (TempData.TryGetValue(Epi.Web.MVC.Constants.Constant.RESPONSE_ID, out tempDataValue)) //{ // ResponseID = (string)tempDataValue; //} //else //{ //} Epi.Web.Common.DTO.SurveyAnswerDTO SurveyAnswer = _isurveyFacade.CreateSurveyAnswer(surveyModel.SurveyId, ResponseID.ToString()); Epi.Web.Common.Message.UserAuthenticationResponse AuthenticationResponse = _isurveyFacade.GetAuthenticationResponse(ResponseID.ToString()); string strPassCode = Epi.Web.MVC.Utility.SurveyHelper.GetPassCode(); if (string.IsNullOrEmpty(AuthenticationResponse.PassCode)) { //_isurveyFacade.UpdatePassCode(ResponseID.ToString(), TempData["PassCode"].ToString()); _isurveyFacade.UpdatePassCode(ResponseID.ToString(), surveyModel.PassCode); } Epi.Web.Common.Message.SurveyAnswerResponse SurveyAnswerResponse = _isurveyFacade.GetSurveyAnswerResponse(ResponseID); SurveyAnswer = SurveyAnswerResponse.SurveyResponseList[0]; SurveyInfoModel surveyInfoModel = GetSurveyInfo(SurveyAnswer.SurveyId); // set the survey answer to be production or test SurveyAnswer.IsDraftMode = surveyInfoModel.IsDraftMode; XDocument xdoc = XDocument.Parse(surveyInfoModel.XML); // MvcDynamicForms.Form form = _isurveyFacade.GetSurveyFormData(SurveyAnswer.SurveyId, 1, SurveyAnswer, IsMobileDevice, "homeController"); MvcDynamicForms.Form form = _isurveyFacade.GetSurveyFormData(SurveyAnswer.SurveyId, 1, SurveyAnswer, IsMobileDevice, null); var _FieldsTypeIDs = from _FieldTypeID in xdoc.Descendants("Field") select _FieldTypeID; TempData["Width"] = form.Width + 100; XDocument xdocResponse = XDocument.Parse(SurveyAnswer.XML); XElement ViewElement = xdoc.XPathSelectElement("Template/Project/View"); string checkcode = ViewElement.Attribute("CheckCode").Value.ToString(); form.FormCheckCodeObj = form.GetCheckCodeObj(xdoc, xdocResponse, checkcode); ///////////////////////////// Execute - Record Before - start////////////////////// Dictionary <string, string> ContextDetailList = new Dictionary <string, string>(); EnterRule FunctionObject_B = (EnterRule)form.FormCheckCodeObj.GetCommand("level=record&event=before&identifier="); if (FunctionObject_B != null && !FunctionObject_B.IsNull()) { try { SurveyAnswer.XML = CreateResponseDocument(xdoc, SurveyAnswer.XML); form.RequiredFieldsList = this.RequiredList; FunctionObject_B.Context.HiddenFieldList = form.HiddenFieldsList; FunctionObject_B.Context.HighlightedFieldList = form.HighlightedFieldsList; FunctionObject_B.Context.DisabledFieldList = form.DisabledFieldsList; FunctionObject_B.Context.RequiredFieldList = form.RequiredFieldsList; FunctionObject_B.Execute(); // field list form.HiddenFieldsList = FunctionObject_B.Context.HiddenFieldList; form.HighlightedFieldsList = FunctionObject_B.Context.HighlightedFieldList; form.DisabledFieldsList = FunctionObject_B.Context.DisabledFieldList; form.RequiredFieldsList = FunctionObject_B.Context.RequiredFieldList; ContextDetailList = Epi.Web.MVC.Utility.SurveyHelper.GetContextDetailList(FunctionObject_B); form = Epi.Web.MVC.Utility.SurveyHelper.UpdateControlsValuesFromContext(form, ContextDetailList); SurveyAnswer.RecordBeforeFlag = true; _isurveyFacade.UpdateSurveyResponse(surveyInfoModel, ResponseID.ToString(), form, SurveyAnswer, false, false, 0); } catch (Exception ex) { // do nothing so that processing // can continue } } else { SurveyAnswer.XML = CreateResponseDocument(xdoc, SurveyAnswer.XML); form.RequiredFieldsList = RequiredList; _isurveyFacade.UpdateSurveyResponse(surveyInfoModel, SurveyAnswer.ResponseId, form, SurveyAnswer, false, false, 0); } SurveyAnswer = _isurveyFacade.GetSurveyAnswerResponse(SurveyAnswer.ResponseId).SurveyResponseList[0]; ///////////////////////////// Execute - Record Before - End////////////////////// //string page; // return RedirectToAction(Epi.Web.Models.Constants.Constant.INDEX, Epi.Web.Models.Constants.Constant.SURVEY_CONTROLLER, new {id="page" }); return(RedirectToAction(Epi.Web.MVC.Constants.Constant.INDEX, Epi.Web.MVC.Constants.Constant.SURVEY_CONTROLLER, new { responseid = ResponseID, PageNumber = 1 })); } catch (Exception ex) { Epi.Web.Utility.ExceptionMessage.SendLogMessage(ex, this.HttpContext); return(View(Epi.Web.MVC.Constants.Constant.EXCEPTION_PAGE)); } }
public ActionResult Index(string surveyId, string addNewFormId, string editForm) { // Assign "editForm" parameter to a less confusing name. // editForm contains the responseId of the record being edited. string editResponseId = editForm; bool isNewRecord; int orgId = GetIntSessionValue(UserSession.Key.CurrentOrgId); int userId = GetIntSessionValue(UserSession.Key.UserId); string userName = GetStringSessionValue(UserSession.Key.UserName); SetSessionValue(UserSession.Key.FormValuesHasChanged, string.Empty); var editResponseIdFromSession = GetStringSessionValue(UserSession.Key.EditResponseId); if (string.IsNullOrEmpty(editResponseId) && editResponseIdFromSession != null) { editResponseId = editResponseIdFromSession; } if (!string.IsNullOrEmpty(editResponseId) && string.IsNullOrEmpty(addNewFormId)) { // ------------------------------- // Edit Existing Record // ------------------------------- isNewRecord = false; SetSessionValue(UserSession.Key.RootResponseId, editResponseId); SetSessionValue(UserSession.Key.IsEditMode, true); SurveyAnswerDTO surveyAnswerDTO = GetSurveyAnswer(editResponseId, GetStringSessionValue(UserSession.Key.RootFormId)); SetSessionValue(UserSession.Key.RequestedViewId, surveyAnswerDTO.ViewId); surveyAnswerDTO.RecoverLastRecordVersion = GetBoolSessionValue(UserSession.Key.RecoverLastRecordVersion); RemoveSessionValue(UserSession.Key.RecoverLastRecordVersion); return(RedirectToAction(ViewActions.Index, ControllerNames.Survey, new { responseid = editResponseId, PageNumber = 1, surveyid = surveyAnswerDTO.SurveyId, Edit = "Edit" })); } // ------------------------------- // Add New Record // ------------------------------- isNewRecord = true; SetSessionValue(UserSession.Key.IsEditMode, false); bool isMobileDevice = this.Request.Browser.IsMobileDevice; if (isMobileDevice == false) { isMobileDevice = Epi.Cloud.MVC.Utility.SurveyHelper.IsMobileDevice(this.Request.UserAgent.ToString()); } FormsAuthentication.SetAuthCookie("BeginSurvey", false); //create the responseid Guid responseId = Guid.NewGuid(); TempData[TempDataKeys.ResponseId] = responseId.ToString(); // create the first survey response // Epi.Cloud.Common.DTO.SurveyAnswerDTO SurveyAnswer = _isurveyFacade.CreateSurveyAnswer(surveyModel.SurveyId, ResponseID.ToString()); SetSessionValue(UserSession.Key.RootFormId, addNewFormId); var rootResponseId = responseId; SetSessionValue(UserSession.Key.RootResponseId, rootResponseId); var responseContext = InitializeResponseContext(formId: addNewFormId, responseId: responseId.ToString(), isNewRecord: true) as ResponseContext; SurveyAnswerDTO surveyAnswer = _surveyFacade.CreateSurveyAnswer(responseContext); surveyId = /*FromURL*/ surveyId ?? surveyAnswer.SurveyId; // Initialize the Metadata Accessor MetadataAccessor.CurrentFormId = surveyId; MvcDynamicForms.Form form = _surveyFacade.GetSurveyFormData(surveyAnswer.SurveyId, 1, surveyAnswer, isMobileDevice); SurveyInfoModel surveyInfoModel = form.SurveyInfo.ToFormInfoModel(); MetadataAccessor metadataAccessor = form.SurveyInfo as MetadataAccessor; // set the survey answer to be production or test surveyAnswer.IsDraftMode = form.SurveyInfo.IsDraftMode; TempData[TempDataKeys.Width] = form.Width + 100; string checkcode = MetadataAccessor.GetFormDigest(surveyId).CheckCode; form.FormCheckCodeObj = form.GetCheckCodeObj(metadataAccessor.GetFieldDigests(surveyId), surveyAnswer.ResponseDetail, checkcode); ///////////////////////////// Execute - Record Before - start////////////////////// Dictionary <string, string> contextDetailList = new Dictionary <string, string>(); EnterRule functionObject_B = (EnterRule)form.FormCheckCodeObj.GetCommand("level=record&event=before&identifier="); SurveyResponseBuilder surveyResponseBuilder = new SurveyResponseBuilder(_requiredList); if (functionObject_B != null && !functionObject_B.IsNull()) { try { PageDigest[] pageDigests = form.MetadataAccessor.GetCurrentFormPageDigests(); var responseDetail = surveyAnswer.ResponseDetail; responseDetail = surveyResponseBuilder.CreateResponseDocument(responseContext, pageDigests); SetSessionValue(UserSession.Key.RequiredList, surveyResponseBuilder.RequiredList); _requiredList = surveyResponseBuilder.RequiredList; form.RequiredFieldsList = _requiredList; functionObject_B.Context.HiddenFieldList = form.HiddenFieldsList; functionObject_B.Context.HighlightedFieldList = form.HighlightedFieldsList; functionObject_B.Context.DisabledFieldList = form.DisabledFieldsList; functionObject_B.Context.RequiredFieldList = form.RequiredFieldsList; functionObject_B.Execute(); // field list form.HiddenFieldsList = functionObject_B.Context.HiddenFieldList; form.HighlightedFieldsList = functionObject_B.Context.HighlightedFieldList; form.DisabledFieldsList = functionObject_B.Context.DisabledFieldList; form.RequiredFieldsList = functionObject_B.Context.RequiredFieldList; contextDetailList = Epi.Cloud.MVC.Utility.SurveyHelper.GetContextDetailList(functionObject_B); form = Epi.Cloud.MVC.Utility.SurveyHelper.UpdateControlsValuesFromContext(form, contextDetailList); _surveyFacade.UpdateSurveyResponse(surveyInfoModel, responseId.ToString(), form, surveyAnswer, false, false, 0, orgId, userId, userName); } catch (Exception ex) { // do nothing so that processing // can continue } } else { PageDigest[] pageDigestArray = metadataAccessor.GetPageDigests(surveyInfoModel.SurveyId); surveyAnswer.ResponseDetail = surveyResponseBuilder.CreateResponseDocument(responseContext, pageDigestArray); _requiredList = surveyResponseBuilder.RequiredList; SetSessionValue(UserSession.Key.RequiredList, surveyResponseBuilder.RequiredList); form.RequiredFieldsList = _requiredList; } ///////////////////////////// Execute - Record Before - End////////////////////// return(RedirectToAction(ViewActions.Index, ControllerNames.Survey, new { responseid = responseId, PageNumber = 1, surveyid = surveyInfoModel.SurveyId })); }
/// <summary> ///executes CheckCodeBlock statement /// </summary> /// <returns>object</returns> public override object Execute() { CheckCodeBlock.Execute(); return(null); }
public ActionResult Index(string surveyId, string addNewFormId, string editForm, string cancel) { // Assign "editForm" parameter to a less confusing name. // editForm contains the responseId of the record being edited. string editResponseId = editForm; int userId = GetIntSessionValue(UserSession.Key.UserId); string userName = GetStringSessionValue(UserSession.Key.UserName); bool isMobileDevice = this.Request.Browser.IsMobileDevice; FormsAuthentication.SetAuthCookie("BeginSurvey", false); bool isEditMode = false; if (isMobileDevice == true) { isMobileDevice = Epi.Cloud.MVC.Utility.SurveyHelper.IsMobileDevice(this.Request.UserAgent.ToString()); } bool isAndroid = this.Request.UserAgent.IndexOf("Android", StringComparison.OrdinalIgnoreCase) >= 0; if (!string.IsNullOrEmpty(/*FromURL*/ cancel)) { int pageNumber; int.TryParse(/*FromURL*/ cancel, out pageNumber); Dictionary <string, int> surveyPagesList = GetSessionValue <Dictionary <string, int> >(UserSession.Key.RelateButtonPageId); if (surveyPagesList != null) { pageNumber = surveyPagesList[this.Request.Form["Parent_Response_Id"].ToString()]; } return(RedirectToRoute(new { Controller = "Survey", Action = "Index", responseid = this.Request.Form["Parent_Response_Id"].ToString(), PageNumber = pageNumber })); } if (string.IsNullOrEmpty(/*FromURL*/ editResponseId) && string.IsNullOrEmpty(/*FromURL*/ addNewFormId) && !IsSessionValueNull(UserSession.Key.EditResponseId)) { editResponseId = GetStringSessionValue(UserSession.Key.EditResponseId); } if (!string.IsNullOrEmpty(editResponseId)) { if (IsSessionValueNull(UserSession.Key.RootResponseId)) { SetSessionValue(UserSession.Key.RootResponseId, editResponseId); } isEditMode = true; SetSessionValue(UserSession.Key.IsEditMode, isEditMode); SurveyAnswerDTO surveyAnswer = GetSurveyAnswer(editResponseId, GetStringSessionValue(UserSession.Key.RootFormId)); if (!IsSessionValueNull(UserSession.Key.RecoverLastRecordVersion)) { surveyAnswer.RecoverLastRecordVersion = GetBoolSessionValue(UserSession.Key.RecoverLastRecordVersion); } // string childRecordId = GetChildRecordId(surveyAnswer); //return RedirectToAction(ViewActions.Index, ControllerNames.Survey, new { responseid = surveyAnswer.ParentResponseId, PageNumber = 1, Edit = "Edit" }); return(RedirectToAction(ViewActions.Index, ControllerNames.Survey, new { responseid = editResponseId, PageNumber = 1, Edit = "Edit" })); } //create the responseid Guid responseId = Guid.NewGuid(); if (IsSessionValueNull(UserSession.Key.RootResponseId)) { SetSessionValue(UserSession.Key.RootResponseId, responseId); } var rootResponseId = GetStringSessionValue(UserSession.Key.RootResponseId); TempData[TempDataKeys.ResponseId] = responseId.ToString(); int orgId = GetIntSessionValue(UserSession.Key.CurrentOrgId); var responseContext = InitializeResponseContext(formId: /*FromURL*/ addNewFormId, responseId: responseId.ToString(), parentResponseId: this.Request.Form["Parent_Response_Id"].ToString(), isNewRecord: !isEditMode); // create the first survey response SurveyAnswerDTO surveyAnswerDTO = _surveyFacade.CreateSurveyAnswer(responseContext); List <FormsHierarchyDTO> formsHierarchy = GetFormsHierarchy(); SurveyInfoModel surveyInfoModel = GetSurveyInfo(surveyAnswerDTO.SurveyId, formsHierarchy); MetadataAccessor metadataAccessor = surveyInfoModel as MetadataAccessor; // set the survey answer to be production or test surveyAnswerDTO.IsDraftMode = surveyInfoModel.IsDraftMode; MvcDynamicForms.Form form = _surveyFacade.GetSurveyFormData(surveyAnswerDTO.SurveyId, 1, surveyAnswerDTO, isMobileDevice, null, formsHierarchy, isAndroid); TempData[TempDataKeys.Width] = form.Width + 100; var formDigest = metadataAccessor.GetFormDigest(surveyAnswerDTO.SurveyId); string checkcode = formDigest.CheckCode; FormResponseDetail responseDetail = surveyAnswerDTO.ResponseDetail; form.FormCheckCodeObj = form.GetCheckCodeObj(MetadataAccessor.GetFieldDigests(surveyAnswerDTO.SurveyId), responseDetail, checkcode); ///////////////////////////// Execute - Record Before - start////////////////////// Dictionary <string, string> ContextDetailList = new Dictionary <string, string>(); EnterRule functionObject_B = (EnterRule)form.FormCheckCodeObj.GetCommand("level=record&event=before&identifier="); SurveyResponseBuilder surveyResponseBuilder = new SurveyResponseBuilder(_requiredList); if (functionObject_B != null && !functionObject_B.IsNull()) { try { PageDigest[] pageDigests = form.MetadataAccessor.GetCurrentFormPageDigests(); responseDetail = surveyResponseBuilder.CreateResponseDocument(responseContext, pageDigests); SetSessionValue(UserSession.Key.RequiredList, surveyResponseBuilder.RequiredList); _requiredList = surveyResponseBuilder.RequiredList; form.RequiredFieldsList = _requiredList; functionObject_B.Context.HiddenFieldList = form.HiddenFieldsList; functionObject_B.Context.HighlightedFieldList = form.HighlightedFieldsList; functionObject_B.Context.DisabledFieldList = form.DisabledFieldsList; functionObject_B.Context.RequiredFieldList = form.RequiredFieldsList; functionObject_B.Execute(); // field list form.HiddenFieldsList = functionObject_B.Context.HiddenFieldList; form.HighlightedFieldsList = functionObject_B.Context.HighlightedFieldList; form.DisabledFieldsList = functionObject_B.Context.DisabledFieldList; form.RequiredFieldsList = functionObject_B.Context.RequiredFieldList; ContextDetailList = SurveyHelper.GetContextDetailList(functionObject_B); form = SurveyHelper.UpdateControlsValuesFromContext(form, ContextDetailList); _surveyFacade.UpdateSurveyResponse(surveyInfoModel, responseId.ToString(), form, surveyAnswerDTO, false, false, 0, orgId, userId, userName); } catch (Exception ex) { // do nothing so that processing // can continue } } else { PageDigest[] pageDigestArray = form.MetadataAccessor.GetCurrentFormPageDigests();// metadataAccessor.GetPageDigests(surveyInfoModel.SurveyId); surveyAnswerDTO.ResponseDetail = surveyResponseBuilder.CreateResponseDocument(responseContext, pageDigestArray); _requiredList = surveyResponseBuilder.RequiredList; SetSessionValue(UserSession.Key.RequiredList, _requiredList); form.RequiredFieldsList = _requiredList; _surveyFacade.UpdateSurveyResponse(surveyInfoModel, surveyAnswerDTO.ResponseId, form, surveyAnswerDTO, false, false, 0, orgId, userId, userName); } surveyAnswerDTO = (SurveyAnswerDTO)formsHierarchy.SelectMany(x => x.ResponseIds).FirstOrDefault(z => z.ResponseId == surveyAnswerDTO.ResponseId); ///////////////////////////// Execute - Record Before - End////////////////////// return(RedirectToAction(ViewActions.Index, ControllerNames.Survey, new { responseid = responseId, PageNumber = 1 })); }