Example #1
0
        public string ExecuteWF(User user, bool reject = false)
        {
            string retMsg = "SuccessWF";

            if (user == null || user.WorkflowInstId == Guid.Empty)
            {
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("model", user);
                instance = new WorkflowApplication(new AdminRights(), dic);

                this.InitWorkflowApplication();
                instance.Run();
            }
            else
            {
                AdminRights rights = new AdminRights();
                instance = new WorkflowApplication(rights);
                this.InitWorkflowApplication();
                instance.Load(user.WorkflowInstId);
                string approver = "SuperAdmin";
                if (reject)
                {
                    //更新状态
                    WFinstanceDAL wfDal = new WFinstanceDAL();
                    wfDal.Add(user.WorkflowInstId.ToString(), approver, "驳回");

                    WFCurrentNodeInfoDAL infoDal = new WFCurrentNodeInfoDAL();
                    infoDal.UpdateExitTime(user.WorkflowInstId.ToString(), DateTime.Now);

                    instance.Cancel();
                    retMsg = "驳回成功";
                }
                if (instance.GetBookmarks().Count > 0)
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("model", user);
                    dic.Add("curApproveUser", approver);
                    instance.ResumeBookmark("BookmarkTest", dic);
                }
            }

            user.WorkflowInstId = instance.Id;
            //等待工作线程结束
            idleEvent.WaitOne();
            instance.Unload();
            return(retMsg);
        }
Example #2
0
        void SaveApprovalHistoryToDB(User userInfo, string approver)
        {
            //WFinstanceDAL wfDal = new WFinstanceDAL();
            //WFInstance inst = wfDal.Get(userInfo.WorkflowInstId.ToString()).FirstOrDefault();
            //if (inst == null)
            //{
            //    inst = new WFInstance();
            //    inst.WfInstanceId = userInfo.WorkflowInstId;
            //    inst.SubmitTime = DateTime.Now;
            //}

            //inst.State = "审核通过";
            //inst.ApproveTime = DateTime.Now;
            //inst.ApproveUser = approver;
            //inst.CurrentNode = NodeName;
            //wfDal.Add(inst);
            WFinstanceDAL wfDal = new WFinstanceDAL();

            wfDal.Add(userInfo.WorkflowInstId.ToString(), approver, "审核通过", NodeName);

            WFCurrentNodeInfoDAL infoDal = new WFCurrentNodeInfoDAL();

            infoDal.UpdateExitTime(userInfo.WorkflowInstId.ToString(), DateTime.Now);
        }
Example #3
0
        public ActionResult MyApplyList()
        {
            var dal = new WFinstanceDAL();

            return(View(dal.Get()));
        }
Example #4
0
        public ActionResult ApprovalHistoryList()
        {
            var dal = new WFinstanceDAL();

            return(View(dal.Get()));
        }