コード例 #1
0
        public static void SetTaskAccomplishedAfterRead(Object sender, EventArgs e)
        {
            WfControlBase.ResponsePostBackPlaceHolder();

            string requestTaskID = HttpContext.Current.Request["taskID"];

            if (string.IsNullOrEmpty(requestTaskID))
            {
                return;
            }

            UserTaskCollection usc = UserTaskAdapter.Instance.GetUserTasks(
                UserTaskIDType.TaskID, UserTaskFieldDefine.Url, requestTaskID);

            if (usc.Count > 0)
            {
                UserTask task = usc[0];
                task.SendToUserID = DeluxeIdentity.CurrentUser.ID;
                task.TaskID       = requestTaskID;

                string url            = task.Url;
                int    removePosStart = url.IndexOf("needReadBtn");
                if (removePosStart >= 0) // found request query *needReadBtn*
                {
                    int removePosEnd = url.IndexOf('&', removePosStart);
                    if (removePosEnd > removePosStart) // found *needReadBtn=xxx&*, remove it
                    {
                        url = url.Remove(removePosStart, removePosEnd - removePosStart + 1);
                    }
                    else // not '&' after query string *needReadBtn*, remove all after *needReadBtn*
                    {
                        url = url.Remove(removePosStart);
                    }
                }
                task.Url = url;

                //UserTaskAdapter.Instance.SetTaskAccomplished(task,
                //    UserTaskIDType.TaskID | UserTaskIDType.SendToUserID,
                //    UserTaskFieldDefine.Url);
                UserTaskAdapter.Instance.SetUserTasksAccomplished(usc);
                WfControlBase.ResponsePostBackPlaceHolder();
                HttpContext.Current.Response.Write(ExtScriptHelper.GetRefreshBridgeScript());

                WebUtility.ResponseTimeoutScriptBlock("top.close();", ExtScriptHelper.DefaultResponseTimeout);
            }
        }
コード例 #2
0
        /// <summary>
        /// 执行流转或保存操作。
        /// </summary>
        /// <param name="actionName">操作名称</param>
        /// <param name="action">实际操作</param>
        private void ExecuteOperation(string actionName, WfControlOperationType operationType, WfExecutorBase executor)
        {
            StringBuilder strScript = new StringBuilder();

            ExceptionHelper.FalseThrow(WfClientContext.Current.HasProcessChanged == false && WfClientContext.Current.InMoveToMode,
                                       Translator.Translate(Define.DefaultCulture, "当前流程的状态已经改变,不能流转"));

            try
            {
                if (executor != null)
                {
                    WfClientContext.Current.Execute(executor);
                }

                HttpContext.Current.Response.Write(ExtScriptHelper.GetRefreshBridgeScript());

                strScript.Append(GetAfterExecutionScript(operationType));

                ResponsePostBackPlaceHolder();
            }
            catch (System.Exception ex)
            {
                ResponsePostBackPlaceHolder();

                System.Exception innerEx = ExceptionHelper.GetRealException(ex);

                if (innerEx is ApplicationInformationException)
                {
                    WebUtility.ResponseShowClientMessageScriptBlock(innerEx.Message, innerEx.StackTrace, Translator.Translate(Define.DefaultCulture, "流转"));
                }
                else
                {
                    WebUtility.ResponseShowClientErrorScriptBlock(innerEx.Message, innerEx.StackTrace, Translator.Translate(Define.DefaultCulture, "流转"));
                }
            }
            finally
            {
                strScript.Insert(0, "if (parent.document.all('wfOperationNotifier')) parent.document.all('wfOperationNotifier').value = '';");

                WebUtility.ResponseTimeoutScriptBlock(strScript.ToString(), ExtScriptHelper.DefaultResponseTimeout);

                Page.Response.End();
            }
        }
コード例 #3
0
 protected virtual void OnSuccess()
 {
     HttpContext.Current.Response.Write(ExtScriptHelper.GetRefreshBridgeScript());
 }
コード例 #4
0
        /// <summary>
        /// 如果请求是提醒对话框的,则处理该请求,显示提醒对话框的内容
        /// </summary>
        private void DoNotifyDialog()
        {
            if (HttpContext.Current.Request.RequestType == "POST")
            {
                string taskID     = HttpContext.Current.Request.QueryString["taskID"];
                string taskSource = WebUtility.GetRequestFormString("taskSource", "userTask");

                if (string.IsNullOrEmpty(taskID) == false && GetAutoTransferToCompletedTask())
                {
                    UserTask task = new UserTask();
                    task.TaskID = taskID;
                    UserTaskCollection tasks = new UserTaskCollection();
                    tasks.Add(task);
                    if (taskSource == "userTask")
                    {
                        UserTaskAdapter.Instance.DeleteUserTasks(tasks);
                    }
                    else
                    {
                        UserTaskAdapter.Instance.DeleteUserAccomplishedTasks(tasks);
                    }
                }

                SaveAutoTransferToCompletedTaskFlag();

                //WebUtility.ResponseRefreshParentWindowScriptBlock();
                HttpContext.Current.Response.Write(ExtScriptHelper.GetRefreshBridgeScript());
                WebUtility.ResponseTimeoutScriptBlock("top.close();", ExtScriptHelper.DefaultResponseTimeout);

                HttpContext.Current.Response.End();
            }
            else
            {
                Page page = new Page();

                HtmlGenericControl html = new HtmlGenericControl("html");
                WebUtility.SetCurrentPage(page);
                page.Controls.Add(html);

                HtmlHead head = new HtmlHead();
                html.Controls.Add(head);

                HtmlTitle title = new HtmlTitle();
                title.Text = Translator.Translate(Define.DefaultCulture, "提醒消息");
                head.Controls.Add(title);

                HtmlGenericControl body = new HtmlGenericControl("body");
                html.Controls.Add(body);

                WebUtility.AttachPageModules(page);

                string temmplate = GetNotifyDialogHtml();
                string pageHtml  = InitNotifyDialogPage(temmplate);

                body.Controls.Add(new LiteralControl(pageHtml));

                ((IHttpHandler)page).ProcessRequest(HttpContext.Current);

                HttpContext.Current.Response.End();
            }
        }