Exemplo n.º 1
0
        public object PostPopUp(Guid applicationPageId, string controlId = "")
        {
            EngineSharedModel engineSharedModel = new EngineSharedModel(applicationPageId, base.MyRequest.GetList(this.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId);

            using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(engineSharedModel))
            {
                PostFormResponseModel responseVM = applicationPageEngine.PostForm(controlId);

                if (!responseVM.IsSuccess)
                {
                    return(new EngineFormResponseDTO(
                               redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: false, null,
                               isSubmit: false, responseVM.ListMessageModel, false));
                }
                else
                {
                    if (responseVM.IsSubmit)
                    {
                        return(new EngineFormResponseDTO(
                                   redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: false,
                                   listDownloadModel: responseVM.ListDownloadModel, isSubmit: true,
                                   responseVM.ListMessageModel
                                   ));
                    }
                    else
                    {
                        return(new EngineFormResponseDTO(
                                   base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: true,
                                   responseVM.ListDownloadModel, isSubmit: false,
                                   responseVM.ListMessageModel, true
                                   ));
                    }
                }
            }
        }
Exemplo n.º 2
0
        public PostFormResponseModel PostForm(Guid applicationPageId, string controlId, List <QueryModel> baseQueryModel)
        {
            string url = UrlUtility.GetApiUrl(this.BaseApiUrl, "PostForm", "EngineApplication", this.Token,
                                              $"applicationPageId={applicationPageId.ToStringObj()}",
                                              $"controlId={controlId}");
            PostFormResponseModel postFormResponseModel = ApiUtility.PostData <PostFormResponseModel>(url, baseQueryModel, this.Token, this.UserName, this.ClientIp, this.ClientId, this.IsEncrypted);

            return(postFormResponseModel);
        }
Exemplo n.º 3
0
        public object PostIndex(Guid applicationPageId, string controlId = "")
        {
            EngineSharedModel engineSharedModel = new EngineSharedModel(applicationPageId, base.MyRequest.GetList(this.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId);

            using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(engineSharedModel))
            {
                PostFormResponseModel postFormResponseModel = applicationPageEngine.PostForm(controlId);
                if (!postFormResponseModel.IsSuccess)
                {
                    return(new EngineFormResponseDTO(base.GetRedirectUrl(postFormResponseModel.RedirectUrlModel), false, null, false, postFormResponseModel?.ListMessageModel, false));
                }
                else
                {
                    return
                        (new EngineFormResponseDTO(
                             redirectUrl: base.GetRedirectUrl(postFormResponseModel.RedirectUrlModel),
                             true,
                             listDownloadModel: postFormResponseModel.ListDownloadModel, false,
                             postFormResponseModel.ListMessageModel
                             ));
                }
            }
        }
Exemplo n.º 4
0
        public object PostPopUp(Guid?applicationPageId = null, Guid?threadTaskID = null, Guid?formID = null, string controlId = "")
        {
            SingleActionSettingDTO setting = base.GetSetting();

            if (setting.ProcessID.HasValue)
            {
                #region .:: Thread ::.
                PostTaskFormResponseModel responseVM = null;

                //If bpms engine is in different domain.
                if (!string.IsNullOrWhiteSpace(setting.WebApiAddress))
                {
                    EngineProcessProxy engineProcessProxy = new EngineProcessProxy(setting.WebApiAddress, setting.WebServicePass, base.ClientUserName, ApiUtility.GetIPAddress(), base.ApiSessionId, this.IsEncrypted);
                    responseVM = engineProcessProxy.PostForm(threadTaskID.Value, formID.Value, controlId, base.MyRequest.GetList(false, string.Empty).ToList());
                }
                else
                {
                }

                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
                                   ));
                    }
                }
                #endregion
            }
            else
            {
                #region .:: Application ::.
                PostFormResponseModel 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.PostForm(applicationPageId.Value, controlId, base.MyRequest.GetList(false, string.Empty).ToList());
                }
                else
                {
                    EngineSharedModel engineSharedModel = new EngineSharedModel(applicationPageId.Value, base.MyRequest.GetList(this.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId);
                    using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(engineSharedModel))
                        responseVM = applicationPageEngine.PostForm(controlId);
                }

                if (!responseVM.IsSuccess)
                {
                    return(new EngineFormResponseDTO(
                               redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: false, null,
                               isSubmit: false, responseVM.ListMessageModel, false));
                }
                else
                {
                    if (responseVM.IsSubmit)
                    {
                        return(new EngineFormResponseDTO(
                                   redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: false,
                                   listDownloadModel: responseVM.ListDownloadModel, isSubmit: true,
                                   responseVM.ListMessageModel
                                   ));
                    }
                    else
                    {
                        return(new EngineFormResponseDTO(
                                   base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: true,
                                   responseVM.ListDownloadModel, isSubmit: false,
                                   responseVM.ListMessageModel, true
                                   ));
                    }
                }
                #endregion
            }
        }
