예제 #1
0
    //绑定开始环节详细信息
    private void BindTaskInfo()
    {
        EWF_TaskBLL task = new EWF_TaskBLL((int)ViewState["TaskID"]);

        #region 如果任务在待审批状态,且正好是待当前人审批,则直接切换到审批页面
        if (task.Model.Status == 3)
        {
            int job = EWF_TaskBLL.StaffCanApproveTask(task.Model.ID, (int)Session["UserID"]);
            if (job > 0)
            {
                Response.Redirect("Recipient.aspx?CurrentJobID=" + job.ToString() + "&TaskID=" + task.Model.ID.ToString());
            }
        }
        #endregion

        EWF_Flow_App app = new EWF_Flow_AppBLL(task.Model.App).Model;

        #region 绑定流程信息
        lbl_ID.Text      = task.Model.ID.ToString();
        lbl_Applyer.Text = new Org_StaffBLL(task.Model.Initiator).Model.RealName;
        lbl_AppName.Text = app.Name;

        lbl_Applyer_Position.Text = new Org_PositionBLL(new Org_StaffBLL(task.Model.Initiator).Model.Position).Model.Name;

        lbl_Title.Text = task.Model.Title;
        lb_Status.Text = DictionaryBLL.GetDicCollections("EWF_Task_TaskStatus")[task.Model.Status.ToString()].Name;

        lb_StartTime.Text = task.Model.StartTime.ToString();
        if (task.Model.EndTime != new DateTime(1900, 1, 1))
        {
            lb_EndTime.Text = task.Model.EndTime.ToString();
        }
        else
        {
            lb_EndTime.Text = "未结束";
        }

        lt_Remark.Text = task.Model.Remark;

        #region 绑定流程当前环节信息
        if (task.Model.Status < 5)
        {
            IList <EWF_Task_Job> jobs = EWF_Task_JobBLL.GetModelList("Task=" + task.Model.ID.ToString() + " ORDER BY StartTime DESC");
            if (jobs.Count > 0)
            {
                EWF_Flow_Process process = new EWF_Flow_ProcessBLL(jobs[0].CurrentProcess).Model;
                if (process != null)
                {
                    lb_CurrentJobInfo.Text = process.Name;
                    if (process.Type == 3)
                    {
                        lb_CurrentJobInfo.Text += " 等待审批人:";
                        foreach (EWF_Task_JobDecision decision in EWF_Task_JobDecisionBLL.GetModelList("Job=" + jobs[0].ID.ToString()))
                        {
                            MCSFramework.Model.Org_Staff staff = new Org_StaffBLL(decision.RecipientStaff).Model;
                            if (staff != null)
                            {
                                lb_CurrentJobInfo.Text += staff.RealName + "   ";
                            }
                        }
                    }
                }
            }
        }
        else
        {
            tr_CurrentProcessInfo.Visible = false;
        }
        #endregion

        #endregion

        #region 控制流程状态
        if (task.Model.Initiator == (int)Session["UserID"])
        {
            //只有流程发起的本人,才可控制流程状态

            if (task.Model.Status == 6)
            {
                MessageBox.Show(this, "您的流程因故停止流转,请尽快联系系统管理员排查原因,或点击“继续执行”按钮以重新启动流程的流转!");
                bt_Restart.Visible = true;
            }

            if (task.Model.Status == 4)
            {
                MessageBox.Show(this, "您的流程被最后一审批人设为了待处理状态,请补充相关信息附件后,或点击“继续执行”按钮以重新启动流程的流转!");
                bt_Restart.Visible = true;
            }

            if (task.Model.Status == 1)
            {
                MessageBox.Show(this, "您的流程还没正式发起申请,请尽快点击“确定发起”按钮以发起流程!");
                btn_Start.Visible = true;
            }

            if (task.Model.Status != 5)
            {
                //未完成
                if (app.RelateBusiness == "N")
                {
                    bt_Cancel.Visible = true;
                }
                tr_UploadAtt.Visible = true;
            }
        }
        #endregion

        #region 显示申请详细信息IFrame
        //显示申请详细信息IFrame
        if (!string.IsNullOrEmpty(task.Model.RelateURL))
        {
            hyl_RelateURL.NavigateUrl = task.Model.RelateURL;
            tr_RelateUrl.Visible      = true;
            string url = this.ResolveClientUrl(task.Model.RelateURL);
            if (url.IndexOf('?') >= 0)
            {
                url += "&ViewFramework=False";
            }
            else
            {
                url += "?ViewFramework=False";
            }
            frame_relateurl.Attributes.Add("src", url);
        }
        else
        {
            tr_RelateUrl.Visible  = false;
            hyl_RelateURL.Visible = false;
        }
        #endregion


        //Bind the dataobject info
        pl_dataobjectinfo.BindData(task.Model.DataObjectValues);
        if (task.Model.Status > 1)
        {
            pl_dataobjectinfo.SetPanelEnable(false);

            TextBox tbx_ReMark = pl_dataobjectinfo.FindControl("C_Remark") != null ? (TextBox)pl_dataobjectinfo.FindControl("C_Remark") : null;
            if (tbx_ReMark != null)
            {
                tbx_ReMark.Enabled  = true;
                tbx_ReMark.ReadOnly = true;
            }
        }

        //绑定环节列表
        gv_List_JobList.BindGrid <EWF_Task_Job>(task.GetJobList());
    }