public object GetDynamicFormOnloadJavaCode(Guid DynamicFormId)
        {
            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                JavaScriptDesignCodeDTO codeVM = new JavaScriptDesignCodeDTO()
                {
                    Code              = dynamicFormService.GetInfo(DynamicFormId).ConfigXmlModel?.OnLoadFunctionBody ?? string.Empty,
                    CallBack          = null,
                    GetControls       = dynamicFormService.GetControls(dynamicFormService.GetInfo(DynamicFormId)).Select(c => new QueryModel(c.Key, c.Value)).ToList(),
                    GetAllJavaMethods = DesignCodeUtility.GetAllJavaMethods().Select(c => new QueryModel(c, c)).ToList(),
                };

                return(codeVM);
            }
        }
        public bool GetConfirmResult(string controlId, Guid formId, bool isGridCommand, string gridId = "", Guid?threadId = null, Guid?applicationPageId = null)
        {
            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(formId);
                object             control     = dynamicForm.FindControl(isGridCommand ? gridId : controlId);
                DesignCodeModel    designCode  = null;

                if (control is ButtonHtml)
                {
                    designCode = ((ButtonHtml)control).ConfirmDesignCodeModel;
                }

                if (control is DataGridHtml)
                {
                    designCode = ((DataGridHtml)control).GetConfirmCode(controlId);
                }

                EngineSharedModel engineSharedModel = applicationPageId.HasValue ?
                                                      new EngineSharedModel(applicationPageId.Value, HttpContext.Current.Request.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId) :
                                                      new EngineSharedModel(threadId, dynamicForm.ProcessId, HttpContext.Current.Request.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId);
                UnitOfWork unitOfWork = new UnitOfWork();
                return(new DynamicCodeEngine(engineSharedModel, unitOfWork).ExecuteBooleanCode(designCode));
            }
        }
        public object ExecuteCode(string controlId, Guid formId, string commandId, Guid?threadId = null, Guid?applicationPageId = null)
        {
            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(formId);
                object             control     = dynamicForm.FindControl(controlId);
                DesignCodeModel    designCode  = null;
                if (control is DataGridHtml)
                {
                    designCode = ((DataGridHtml)control).GetCommandCode(commandId);
                }

                EngineSharedModel engineSharedModel = applicationPageId.HasValue ?
                                                      new EngineSharedModel(applicationPageId.Value, HttpContext.Current.Request.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId) :
                                                      new EngineSharedModel(threadId, dynamicForm.ProcessId, HttpContext.Current.Request.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId);
                UnitOfWork        unitOfWork        = new UnitOfWork();
                DynamicCodeEngine dynamicCodeEngine = new DynamicCodeEngine(engineSharedModel, unitOfWork);
                var result = dynamicCodeEngine.ExecuteScriptCode(designCode, new CodeBaseSharedModel(null));
                //If in code any variable is set, it Will save them all at the end
                dynamicCodeEngine.SaveExternalVariable(result);

                return(new
                {
                    result = result?.Result,
                    listMessage = result?.CodeBaseShared.MessageList.Select(c => new
                    {
                        DisplayMessageType = c.DisplayMessageType.ToString(),
                        c.Message
                    })
                });
            }
        }
        public object PostLoadEmailForm(PostLoadEmailFormDTO model)
        {
            Guid?        dynamicFormId = model.DynamicFormId.ToGuidObjNull();
            DCEmailModel designCode    = null;

            if (!string.IsNullOrWhiteSpace(model.XmlB64Model))
            {
                designCode = DesignCodeUtility.GetObjectOfDesignCode <DCEmailModel>(model.XmlB64Model.ToStringObj().FromBase64());

                designCode.IsOutputYes = model.IsOutputYes;
            }
            else
            {
                designCode = new DCEmailModel(Guid.NewGuid().ToString(), "Email", model.ShapeId.ToStringObj(),
                                              model.ParentShapeId.ToStringObj(), model.IsOutputYes, model.IsFirst.ToBoolObj(), string.Empty, Guid.Empty, "", "", "");
            }

            using (DynamicFormService dynamicFormService = new DynamicFormService())
                using (EmailAccountService emailAccountService = new EmailAccountService())
                    return new
                           {
                               ListEmailAccounts = emailAccountService.GetList((int)sysBpmsEmailAccount.e_ObjectTypeLU.Systemic, null, null).Select(c => new QueryModel(c.ID.ToString(), c.Email)).ToList(),
                               DynamicFormId     = dynamicFormId,
                               ProcessControls   = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                                   dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                               Model = designCode
                           };
        }
        public object PostLoadSqlFunctionForm(PostLoadSqlFunctionFormDTO model)
        {
            Guid?dynamicFormId            = model.DynamicFormId.ToGuidObjNull();
            DCSqlFunctionModel designCode = null;

            if (!string.IsNullOrWhiteSpace(model.XmlB64Model))
            {
                designCode = DesignCodeUtility.GetObjectOfDesignCode <DCSqlFunctionModel>(model.XmlB64Model.ToStringObj().FromBase64());

                designCode.IsOutputYes = model.IsOutputYes;
            }
            else
            {
                designCode = new DCSqlFunctionModel(Guid.NewGuid().ToString(), "Sql Query", string.Empty, string.Empty
                                                    , model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(),
                                                    model.IsOutputYes, null, model.IsFirst.ToBoolObj(), string.Empty);
            }

            using (DynamicFormService dynamicFormService = new DynamicFormService())
                return new
                       {
                           ListMethodTypes = EnumObjHelper.GetEnumList <DCSqlFunctionModel.e_MethodType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                           DynamicFormId   = dynamicFormId,
                           ProcessControls = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                             dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                           Model = designCode
                       };
        }
