public ThreadDetailDTO GetThreadDetails(Guid threadId)
        {
            var result = ApiUtility.GetData <ThreadDetailDTO>(UrlUtility.GetApiUrl(this.BaseApiUrl, "GetThreadDetails", "EngineProcess", this.Token, "threadId=" + threadId), this.Token, this.UserName, this.ClientIp, this.ClientId, this.IsEncrypted);

            result.ListOverviewForms.ForEach(c => c?.FormModel?.ContentHtml?.ConvertChildrenToObject());
            return(result);
        }
        public BeginTaskResponseModel BeginTask(Guid processID, List <QueryModel> baseQueryModel)
        {
            string url = UrlUtility.GetApiUrl(this.BaseApiUrl, "BeginTask", "EngineProcess", this.Token, new string[] { "processID=" + processID.ToStringObj() });
            BeginTaskResponseModel beginTaskResponseVM = ApiUtility.PostData <BeginTaskResponseModel>(url, baseQueryModel, this.Token, this.UserName, this.ClientIp, this.ClientId, this.IsEncrypted);

            return(beginTaskResponseVM);
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
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);
        }
        public PostTaskFormResponseModel PostForm(Guid threadTaskID, Guid formID, string controlId, List <QueryModel> baseQueryModel)
        {
            string url = UrlUtility.GetApiUrl(this.BaseApiUrl, "PostForm", "EngineProcess", this.Token,
                                              $"threadTaskID={threadTaskID.ToStringObj()}",
                                              (string.IsNullOrWhiteSpace(controlId) ? "" : $"controlId={controlId}"),
                                              ($"formID={formID}"));
            PostTaskFormResponseModel postTaskFormResponseModel = ApiUtility.PostData <PostTaskFormResponseModel>(url, baseQueryModel, this.Token, this.UserName, this.ClientIp, this.ClientId, this.IsEncrypted);

            return(postTaskFormResponseModel);
        }
        /// <summary>
        /// it is called when a pop up should be open.
        /// </summary>
        public GetTaskFormResponseModel GetForm(Guid threadTaskID, Guid formID, List <QueryModel> baseQueryModel, bool?chechAccess = null)
        {
            var parameters = this.MixParams(baseQueryModel, $"threadTaskID={threadTaskID.ToStringObj()}",
                                            $"formID={ formID}", (!chechAccess.HasValue ? "" : $"cAccess={chechAccess.Value}"));
            string url = UrlUtility.GetApiUrl(this.BaseApiUrl, "GetForm", "EngineProcess", this.Token, parameters);
            GetTaskFormResponseModel getTaskFormResponseModel = ApiUtility.GetData <GetTaskFormResponseModel>(url, this.Token, this.UserName, this.ClientIp, this.ClientId, this.IsEncrypted);

            //convert jobject to object
            getTaskFormResponseModel.EngineFormModel?.FormModel?.ContentHtml?.ConvertChildrenToObject();
            return(getTaskFormResponseModel);
        }
Exemplo n.º 7
0
        public GetFormResponseModel GetForm(Guid?applicationPageId, Guid?formID, List <QueryModel> baseQueryModel)
        {
            var parameters = this.MixParams(baseQueryModel,
                                            (!applicationPageId.HasValue ? "" : $"applicationPageId={ applicationPageId}"),
                                            (!formID.HasValue ? "" : $"formID={ formID}"));
            string url = UrlUtility.GetApiUrl(this.BaseApiUrl, "GetForm", "EngineApplication", "", parameters);
            GetFormResponseModel getFormResponseModel = ApiUtility.GetData <GetFormResponseModel>(url, this.Token, this.UserName, this.ClientIp, this.ClientId, this.IsEncrypted);

            //convert jobject to object
            getFormResponseModel?.EngineFormModel?.FormModel?.ContentHtml?.ConvertChildrenToObject();
            return(getFormResponseModel);
        }
 public System.Net.Http.HttpResponseMessage PostData(string controller, string action, string formToken = "")
 {
     if (FormTokenUtility.ValidateFormToken(formToken, HttpContext.Current.Session.SessionID))
     {
         SingleActionSettingDTO setting = new SingleActionSettingDTO(new HttpRequestWrapper(HttpContext.Current.Request), base.PortalSettings.PortalId);
         //when calling main api from client application, there  is no need to pass formToken to main bpms api.
         string url = UrlUtility.GetApiUrl(setting.WebApiAddress, action, controller, "", this.GetParameters().ToArray());
         return(ApiUtility.PostData(url, QueryModel.GetFormDataList(this.MyRequest).ToList(), setting.WebServicePass, base.UserInfo.Username, ApiUtility.GetIPAddress(), HttpContext.Current.Session.SessionID, FormTokenUtility.GetIsEncrypted(formToken, HttpContext.Current.Session.SessionID)));
     }
     else
     {
         throw new System.Web.Http.HttpResponseException(System.Net.HttpStatusCode.Unauthorized);
     }
 }
        public System.Net.Http.HttpResponseMessage GetData(string controller, string action, string formToken = "")
        {
            if (FormTokenUtility.ValidateFormToken(formToken, HttpContext.Current.Session.SessionID))
            {
                SingleActionSettingDTO setting = new SingleActionSettingDTO(new HttpRequestWrapper(HttpContext.Current.Request), base.PortalSettings.PortalId);
                //when calling main bpms api from client application, there  is no need to pass formToken to main bpms api.
                string url    = UrlUtility.GetApiUrl(setting.WebApiAddress, action, controller, "", this.GetParameters().ToArray());
                var    result = ApiUtility.GetData(url, setting.WebServicePass, base.UserInfo.Username, ApiUtility.GetIPAddress(), HttpContext.Current.Session.SessionID, FormTokenUtility.GetIsEncrypted(formToken, HttpContext.Current.Session.SessionID));

                /*
                 * In ReportEngine.cs response would be flushed and as a result sessionID will be rewrite with server
                 * session ID which is different with singleAction sessionID because it sends data using api to server
                 * and therefore it must rewrite sessionid there in case user call report or download a file.
                 */
                SessionIDManager Manager = new SessionIDManager();
                Manager.SaveSessionID(HttpContext.Current, HttpContext.Current.Session.SessionID, out bool redirected, out bool IsAdded);

                return(result);
            }
            else
            {
                throw new System.Web.Http.HttpResponseException(System.Net.HttpStatusCode.Unauthorized);
            }
        }
 public ProcessDTO GetInfo(Guid processId)
 {
     return(ApiUtility.GetData <ProcessDTO>(UrlUtility.GetApiUrl(this.BaseApiUrl, "GetInfo", "EngineProcess", this.Token, "processId=" + processId), this.Token, this.UserName, this.ClientIp, this.ClientId, this.IsEncrypted));
 }
 public List <Guid> GetAccessibleThreadTasks(Guid threadId)
 {
     return(ApiUtility.GetData <List <Guid> >(UrlUtility.GetApiUrl(this.BaseApiUrl, "GetAccessibleThreadTasks", "EngineProcess", this.Token, "threadId=" + threadId), this.Token, this.UserName, this.ClientIp, this.ClientId, this.IsEncrypted));
 }
Exemplo n.º 12
0
 public DynamicFormDTO GetInfo(Guid Id)
 {
     return(ApiUtility.GetData <DynamicFormDTO>(UrlUtility.GetApiUrl(this.BaseApiUrl, "GetInfo", "EngineForm", this.Token, "Id=" + Id), this.Token, this.UserName, this.ClientIp, this.ClientId, this.IsEncrypted));
 }