Exemplo n.º 5
0
        public object PostIndex(Guid?applicationPageId = null, Guid?threadTaskID = null, string controlId = "", Guid?stepID = null, bool?goNext = null)
        {
            SingleActionSettingDTO setting = base.GetSetting();

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

                if (!responseVM.IsSuccess)
                {
                    return(new EngineFormResponseDTO(redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: false,
                                                     null, false, messageList: responseVM.ListMessageModel, false));
                }
                else
                {
                    if (responseVM.IsSubmit)
                    {
                        if (responseVM.IsNextPrevious == true)
                        {
                            return(new EngineFormResponseDTO(
                                       redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel),
                                       reloadForm: true,
                                       listDownloadModel: responseVM.ListDownloadModel,
                                       messageList: responseVM.ListMessageModel
                                       )
                            {
                                StepID = responseVM.StepID.Value,
                            });
                        }
                        else
                        {
                            return new EngineFormResponseDTO(
                                redirectUrl: string.IsNullOrWhiteSpace(base.GetRedirectUrl(responseVM.RedirectUrlModel)) ? "CartableManage" :
                                base.GetRedirectUrl(responseVM.RedirectUrlModel), reloadForm: setting.ProcessEndFormID.HasValue,
                                listDownloadModel: responseVM.ListDownloadModel,
                                messageList: responseVM.ListMessageModel
                                )
                                   {
                                       EndAppPageID = setting.ProcessEndFormID,
                                       StepID       = responseVM?.StepID,
                                   }
                        };
                    }
                    else
                    {
                        return new EngineFormResponseDTO(
                            redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel),
                            reloadForm: true,
                            listDownloadModel: responseVM.ListDownloadModel,
                            messageList: responseVM.ListMessageModel
                            )
                               {
                                   StepID = responseVM.StepID.Value,
                               }
                    };
                }
                #endregion
            }
            else
            {
                #region .:: Application ::.
                PostFormResponseModel 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.PostForm(applicationPageId.Value, controlId, base.MyRequest.GetList(false, string.Empty).ToList());
                }
                else
                {
                    EngineSharedModel engineSharedModel = new EngineSharedModel(applicationPageId.Value, base.MyRequest.GetList(this.IsEncrypted, base.ApiSessionId).ToList(), base.ClientUserName, base.ApiSessionId);
                    using (ApplicationPageEngine applicationPageEngine = new ApplicationPageEngine(engineSharedModel))
                        responseVM = applicationPageEngine.PostForm(controlId);
                }

                if (!responseVM.IsSuccess)
                {
                    return(new EngineFormResponseDTO(base.GetRedirectUrl(responseVM.RedirectUrlModel), false, null, false, responseVM?.ListMessageModel, false));
                }
                else
                {
                    return
                        (new EngineFormResponseDTO(
                             redirectUrl: base.GetRedirectUrl(responseVM.RedirectUrlModel),
                             reloadForm: false,
                             listDownloadModel: responseVM.ListDownloadModel, isSubmit: responseVM.IsSubmit,
                             responseVM.ListMessageModel, submittedHtmlMessage: setting.AppPageSubmitMessage
                             ));
                }
                #endregion
            }
        }