Exemplo n.º 6
0
        public object PostEditApplicationPage(PostEditApplicationPageDTO model)
        {
            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(model.DynamicFormDTO.ID);
                dynamicForm.Update(null, model.DynamicFormDTO.ApplicationPageID, model.DynamicFormDTO.Name, model.DynamicFormDTO.Version, model.DynamicFormDTO.ShowInOverview);

                DynamicFormConfigXmlModel configXmlModel = dynamicForm.ConfigXmlModel;
                configXmlModel.IsEncrypted = model.DynamicFormDTO.IsEncrypted;
                dynamicForm.Update(configXmlModel);

                dynamicFormService.Update(dynamicForm, base.userName);

                using (ApplicationPageService applicationPageService = new ApplicationPageService())
                {
                    sysBpmsApplicationPage applicationPage = applicationPageService.GetInfo(model.DynamicFormDTO.ApplicationPageID.Value);
                    applicationPage.Update(model.DynamicFormDTO.ApplicationPageDTO.GroupLU, model.DynamicFormDTO.ApplicationPageDTO.Description, model.DynamicFormDTO.ApplicationPageDTO.ShowInMenu);
                    applicationPageService.Update(applicationPage);

                    using (ApplicationPageAccessService applicationPageAccessService = new ApplicationPageAccessService())
                    {
                        List <sysBpmsApplicationPageAccess> newApplicationPageAccess =
                            (model.listRole ?? new List <ApplicationPageAccessDTO>()).Select(c => new sysBpmsApplicationPageAccess().Update(c.ID, model.DynamicFormDTO.ApplicationPageID.Value, c.DepartmentID, c.RoleLU, c.UserID, c.AllowAdd, c.AllowEdit, c.AllowDelete, c.AllowView)).ToList()
                            .Union((model.listUser ?? new List <ApplicationPageAccessDTO>()).Select(c => new sysBpmsApplicationPageAccess().Update(c.ID, model.DynamicFormDTO.ApplicationPageID.Value, c.DepartmentID, c.RoleLU, c.UserID, c.AllowAdd, c.AllowEdit, c.AllowDelete, c.AllowView))).ToList();
                        applicationPageAccessService.AddEdit(applicationPage.ID, newApplicationPageAccess);
                    }
                }
            }
            return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success));
        }
        public object PostLoadConditionForm(PostLoadConditionFormDTO model)
        {
            Guid?            dynamicFormId = model.DynamicFormId.ToGuidObjNull();
            DCConditionModel designCode;

            if (!string.IsNullOrWhiteSpace(model.Data))
            {
                designCode = DesignCodeUtility.GetObjectOfDesignCode <DCConditionModel>(model.Data.ToStringObj().FromBase64());

                designCode.IsOutputYes = model.IsOutputYes.ToBoolObjNull();
                if (string.IsNullOrWhiteSpace(designCode.FuncName))
                {
                    designCode.FuncName = DesignCodeUtility.GetFunctionName(designCode.ShapeID);
                }
            }
            else
            {
                designCode = new DCConditionModel(Guid.NewGuid().ToString(), model.Name.ToStringObj(),
                                                  model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(),
                                                  model.IsOutputYes.ToBoolObjNull(), new List <DCRowConditionModel>(), model.IsFirst.ToBoolObj(), null);
            }

            using (VariableService variableService = new VariableService())
                using (DynamicFormService dynamicFormService = new DynamicFormService())
                    return new
                           {
                               ProcessControls = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                                 dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                               ListOperationTypes = EnumObjHelper.GetEnumList <DCRowConditionModel.e_OperationType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                               Model = designCode
                           };
        }
        public object PostLoadCallMethodForm(PostLoadCallMethodFormDTO model)
        {
            Guid?dynamicFormId = model.DynamicFormId.ToGuidObjNull();

            DCCallMethodModel designCode = null;

            if (!string.IsNullOrWhiteSpace(model.XmlB64Model.ToStringObj()))
            {
                designCode = DesignCodeUtility.GetObjectOfDesignCode <DCCallMethodModel>(model.XmlB64Model.ToStringObj().FromBase64());

                designCode.IsOutputYes = model.IsOutputYes;
            }
            else
            {
                designCode = new DCCallMethodModel(Guid.NewGuid().ToString(), string.Empty, model.ShapeId.ToStringObj(),
                                                   model.ParentShapeId.ToStringObj(), model.IsOutputYes, model.IsFirst, model.DefaultMethodID,
                                                   model.DefaultMethodGroupType);
            }
            using (DynamicFormService dynamicFormService = new DynamicFormService())
                return new
                       {
                           DynamicFormId   = dynamicFormId,
                           ProcessControls = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                             dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                           Model = designCode
                       };
        }
Exemplo n.º 9
0
 public object GetAddEditFormDesign(Guid?ID = null)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         DynamicFormDTO dynamicFormDTO = new DynamicFormDTO(ID.HasValue ? dynamicFormService.GetInfo(ID.Value) :
                                                            dynamicFormService.GetInfoByPageID(base.ApplicationPageId.Value));
         if (dynamicFormDTO != null)
         {
             using (VariableService variableService = new VariableService())
                 return(Json(new
                 {
                     //it is used in dataGrid seting for binging form to openForm Column Item Type.
                     ProcessForms = dynamicFormService.GetList(dynamicFormDTO.ProcessId, null, base.ApplicationPageId.HasValue, string.Empty, null, null).Select(c => new { value = c.ID, text = c.Name }).ToList(),
                     //it is used for binding variable of entity type to fileupload controls.
                     EntityVariables = variableService.GetList(dynamicFormDTO.ProcessId, base.ApplicationPageId, (int)sysBpmsVariable.e_VarTypeLU.Object, "", null, true).Select(c => new { text = c.Name, value = c.ID }).ToList(),
                     //it is used for binding variable of list type to list controls like dropdownlist or checkboxlist and uploader.
                     ListVariables = variableService.GetList(dynamicFormDTO.ProcessId, base.ApplicationPageId, (int)sysBpmsVariable.e_VarTypeLU.List, "", null, true).Select(c => new { text = c.Name, value = c.Name }).ToList(),
                     Model = dynamicFormDTO
                 }));
         }
         else
         {
             return(new PostMethodMessage(SharedLang.Get("NotFound.Text"), DisplayMessageType.error));
         }
     }
 }
