Example #1
0
        private void StartFlow()
        {
            ArrayList array   = new ArrayList();
            string    state   = RequestData.Get <string>("state");
            string    formUrl = "/DocumentManage/SignRequestEdit.aspx?op=v&&id=" + id;
            Guid      guid    = WorkFlow.StartWorkFlow(id, formUrl, "签报审批", "SignRequest", UserInfo.UserID, UserInfo.Name);

            array.Add(guid + "#" + ent.ApproveLeaderIds + "$" + ent.ApproveLeaderNames);
            PageState.Add("WorkFlowInfo", array);
            ent.WorkFlowState = state;
            ent.DoUpdate();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            op       = RequestData.Get <string>("op");
            id       = RequestData.Get <string>("id");
            LinkView = RequestData.Get <string>("LinkView");
            nextName = RequestData.Get <string>("nextName");
            taskName = RequestData.Get <string>("taskName");
            if (!string.IsNullOrEmpty(id))
            {
                ent = SignRequest.Find(id);
            }
            switch (RequestActionString)
            {
            case "update":
                string JsonString = RequestData.Get <string>("JsonString");   //打回首环节再次提交的时候需要重新保存表单
                if (!string.IsNullOrEmpty(JsonString))
                {
                    SignRequest tempEnt = JsonHelper.GetObject <SignRequest>(JsonString);
                    DataHelper.MergeData <SignRequest>(ent, tempEnt);
                    ent.DoUpdate();
                }
                else
                {
                    ent = GetMergedData <SignRequest>();
                    ent.DoUpdate();
                    PageState.Add("Id", ent.Id);
                }
                break;

            case "GetNextUsers":
                PageState.Add("NextUsers", GetNextUser(nextName));
                break;

            case "ConfirmYuanLeader":
                ent.YuanLeaderIds   = RequestData.Get <string>("YuanLeaderIds");
                ent.YuanLeaderNames = RequestData.Get <string>("YuanLeaderNames");
                ent.DoUpdate();
                break;

            case "create":
                ent = GetPostedData <SignRequest>();
                ent.DoCreate();
                PageState.Add("Id", ent.Id);
                break;

            case "submit":
                StartFlow();
                break;

            case "AutoExecuteFlow":
                AutoExecuteFlow();
                break;

            case "submitfinish":
                ent = SignRequest.Find(id);
                ent.ApproveResult = RequestData.Get <string>("ApprovalState");
                ent.WorkFlowState = RequestData.Get <string>("state");
                ent.DoUpdate();
                break;

            default:
                DoSelect();
                break;
            }
        }