/// <summary>
        /// this method set HtmlElement to ColumnHtml and RowHtml and FormHtml
        /// </summary>
        /// <param name="_helper">if set null it does not fill element values.</param>
        public FormHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId)
        {
            if (dynamicFormId != Guid.Empty && _helper?.UnitOfWork != null && this.Helper?.FormAction != HtmlElementHelperModel.e_FormAction.FillMode)
            {
                sysBpmsDynamicForm dynamicForm = _helper?.UnitOfWork.Repository <IDynamicFormRepository>().GetInfo(dynamicFormId);
                if (dynamicForm != null)
                {
                    //If It is ApplicationPage,It must set ApplicationPageID To current ApplicationPageID for DataManageHelper and DocumentEngine
                    //to retrieve variables for current form
                    Guid?parentAppPageID = _helper.DataManageHelper.GetSharedModel().CurrentApplicationPageID;
                    if (dynamicForm.ApplicationPageID.HasValue)
                    {
                        _helper.DataManageHelper.SetApplicationPageID(dynamicForm.ApplicationPageID.Value);
                        _helper.DocumentEngine.SetApplicationPageID(dynamicForm.ApplicationPageID.Value);
                    }

                    isFormReadOnly = !isFormReadOnly ? (obj["readOnly"] != null ? ((bool)obj["readOnly"]) : false) : true;
                    //convert form xml code to json object
                    JObject newObj = JObject.Parse(dynamicForm.DesignJson);
                    //if json object has a control with type = CONTENT
                    if (newObj != null && newObj["type"].ToString() == "CONTENT")
                    {
                        this.ContentHtml = new ContentHtml(newObj, _helper, dynamicFormId, isFormReadOnly);
                    }
                    base.Helper?.AddScript(dynamicForm.ConfigXmlModel.OnLoadFunctionBody);
                    base.Helper?.AddStyleSheet(dynamicForm.ConfigXmlModel.StyleSheetCode);
                    this.IsFormReadOnly = isFormReadOnly;

                    //If It is ApplicationPage,It must restore ApplicationPageID To parent form for DataManageHelper and DocumentEngine
                    if (dynamicForm.ApplicationPageID.HasValue)
                    {
                        _helper.DataManageHelper.SetApplicationPageID(parentAppPageID.Value);
                        _helper.DocumentEngine.SetApplicationPageID(parentAppPageID.Value);
                    }
                }
            }
        }
 public FormModel(JObject obj, HtmlElementHelperModel helper, List <sysBpmsStep> listStep, sysBpmsStep currentStep, sysBpmsDynamicForm dynamicForm, bool isFormReadOnly)
 {
     helper?.AddScript(dynamicForm?.ConfigXmlModel.OnLoadFunctionBody);
     helper?.AddStyleSheet(dynamicForm?.ConfigXmlModel.StyleSheetCode);
     this.ContentHtml = new ContentHtml(obj, helper, dynamicForm.ID, isFormReadOnly);
     if (helper?.FormAction == HtmlElementHelperModel.e_FormAction.Onload ||
         helper?.FormAction == HtmlElementHelperModel.e_FormAction.Preview)
     {
         this.FillDependentControls();
     }
     this.SetParams(listStep, currentStep);
     this.FormName        = dynamicForm?.Name ?? string.Empty;
     this.IsFormReadOnly  = isFormReadOnly;
     this.IsEncrypted     = helper.IsEncrypted;
     this.DynamicFormID   = dynamicForm?.ID ?? Guid.Empty;
     this.ResultOperation = helper?.ResultOperation ?? new ResultOperation();
     this.ContentHtml.CheckAllVisibility(this);
 }