Exemplo n.º 10
0
 public object PostAddEditFormDesign(PostAddEditFormDesignDTO model)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(model.DynamicFormId);
         if (dynamicForm != null)
         {
             ResultOperation resultOperation = dynamicForm.Update(model.DesignJson);
             if (!resultOperation.IsSuccess)
             {
                 return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
             }
             resultOperation = dynamicFormService.GetSourceCode(dynamicForm);
             if (!resultOperation.IsSuccess)
             {
                 return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
             }
             resultOperation = dynamicFormService.Update(dynamicForm, base.userName);
             if (resultOperation.IsSuccess)
             {
                 return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success));
             }
             else
             {
                 return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
             }
         }
         else
         {
             return(new PostMethodMessage(SharedLang.Get("NotFound.Text"), DisplayMessageType.error));
         }
     }
 }
 public DynamicFormDTO GetInfo(Guid Id)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         return(new DynamicFormDTO(dynamicFormService.GetInfo(Id)));
     }
 }
Exemplo n.º 12
0
        public object GetPopUp(Guid formID)
        {
            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                sysBpmsDynamicForm dynamicForm      = dynamicFormService.GetInfo(formID);
                Guid applicationId                  = dynamicForm.ApplicationPageID.Value;
                EngineSharedModel engineSharedModel = new EngineSharedModel(applicationId, base.MyRequest.GetList(this.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId);
                using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(engineSharedModel))
                {
                    GetFormResponseModel responseVM = applicationPageEngine.GetForm();
                    if (responseVM.EngineFormModel != null)
                    {
                        string popUpUrl = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, nameof(CartablePageController.GetPopUp), nameof(CartablePageController), "");
                        string postUrl  = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, nameof(CartablePageController.PostPopUp), nameof(CartablePageController), "", UrlUtility.GetParamsAsArray(new HttpRequestWrapper(base.MyRequest), new string[] { $"applicationPageId={applicationId}" }).ToArray());
                        responseVM.EngineFormModel.SetUrls(popUpUrl, postUrl, new HttpRequestWrapper(base.MyRequest), base.PortalSettings.DefaultPortalAlias, FormTokenUtility.GetFormToken(base.ApiSessionId, responseVM?.EngineFormModel?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, responseVM?.EngineFormModel?.FormModel?.IsEncrypted ?? false));
                    }

                    return(new
                    {
                        Model = responseVM?.EngineFormModel,
                        MessageList = responseVM?.ListMessageModel.Select(c => new PostMethodMessage(c.Message, c.DisplayMessageType)),
                        RedirectUrl = base.GetRedirectUrl(responseVM?.RedirectUrlModel),
                        Result = true,
                    });
                }
            }
        }
Exemplo n.º 13
0
        public ActionResult Settings()
        {
            var settings = new SingleActionSettingDTO(base.PortalSettings.PortalId, ModuleContext.Configuration.ModuleSettings);

            try
            {
                if (!string.IsNullOrWhiteSpace(settings.WebApiAddress))
                {
                    settings.ProcessName        = settings.ProcessID.HasValue ? new EngineProcessProxy(settings.WebApiAddress, settings.WebServicePass, base.User.Username, ApiUtility.GetIPAddress(), base.Session.SessionID, false).GetInfo(settings.ProcessID.Value)?.Name : "";
                    settings.ProcessEndFormName = settings.ProcessEndFormID.HasValue ? new EngineFormProxy(settings.WebApiAddress, settings.WebServicePass, base.User.Username, ApiUtility.GetIPAddress(), base.Session.SessionID, false).GetInfo(settings.ProcessEndFormID.Value)?.Name : "";;
                    settings.ApplicationName    = settings.ApplicationPageID.HasValue ? new EngineApplicationProxy(settings.WebApiAddress, settings.WebServicePass, base.User.Username, ApiUtility.GetIPAddress(), base.Session.SessionID, false).GetInfo(settings.ApplicationPageID.Value)?.Name : "";
                }
                else
                {
                    if (settings.ProcessID.HasValue)
                    {
                        using (ProcessService processService = new ProcessService())
                            settings.ProcessName = processService.GetInfo(settings.ProcessID.Value).Name;
                    }

                    if (settings.ProcessEndFormID.HasValue)
                    {
                        using (DynamicFormService dynamicFormService = new DynamicFormService())
                            settings.ProcessEndFormName = dynamicFormService.GetInfo(settings.ProcessEndFormID.Value).Name;
                    }

                    if (settings.ApplicationPageID.HasValue)
                    {
                        using (DynamicFormService dynamicFormService = new DynamicFormService())
                            settings.ApplicationName = dynamicFormService.GetInfoByPageID(settings.ApplicationPageID.Value).Name;
                    }
                }
                if (string.IsNullOrWhiteSpace(settings.ApplicationName) && string.IsNullOrWhiteSpace(settings.ProcessName))
                {
                    settings.ProcessID         = null;
                    settings.ApplicationPageID = null;
                }
            }
            catch
            {
            }

            if (!string.IsNullOrWhiteSpace(settings.WebApiAddress))
            {
                ViewBag.ApplicationPageUrl = ApiUtility.GetGeneralApiUrl(base.Request, base.ModuleContext.TabModuleId, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineApplication", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false), true);
                ViewBag.ProcessFormUrl     = ApiUtility.GetGeneralApiUrl(base.Request, base.ModuleContext.TabModuleId, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineForm", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false), true);
                ViewBag.ProcessUrl         = ApiUtility.GetGeneralApiUrl(base.Request, base.ModuleContext.TabModuleId, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineProcess", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false), true);
            }
            else
            {
                ViewBag.ApplicationPageUrl = UrlUtility.GetApiUrl(base.Request, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineApplication", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false));
                ViewBag.ProcessFormUrl     = UrlUtility.GetApiUrl(base.Request, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineForm", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false));
                ViewBag.ProcessUrl         = UrlUtility.GetApiUrl(base.Request, base.PortalSettings.DefaultPortalAlias, "GetList", "EngineProcess", FormTokenUtility.GetFormToken(base.Session.SessionID, Guid.Empty, false));
            }

            ViewBag.Url = base.ActivePage.FullUrl + "/controller/Settings/action/UpdatePass";
            return(View(settings));
        }
 public object GetJavaScriptIndex([System.Web.Http.FromUri] JavaScriptDesignCodeDTO codeVM)
 {
     if (codeVM != null && codeVM.Code.ToStringObj().ToLower().Trim() == "null")
     {
         codeVM.Code = string.Empty;
     }
     using (DynamicFormService dynamicFormService = new DynamicFormService())
         codeVM.GetControls = dynamicFormService.GetControls(dynamicFormService.GetInfo(codeVM.DynamicFormId)).Select(c => new QueryModel(c.Key, c.Value)).ToList();
     codeVM.GetAllJavaMethods = DesignCodeUtility.GetAllJavaMethods().Select(c => new QueryModel(c, c)).ToList();
     return(codeVM);
 }
Exemplo n.º 15
0
 public object GetAddEditStyleSheet(Guid DynamicFormId)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(DynamicFormId);
         return(Json(new
         {
             StyleCode = dynamicForm.ConfigXmlModel.StyleSheetCode.ToStringObj(),
             DynamicFormId
         }));
     }
 }
 public GetFormResponseModel GetForm(Guid?applicationPageId = null, Guid?formID = null)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         applicationPageId = applicationPageId ?? dynamicFormService.GetInfo(formID.Value).ApplicationPageID;
         List <QueryModel> baseQueryModel = base.MyRequest.GetList(base.IsEncrypted, base.ApiSessionId).ToList();
         using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(new EngineSharedModel(applicationPageId.Value, baseQueryModel, base.ClientUserName, base.ApiSessionId)))
         {
             return(applicationPageEngine.GetForm());
         }
     }
 }
 public object GetValue(Guid formId, string controlId, Guid?threadId = null)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         sysBpmsDynamicForm dynamicForm       = dynamicFormService.GetInfo(formId);
         BindingElementBase control           = (BindingElementBase)dynamicForm.FindControl(controlId);
         EngineSharedModel  engineSharedModel = dynamicForm.ProcessId.HasValue ?
                                                new EngineSharedModel(threadId, dynamicForm.ProcessId, base.MyRequest.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId) :
                                                new EngineSharedModel(dynamicForm.ApplicationPageID.Value, base.MyRequest.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId);
         UnitOfWork unitOfWork = new UnitOfWork();
         control.Helper = HtmlElementHelper.MakeModel(engineSharedModel, unitOfWork, HtmlElementHelperModel.e_FormAction.Onload, dynamicForm);
         control.FillData();
         return((control.Type == "HTMLCODE" || control.Type == "TITLE") ? control.Label : control.Value);
     }
 }
