예제 #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>
        /// 通过Message显示错误信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void page_Error(object sender, EventArgs e)
        {
            Page page = (Page)sender;

            ScriptManager sm = ScriptManager.GetCurrent(page);

            if (page.IsPostBack && page.IsCallback == false && (sm == null || sm.IsInAsyncPostBack == false))
            {
                WfControlBase.ResponsePostBackPlaceHolder();

                System.Exception ex = HttpContext.Current.Error;

                if (ex != null)
                {
                    HttpContext.Current.ClearError();

                    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, "错误"));
                    }

                    page.Response.Write(
                        "<script type='text/javascript'>if (parent.document.all('wfOperationNotifier')) parent.document.all('wfOperationNotifier').value = '';</script>");

                    page.Response.End();
                }
            }
        }