Esempio n. 1
0
        private void tbtCancel_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择工作流!");
                return;
            }
            CWorkflow wf = (CWorkflow)dataGridView.CurrentRow.Tag;

            //只有启动者或管理员才能撤销
            if (wf.Creator != Program.User.Id &&
                !Program.User.IsRole("管理员"))
            {
                MessageBox.Show("没有权限撤销!");
                return;
            }

            if (MessageBox.Show("是否确认撤销?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }

            if (!m_BaseObjectMgr.WorkflowMgr.CancelWorkflow(wf))
            {
                MessageBox.Show("撤销失败!");
                return;
            }
            dataGridView.CurrentRow.Cells[2].Value = wf.GetStateString();
            MessageBox.Show("撤销成功!");
        }
Esempio n. 2
0
        private void tbtApproval_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择工作流!");
                return;
            }
            CWorkflow wf = (CWorkflow)dataGridView.CurrentRow.Tag;

            if (wf.State != enumApprovalState.Running)
            {
                MessageBox.Show("只有进行中的工作流才能审批!");
                return;
            }
            CActives Actives = wf.ActivesMgr.FindNotApproval();

            if (Actives == null)
            {
                MessageBox.Show("没有审批的活动!");
                return;
            }
            if (Actives.B_User_id != Program.User.Id)
            {
                MessageBox.Show("没有权限审批!");
                return;
            }
            ApprovalActives frm = new ApprovalActives();

            frm.m_Workflow = wf;
            frm.m_Actives  = Actives;
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            dataGridView.CurrentRow.Cells[2].Value = wf.GetStateString();
            LoadActives(wf);
            MessageBox.Show("审批完成!");
        }