Exemplo n.º 18
0
 public object GetAddEdit(Guid?ID = null)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         DynamicFormDTO dynamicFormDTO = ID.HasValue ? new DynamicFormDTO(dynamicFormService.GetInfo(ID.Value)) : new DynamicFormDTO();
         dynamicFormDTO.ProcessId = base.ProcessId;
         if (!dynamicFormDTO.ProcessId.HasValue)
         {
             using (LURowService luRowService = new LURowService())
             {
                 dynamicFormDTO.ApplicationPageDTO             = new ApplicationPageDTO();
                 dynamicFormDTO.ApplicationPageDTO.ListGroupLU = luRowService.GetList(sysBpmsLUTable.e_LUTable.ApplicationPageGroupLU.ToString()).Select(c => new LURowDTO(c)).ToList();
             }
         }
         return(dynamicFormDTO);
     }
 }
Exemplo n.º 19
0
        public object PostAddEditStyleSheet(PostAddEditStyleSheetDTO model)
        {
            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                sysBpmsDynamicForm dynamicForm = dynamicFormService.GetInfo(model.DynamicFormId);

                DynamicFormConfigXmlModel configXmlModel = dynamicForm.ConfigXmlModel;
                configXmlModel.StyleSheetCode = model.StyleCode;
                dynamicForm.Update(configXmlModel);
                ResultOperation resultOperation = dynamicFormService.Update(dynamicForm, base.userName);

                if (!resultOperation.IsSuccess)
                {
                    return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
                }

                return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success));
            }
        }
        public object GetDynamicFormCode(string CallBack, Guid DynamicFormId, bool IsOnExitForm)
        {
            DesignCodeDTO model = null;

            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                DynamicFormDTO DynamicFormDTO = new DynamicFormDTO(dynamicFormService.GetInfo(DynamicFormId));

                if (IsOnExitForm)
                {
                    model = new DesignCodeDTO()
                    {
                        Code          = DynamicFormDTO.OnExitFormCodeDesign.Code,
                        ID            = string.IsNullOrWhiteSpace(DynamicFormDTO.OnExitFormCodeDesign.ID) ? Guid.NewGuid().ToString() : DynamicFormDTO.OnExitFormCodeDesign.ID,
                        CodeType      = DesignCodeDTO.e_CodeType.DynamicForm,
                        CallBack      = CallBack,
                        Assemblies    = DynamicFormDTO.OnExitFormCodeDesign.Assemblies,
                        DynamicFormID = DynamicFormId,
                        DesignCode    = DynamicFormDTO.OnExitFormCodeDesign.DesignCode,
                        Diagram       = DynamicFormDTO.OnExitFormCodeDesign.Diagram.ToStringObj().Trim(),
                        CodeObjects   = DynamicFormDTO.OnExitFormCodeDesign.CodeObjects,
                    };
                }
                else
                {
                    model = new DesignCodeDTO()
                    {
                        Code          = DynamicFormDTO.OnEntryFormCodeDesign.Code,
                        ID            = string.IsNullOrWhiteSpace(DynamicFormDTO.OnEntryFormCodeDesign.ID) ? Guid.NewGuid().ToString() : DynamicFormDTO.OnEntryFormCodeDesign.ID,
                        CodeType      = DesignCodeDTO.e_CodeType.DynamicForm,
                        CallBack      = CallBack,
                        Assemblies    = DynamicFormDTO.OnEntryFormCodeDesign.Assemblies,
                        DynamicFormID = DynamicFormId,
                        DesignCode    = DynamicFormDTO.OnEntryFormCodeDesign.DesignCode,
                        Diagram       = DynamicFormDTO.OnEntryFormCodeDesign.Diagram.ToStringObj().Trim(),
                        CodeObjects   = DynamicFormDTO.OnEntryFormCodeDesign.CodeObjects,
                    };
                }
            }

            this.InitialData(model);
            return(model);
        }
