コード例 #1
0
        public string startProcess(string processInstanceID, int OrganizationUnitID, ref string email, string UserID, string UserName)
        {
            try {
                if (String.IsNullOrEmpty(processInstanceID))
                {
                    throw new Exception("startProcess - processInstanceID is empty");
                }


                WFEvent evt = api.StartProcInst(processInstanceID);
                evt = getFullEvent(evt);


                if (!String.IsNullOrEmpty(evt.Error))
                {
                    throw new Exception("startProcess - " + evt.Error);
                }

                string nextUser = prepareNextNode(processInstanceID, "PROCESS START", OrganizationUnitID, ref email);

                if (!String.IsNullOrEmpty(nextUser) && nextUser.IndexOf("P" + UserID + "P") > -1) // 如果下一步包有同一个人就自动审批(后面需要在审批历史里加入自动通过的标识)
                {
                    return(approve(true, "", UserID, UserName, processInstanceID, "", OrganizationUnitID, ref email));
                }
                else
                {
                    return(nextUser);
                }

                //return "111";
            } catch (Exception e) {
                try {
                    api.CancelProcInst(processInstanceID);
                } catch (Exception ex) {
                }
                if (e is ApplicationException)
                {
                    throw e;
                }
                throw new Exception(errorMSGPrefix + e.Message, e);
            }
        }
コード例 #2
0
        /// <summary>
        /// 撤销流程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvProgramFileList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string strID = gvProgramFileList.DataKeys[e.RowIndex].Value.ToString();
            bool   bFlag = false;

            foreach (string strRole in CurrentUserInfo.RoleName)
            {
                if (strRole == "OA系统管理员" || strRole == "OU系统管理员" || strRole.Contains("管理员") || strRole == ConstString.RoleName.QUALITY_MEMBER)
                {
                    bFlag = true;
                }
            }
            if (!bFlag)
            {
                IMessage ms = new WebFormMessage(Page, "只有\'OA系统管理员\'、\'OU系统管理员\'、\'管理员\'、\'质保人员\'可以撤销流程。");
                ms.Show();
                return;
            }
            try
            {
                B_ProgramFileInfo pfEntity = new B_ProgramFileInfo();
                pfEntity.ID = int.Parse(strID);
                string strProcessID = pfEntity.ProcessID;
                //if (pfEntity.ApplyStyle == ConstString.ProgramFile.PROGRAM_CREATE)
                //{
                //    pfEntity.ProcessID = null;
                //    pfEntity.Year = null;
                //    //pfEntity.ApplyStyle = null;
                //    //pfEntity.ArchiveState = null;
                //    //pfEntity.Edition = null;

                //    if (pfEntity.Save() == false)
                //    {
                //        IMessage ms = new WebFormMessage(Page, pfEntity.ErrMsgs[0].ToString());
                //        ms.Show();
                //        return;
                //    }

                //}//创建
                //else
                //{
                //    if (pfEntity.Delete() == false)
                //    {
                //        IMessage ms = new WebFormMessage(Page, pfEntity.ErrMsgs[0].ToString());
                //        ms.Show();
                //        return;
                //    }

                //}//升版、注销

                if (pfEntity.Delete() == false)
                {
                    IMessage ms = new WebFormMessage(Page, pfEntity.ErrMsgs[0].ToString());
                    ms.Show();
                    return;
                }
                GetSearchList(true);
                //取消流程
                AgilePointWF    ag  = new AgilePointWF();
                WorkflowService api = ag.GetAPI();
                api.CancelProcInst(strProcessID);
                IMessage msg = new WebFormMessage(Page, "撤销成功。");
                msg.Show();
            }
            catch (Exception ex)
            {
                IMessage ms = new WebFormMessage(Page, ex.Message.Length > 300 ? ex.Message.Substring(0, 300) : ex.Message);
                ms.Show();
            }
        }