Exemplo n.º 21
0
 public List <ComboSearchItem> GetListElement(Guid formId, string controlId, Guid?threadId = null)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         sysBpmsDynamicForm  dynamicForm       = dynamicFormService.GetInfo(formId);
         ListItemElementBase control           = (ListItemElementBase)dynamicForm.FindControl(controlId);
         EngineSharedModel   engineSharedModel = dynamicForm.ProcessId.HasValue ?
                                                 new EngineSharedModel(threadId, dynamicForm.ProcessId, base.MyRequest.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId) :
                                                 new EngineSharedModel(dynamicForm.ApplicationPageID.Value, base.MyRequest.GetList(base.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId);
         UnitOfWork unitOfWork = new UnitOfWork();
         control.Helper = HtmlElementHelper.MakeModel(engineSharedModel, unitOfWork, HtmlElementHelperModel.e_FormAction.Onload, dynamicForm);
         control.FillData();
         return(control.Options.Select(item => new ComboSearchItem()
         {
             text = item.Label,
             id = item.Value,
         }).ToList());
     }
 }
Exemplo n.º 22
0
        public object PostAddEdit(DynamicFormDTO dynamicFormDTO)
        {
            sysBpmsDynamicForm dynamicForm;
            ResultOperation    resultOperation = new ResultOperation();

            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                if (dynamicFormDTO.ID != Guid.Empty)
                {
                    dynamicForm = dynamicFormService.GetInfo(dynamicFormDTO.ID);
                    dynamicForm.Update(dynamicFormDTO.ProcessId, dynamicFormDTO.ApplicationPageID, dynamicFormDTO.Name, dynamicFormDTO.Version, dynamicFormDTO.ShowInOverview);

                    DynamicFormConfigXmlModel configXmlModel = dynamicForm.ConfigXmlModel;
                    configXmlModel.IsEncrypted = dynamicFormDTO.IsEncrypted;
                    dynamicForm.Update(configXmlModel);

                    resultOperation = dynamicFormService.Update(dynamicForm, base.userName);
                }
                else
                {
                    dynamicForm = new sysBpmsDynamicForm().Update(dynamicFormDTO.ProcessId, dynamicFormDTO.ApplicationPageID, dynamicFormDTO.Name, dynamicFormDTO.Version, dynamicFormDTO.ShowInOverview);

                    DynamicFormConfigXmlModel configXmlModel = dynamicForm.ConfigXmlModel;
                    configXmlModel.IsEncrypted = dynamicFormDTO.IsEncrypted;
                    dynamicForm.Update(configXmlModel);
                    //make applicationPage if processId is null.
                    sysBpmsApplicationPage sysAppPage = !dynamicForm.ProcessId.HasValue ?
                                                        new sysBpmsApplicationPage().Update(dynamicFormDTO.ApplicationPageDTO.GroupLU, string.Empty, dynamicFormDTO.ApplicationPageDTO.ShowInMenu) : null;

                    resultOperation        = dynamicFormService.Add(dynamicForm, sysAppPage, base.userName);
                    base.ApplicationPageId = dynamicForm.ApplicationPageID;
                }
            }
            if (resultOperation.IsSuccess)
            {
                return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success, new DynamicFormDTO(dynamicForm)));
            }
            else
            {
                return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
            }
        }
        public object PostIndex(PostDesignCodePostIndexDTO requestModel)
        {
            Guid?           dynamicFormId = requestModel.DynamicFormId.ToGuidObjNull();
            DesignCodeModel codeModel     = DesignCodeUtility.GetDesignCodeFromXml(requestModel.DesignCode.ToStringObj());
            DesignCodeDTO   model         = new DesignCodeDTO()
            {
                Code          = codeModel?.Code,
                CodeType      = (DesignCodeDTO.e_CodeType)requestModel.CodeType,
                CallBack      = requestModel.CallBack.ToStringObj(),
                Assemblies    = codeModel?.Assemblies,
                ID            = string.IsNullOrWhiteSpace(codeModel.ID) ? Guid.NewGuid().ToString() : codeModel.ID,
                CodeObjects   = codeModel.CodeObjects,
                DynamicFormID = dynamicFormId,
                DesignCode    = codeModel.DesignCode,
                Diagram       = codeModel.Diagram.ToStringObj().Trim(),
            };

            if (model.CodeType == DesignCodeDTO.e_CodeType.ConditionCode)
            {
                Random           random           = new Random();
                DCConditionModel dcConditionModel = (DCConditionModel)model.CodeObjects?.FirstOrDefault() ??
                                                    new DCConditionModel(Guid.NewGuid().ToString(), "Condition", string.Empty, string.Empty, null, new List <DCRowConditionModel>(), true, "func" + random.Next(100, 100));
                using (VariableService variableService = new VariableService())
                    using (DynamicFormService dynamicFormService = new DynamicFormService())
                        return new
                               {
                                   OpenDirectly    = true,
                                   DesignCodeDTO   = model,
                                   ProcessControls = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                                     dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                                   ProcessVariables   = variableService.GetVariableAsComboTree(base.ProcessId, base.ApplicationPageId, null, "{0}"),
                                   ListOperationTypes = EnumObjHelper.GetEnumList <DCRowConditionModel.e_OperationType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                                   Model = dcConditionModel
                               };
            }
            else
            {
                this.InitialData(model, dynamicFormId);
                return(model);
            }
        }
        public object PostLoadEntityForm(PostLoadEntityFormDTO model)
        {
            Guid?         dynamicFormId = model.DynamicFormId.ToGuidObjNull();
            DCEntityModel designCode    = null;

            if (!string.IsNullOrWhiteSpace(model.XmlB64Model))
            {
                designCode             = DesignCodeUtility.GetObjectOfDesignCode <DCEntityModel>(model.XmlB64Model.ToStringObj().FromBase64());
                designCode.IsOutputYes = model.IsOutputYes;
            }
            else
            {
                designCode = new DCEntityModel(Guid.NewGuid().ToString(), string.Empty, model.ShapeId.ToStringObj(),
                                               model.ParentShapeId.ToStringObj(), model.IsOutputYes.ToBoolObjNull(),
                                               new List <DCEntityParametersModel>(), model.IsFirst.ToBoolObj(), model.DefaultMethodType);
            }

            using (EntityDefService entityDefService = new EntityDefService())
            {
                var listENtities = entityDefService.GetList(null, true);
                if (designCode.EntityDefID != Guid.Empty)
                {
                    designCode.Rows.ForEach((item) =>
                    {
                        item.IsRequired = listENtities.FirstOrDefault(c => c.ID == designCode.EntityDefID).AllProperties.FirstOrDefault(d => d.Name == item.ParameterName).Required;
                    });
                }
                using (DynamicFormService dynamicFormService = new DynamicFormService())
                    return new
                           {
                               ListEntities    = listENtities.Select(c => new EntityDefDTO(c)).ToList(),
                               DynamicFormId   = dynamicFormId,
                               ProcessControls = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                                 dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                               Model = designCode
                           };
            }
        }
        private void InitialData(DesignCodeDTO codeDTO, Guid?dynamicFormId = null)
        {
            //codeDTO.DesignCodeData = (string.Join(",", codeDTO.CodeObjects.Select(c => string.Format("{{data:'{0}',shapeId:'{1}',id:'{2}'}}", (DesignCodeUtility.ConvertDesignCodeObjectToXml((c)).ToBase64()), ((DCBaseModel)c).ShapeID, ((DCBaseModel)c).ID))));
            codeDTO.DesignCodeData = codeDTO.CodeObjects.Select(c => new { data = DesignCodeUtility.ConvertDesignCodeObjectToXml((c)).ToBase64(), shapeId = ((DCBaseModel)c).ShapeID, id = ((DCBaseModel)c).ID }).ToList();
            using (VariableService variableService = new VariableService())
                codeDTO.ProcessVariables = variableService.GetVariableAsComboTree(base.ProcessId, base.ApplicationPageId, null, "{0}");
            codeDTO.AssembliesJson = Directory.Exists(BPMSResources.FilesRoot + BPMSResources.AssemblyRoot) ? new DirectoryInfo(BPMSResources.FilesRoot + BPMSResources.AssemblyRoot).GetFiles("*.dll").Select(c => new AssemblyDTO(c)).Select(c => new ComboTreeModel()
            {
                id = c.FileName, title = c.FileName
            }).ToList() : new List <ComboTreeModel>();
            using (DynamicFormService dynamicFormService = new DynamicFormService())
                codeDTO.ApplicationPages = dynamicFormService.GetList(null, null, true, string.Empty, null, null).Select(c => new QueryModel(c.ApplicationPageID.ToString(), c.Name)).ToList();

            using (LURowService luRowService = new LURowService())
                codeDTO.DepartmentRoles = luRowService.GetList("DepartmentRoleLU").Select(c => new LURowDTO(c)).ToList();
            using (DepartmentService departmentService = new DepartmentService())
                codeDTO.DepartmentList = departmentService.GetList(true, "", null).Select(c => new QueryModel($"new Guid(\"{ c.ID }\")", c.Name)).ToList();
            using (DocumentFolderService documentFolderService = new DocumentFolderService())
                codeDTO.DocumentFolders = documentFolderService.GetList(null, "", "", true).Select(c => new DocumentFolderDTO(c)).ToList();
            using (DynamicFormService dynamicFormService = new DynamicFormService())
            {
                if (dynamicFormId != Guid.Empty && dynamicFormId.HasValue)
                {
                    codeDTO.ProcessControls = dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList();
                }
                else
                if (base.ApplicationPageId.HasValue)
                {
                    codeDTO.ProcessControls = dynamicFormService.GetControls(dynamicFormService.GetInfoByPageID(base.ApplicationPageId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList();
                }
                else
                {
                    codeDTO.ProcessControls = new List <QueryModel>();
                }
            }
        }
        public object PostLoadExpressionCodeForm(PostLoadExpressionCodeFormDTO model)
        {
            DCExpressionModel designCode;
            Guid?dynamicFormId = model.DynamicFormId.ToGuidObjNull();

            if (!string.IsNullOrWhiteSpace(model.Data))
            {
                designCode             = DesignCodeUtility.GetObjectOfDesignCode <DCExpressionModel>(model.Data.FromBase64());
                designCode.IsOutputYes = model.IsOutputYes;
                if (string.IsNullOrWhiteSpace(designCode.FuncName))
                {
                    designCode.FuncName = DesignCodeUtility.GetFunctionName(designCode.ShapeID);
                }
            }
            else
            {
                designCode = new DCExpressionModel(Guid.NewGuid().ToString(), model.Name.ToStringObj(),
                                                   model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(),
                                                   "", model.IsOutputYes, model.IsFirst.ToBoolObj(), null);
            }
            designCode.Assemblies     = string.Join(",", designCode.Assemblies.ToStringObj().Split(',').Select(c => c.Trim()).ToList());
            designCode.ExpressionCode = designCode.ExpressionCode.ToStringObj().Replace("\\", "\\\\");
            using (DocumentFolderService documentFolderService = new DocumentFolderService())
                using (DepartmentService departmentService = new DepartmentService())
                    using (LURowService luRowService = new LURowService())
                        using (VariableService variableService = new VariableService())
                            using (DynamicFormService dynamicFormService = new DynamicFormService())
                                return new
                                       {
                                           GetAllSysMethods    = DesignCodeUtility.GetAllSysMethods().Select(c => new { Key = c }).ToList(),
                                           GetVariableMethods  = DesignCodeUtility.GetVariableMethods().Select(c => new { Key = c }).ToList(),
                                           GetMessageMethods   = DesignCodeUtility.GetMessageMethods().Select(c => new { Key = c }).ToList(),
                                           GetAccessMethods    = DesignCodeUtility.GetAccessMethods().Select(c => new { Key = c }).ToList(),
                                           GetHelperMethods    = DesignCodeUtility.GetHelperMethods().Select(c => new { Key = c }).ToList(),
                                           GetDocumentMethods  = DesignCodeUtility.GetDocumentMethods().Select(c => new { Key = c }).ToList(),
                                           GetAllSysProperties = DesignCodeUtility.GetAllSysProperties().Select(c => new { Key = c }).ToList(),

                                           AssembliesJson   = (Directory.Exists(BPMSResources.FilesRoot + BPMSResources.AssemblyRoot) ? new DirectoryInfo(BPMSResources.FilesRoot + BPMSResources.AssemblyRoot).GetFiles("*.dll").Select(c => new AssemblyDTO(c)).Select(c => new ComboTreeModel()
                                    {
                                        id = c.FileName, title = c.FileName
                                    }).ToList() : new List <ComboTreeModel>()),
                                           ApplicationPages = dynamicFormService.GetList(null, null, true, string.Empty, null, null).Select(c => new QueryModel(c.ApplicationPageID.ToString(), c.Name)).ToList(),
                                           DepartmentRoles  = luRowService.GetList("DepartmentRoleLU").Select(c => new LURowDTO(c)).ToList(),
                                           DepartmentList   = departmentService.GetList(true, "", null).Select(c => new { ID = $"new Guid(\"{ c.ID }\")", c.Name }),
                                           DocumentFolders  = documentFolderService.GetList(null, "", "", true).Select(c => new QueryModel(c.ID.ToString(), c.DisplayName)).ToList(),
                                           ProcessVariables = variableService.GetVariableAsComboTree(base.ProcessId, base.ApplicationPageId, null, "{0}"),
                                           ProcessControls  = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                                              dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                                           Model = designCode
                                       };
        }
        public object PostPopUp(Guid threadTaskID, Guid formID, string controlId = "")
        {
            using (ThreadTaskService threadTaskService = new ThreadTaskService())
            {
                using (DynamicFormService dynamicFormService = new DynamicFormService())
                {
                    sysBpmsThreadTask threadTask = threadTaskService.GetInfo(threadTaskID, new string[] { nameof(sysBpmsThreadTask.Thread) });
                    using (ProcessEngine ProcessEngine = new ProcessEngine(new EngineSharedModel(threadTask.ThreadID, threadTask.Thread.ProcessID, this.MyRequest.GetList(dynamicFormService.GetInfo(formID).ConfigXmlModel.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId)))
                    {
                        PostTaskFormResponseModel responseVM = ProcessEngine.PostForm(threadTaskID, formID, controlId);

                        if (!responseVM.IsSuccess)
                        {
                            return(new EngineFormResponseDTO(redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: false,
                                                             null, false, messageList: responseVM.ListMessageModel, false));
                        }
                        else
                        {
                            if (responseVM.IsSubmit)
                            {
                                return(new EngineFormResponseDTO(
                                           redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: false,
                                           listDownloadModel: responseVM.ListDownloadModel,
                                           isSubmit: true,
                                           responseVM.ListMessageModel, true
                                           ));
                            }
                            else
                            {
                                return(new EngineFormResponseDTO(
                                           redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: true,
                                           listDownloadModel: responseVM.ListDownloadModel,
                                           isSubmit: false,
                                           responseVM.ListMessageModel
                                           ));
                            }
                        }
                    }
                }
            }
        }
        public object GetPopUp(Guid threadTaskID, Guid formID)
        {
            using (ThreadTaskService threadTaskService = new ThreadTaskService())
            {
                using (DynamicFormService dynamicFormService = new DynamicFormService())
                {
                    sysBpmsThreadTask threadTask = threadTaskService.GetInfo(threadTaskID, new string[] { nameof(sysBpmsThreadTask.Thread) });
                    using (ProcessEngine ProcessEngine = new ProcessEngine(new EngineSharedModel(threadTask.ThreadID, threadTask.Thread.ProcessID, this.MyRequest.GetList(dynamicFormService.GetInfo(formID).ConfigXmlModel.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId)))
                    {
                        GetTaskFormResponseModel responseVM = ProcessEngine.GetForm(threadTaskID, formID);
                        if (responseVM.EngineFormModel != null)
                        {
                            string popUpUrl = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, nameof(CartableThreadController.GetPopUp), nameof(CartableThreadController), "", "threadTaskID=" + threadTaskID);
                            string postUrl  = UrlUtility.GetCartableApiUrl(base.MyRequest, base.PortalSettings.DefaultPortalAlias, nameof(CartableThreadController.PostPopUp), nameof(CartableThreadController), "", UrlUtility.GetParamsAsArray(new HttpRequestWrapper(base.MyRequest), new string[] { $"formID={formID}", $"threadTaskID={threadTaskID}", $"stepID={responseVM.EngineFormModel.FormModel.StepID}" }).ToArray());

                            responseVM.EngineFormModel.SetUrls(popUpUrl, postUrl, new HttpRequestWrapper(base.MyRequest), base.PortalSettings.DefaultPortalAlias, FormTokenUtility.GetFormToken(base.ApiSessionId, responseVM.EngineFormModel?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, responseVM?.EngineFormModel?.FormModel?.IsEncrypted ?? false));
                        }
                        return(new
                        {
                            Model = responseVM?.EngineFormModel,
                            MessageList = responseVM?.ListMessageModel.Select(c => new PostMethodMessage(c.Message, c.DisplayMessageType)),
                            RedirectUrl = base.GetRedirectUrl(responseVM?.RedirectUrlModel),
                            Result = true,
                        });
                    }
                }
            }
        }
Exemplo n.º 29
0
        public object GetPopUp(Guid formID, Guid?threadTaskID = null)
        {
            SingleActionSettingDTO setting = base.GetSetting();

            if (setting.ProcessID.HasValue)
            {
                #region .:: Thread ::.
                GetTaskFormResponseModel responseVM = null;
                //If bpms engine is in different domain.
                if (!string.IsNullOrWhiteSpace(setting.WebApiAddress))
                {
                    responseVM = new EngineProcessProxy(setting.WebApiAddress, setting.WebServicePass, base.ClientUserName, ApiUtility.GetIPAddress(), base.ApiSessionId, this.IsEncrypted).GetForm(threadTaskID.Value, formID, base.MyRequest.GetList(false, string.Empty).ToList());
                }
                else
                {
                    //if engine is in same domain, call it directly.
                    using (ThreadTaskService threadTaskService = new ThreadTaskService())
                    {
                        sysBpmsThreadTask threadTask = new ThreadTaskService().GetInfo(threadTaskID.Value, new string[] { nameof(sysBpmsThreadTask.Thread) });

                        using (ProcessEngine ProcessEngine = new ProcessEngine(new EngineSharedModel(threadTask.ThreadID, threadTask.Thread.ProcessID, base.MyRequest.GetList(this.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId)))
                            responseVM = ProcessEngine.GetForm(threadTask.ID, formID, null);
                    }
                }
                if (responseVM.EngineFormModel != null)
                {
                    string popUpUrl = UrlUtility.GetSingleActionApiUrl(base.MyRequest, base.TabModuleID, base.PortalSettings.DefaultPortalAlias, nameof(SingleActionWorkerController.GetPopUp), nameof(SingleActionWorkerController), "", "threadTaskID=" + threadTaskID);
                    string postUrl  = UrlUtility.GetSingleActionApiUrl(base.MyRequest, base.TabModuleID, base.PortalSettings.DefaultPortalAlias, nameof(SingleActionWorkerController.PostPopUp), nameof(SingleActionWorkerController), "", UrlUtility.GetParamsAsArray(new HttpRequestWrapper(base.MyRequest), new string[] { $"formID={formID}", $"threadTaskID={threadTaskID}", $"stepID={responseVM.EngineFormModel.FormModel.StepID}" }).ToArray());

                    if (!string.IsNullOrWhiteSpace(setting.WebApiAddress))
                    {
                        responseVM.EngineFormModel.SetUrlsForSingleAction(base.PortalSettings.DefaultPortalAlias, new HttpRequestWrapper(base.MyRequest), popUpUrl, postUrl, FormTokenUtility.GetFormToken(base.ApiSessionId, responseVM?.EngineFormModel?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, responseVM?.EngineFormModel?.FormModel?.IsEncrypted ?? false), base.TabModuleID);
                    }
                    else
                    {
                        responseVM.EngineFormModel.SetUrls(popUpUrl, postUrl, new HttpRequestWrapper(base.MyRequest), base.PortalSettings.DefaultPortalAlias, FormTokenUtility.GetFormToken(base.ApiSessionId, responseVM?.EngineFormModel?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, responseVM?.EngineFormModel?.FormModel?.IsEncrypted ?? false));
                    }
                }
                return(new
                {
                    Model = responseVM?.EngineFormModel,
                    MessageList = responseVM?.ListMessageModel.Select(c => new PostMethodMessage(c.Message, c.DisplayMessageType)),
                    RedirectUrl = base.GetRedirectUrl(responseVM?.RedirectUrlModel),
                    Result = true,
                });

                #endregion
            }
            else
            {
                #region .:: Application ::.
                GetFormResponseModel responseVM = null;
                //if bpms engine is in different domain
                if (!string.IsNullOrWhiteSpace(setting.WebApiAddress))
                {
                    EngineApplicationProxy engineApplicationProxy = new EngineApplicationProxy(setting.WebApiAddress, setting.WebServicePass, base.ClientUserName, ApiUtility.GetIPAddress(), base.ApiSessionId, this.IsEncrypted);
                    responseVM = engineApplicationProxy.GetForm(null, formID, new HttpRequestWrapper(base.MyRequest).GetList(false, string.Empty).ToList());
                }
                else
                {
                    using (DynamicFormService dynamicFormService = new DynamicFormService())
                    {
                        EngineSharedModel engineSharedModel = new EngineSharedModel(dynamicFormService.GetInfo(formID).ApplicationPageID.Value, base.MyRequest.GetList(false, string.Empty).ToList(), base.ClientUserName, base.ApiSessionId);
                        using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(engineSharedModel))
                            responseVM = applicationPageEngine.GetForm();
                    }
                }

                if (responseVM.EngineFormModel != null)
                {
                    string popUpUrl = UrlUtility.GetSingleActionApiUrl(base.MyRequest, base.TabModuleID, base.PortalSettings.DefaultPortalAlias, nameof(SingleActionWorkerController.GetPopUp), nameof(SingleActionWorkerController), "");
                    string postUrl  = UrlUtility.GetSingleActionApiUrl(base.MyRequest, base.TabModuleID, base.PortalSettings.DefaultPortalAlias, nameof(SingleActionWorkerController.PostPopUp), nameof(SingleActionWorkerController), "", UrlUtility.GetParamsAsArray(new HttpRequestWrapper(base.MyRequest), new string[] { $"applicationPageId={responseVM.EngineFormModel.ApplicationID}" }).ToArray());
                    if (!string.IsNullOrWhiteSpace(setting.WebApiAddress))
                    {
                        responseVM.EngineFormModel.SetUrlsForSingleAction(base.PortalSettings.DefaultPortalAlias, new HttpRequestWrapper(base.MyRequest), popUpUrl, postUrl, FormTokenUtility.GetFormToken(base.ApiSessionId, responseVM?.EngineFormModel?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, responseVM?.EngineFormModel?.FormModel?.IsEncrypted ?? false), base.TabModuleID);
                    }
                    else
                    {
                        responseVM.EngineFormModel.SetUrls(popUpUrl, postUrl, new HttpRequestWrapper(base.MyRequest), base.PortalSettings.DefaultPortalAlias, FormTokenUtility.GetFormToken(base.ApiSessionId, responseVM?.EngineFormModel?.FormModel?.ContentHtml?.DynamicFormID ?? Guid.Empty, responseVM?.EngineFormModel?.FormModel?.IsEncrypted ?? false));
                    }
                }
                return(new
                {
                    Model = responseVM?.EngineFormModel,
                    MessageList = responseVM?.ListMessageModel.Select(c => new PostMethodMessage(c.Message, c.DisplayMessageType)),
                    RedirectUrl = base.GetRedirectUrl(responseVM?.RedirectUrlModel),
                    Result = true,
                });

                #endregion
            }
        }