/// <summary>
        /// 流程类型选择事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlProcessTemplate_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.ddlProcessTemplate.SelectedIndex == 0)
            {
                //流程类型选中空行,设置流程步骤不可编辑
                this.ddlStepName.Enabled = false;
                this.ddlStepName.Items.Clear();
            }
            else
            {
                //选中一个流程类型,设置流程步骤为可编辑
                this.ddlStepName.Enabled = true;
                //得到流程类型对应的流程步骤
                TAdmin = new TemplateAdmin();
                String l_strTemplateName = this.ddlProcessTemplate.SelectedValue;
                DataTable l_dtbDataTable = TAdmin.Templates.GetTemplate(l_strTemplateName).GetVersion(1).GetViewList();

                //加入空选择行
                DataRow l_dtrDataRow = l_dtbDataTable.NewRow();
                l_dtrDataRow[0] = DBNull.Value;
                l_dtrDataRow[1] = "";
                l_dtrDataRow[2] = DBNull.Value;

                l_dtbDataTable.Rows.InsertAt(l_dtrDataRow, 0);

                //绑定数据
                this.ddlStepName.DataSource = l_dtbDataTable;
                this.ddlStepName.DataBind();
            }
            LoadTaskList();
        }
        public static TemplateAdmin CreateTemplateAdmin(Page page, bool ResetConfig)
        {
            TemplateAdmin TAdmin = new TemplateAdmin(page, ResetConfig);

            if (TAdmin == null)
            {
                throw new Exception("模板Config文件初始化失败");
            }
            return(TAdmin);
        }
 public static TemplateAdmin CreateTemplateAdmin(Page page, bool ResetConfig)
 {
     TemplateAdmin TAdmin = new TemplateAdmin(page, ResetConfig);
     if (TAdmin == null)
         throw new Exception("模板Config文件初始化失败");
     return TAdmin;
 }
        private void LoadProcessSteps()
        {
            if (this.ddlProcessTemplate.SelectedIndex == 0)
            {
                ////流程类型选中空行,设置流程步骤不可编辑
                //this.ddlStepName.Enabled = false;
                //this.ddlStepName.Items.Clear();

                VisibleTR();
            }
            else
            {
                VisibleTR();
                switch (ddlProcessTemplate.SelectedValue)
                {
                    case ProcessConstString.TemplateName.DJGT_Send:
                    case ProcessConstString.TemplateName.COMPANY_SEND: trGF.Visible = true; break;
                    case ProcessConstString.TemplateName.MERGED_RECEIVE:
                    case ProcessConstString.TemplateName.COMPANY_RECEIVE: trGS.Visible = true; break;
                    case ProcessConstString.TemplateName.LETTER_RECEIVE: trHS.Visible = true; break;
                    case ProcessConstString.TemplateName.LETTER_SEND: trHF.Visible = true; break;
                    case ProcessConstString.TemplateName.PROGRAM_FILE: trPF.Visible = true; break;
                    case ProcessConstString.TemplateName.AFFILIATION: trWR.Visible = true; break;
                    case ProcessConstString.TemplateName.INSTUCTION_REPORT: trRR.Visible = true; break;
                    default: break;
                }
                //选中一个流程类型,设置流程步骤为可编辑
                //this.ddlStepName.Enabled = true;
                //得到流程类型对应的流程步骤
                TemplateAdmin TAdmin = new TemplateAdmin();
                String strTemplateID = this.ddlProcessTemplate.SelectedValue;
                DataTable dtStep = TAdmin.Templates.GetTemplate(strTemplateID).GetVersion(1).GetViewList();

                //加入空选择行
                DataRow drStep = dtStep.NewRow();
                drStep[0] = DBNull.Value;
                drStep[1] = "";
                drStep[2] = DBNull.Value;

                dtStep.Rows.InsertAt(drStep, 0);

                ////绑定数据
                //this.ddlStepName.DataSource = dtStep;
                //this.ddlStepName.DataBind();
            }
        }
        private void GetALLProcess()
        {
            string sInfo = "";

            if (ddlFlowType.SelectedValue == "")
            {
                string sqlDEF = "SELECT DEF_Name FROM dbo.WF_PROC_DEFS WHERE STATUS='Released'";
                DataTable dtDEF = SQLHelper.GetDataTable2(sqlDEF);

                foreach (DataRow dr in dtDEF.Rows)
                {
                    string def = dr[0].ToString();
                    string sqlP = string.Format("SELECT Count(*) FROM WF_PROC_INSTS WHERE DEF_Name='{0}' ", def);
                    sqlP += GetWhere();
                    DataTable dtP = SQLHelper.GetDataTable2(sqlP);
                    if (dtP.Rows.Count > 0)
                    {
                        sInfo += def + " " + dtP.Rows[0][0].ToString() + "条。<br/>";
                    }
                }
            }
            else
            {
                #region 根据流程
                string def = ddlFlowType.SelectedValue;
                string sqlP = string.Format("SELECT Count(*) FROM WF_PROC_INSTS WHERE DEF_Name='{0}' ", def);
                sqlP += GetWhere();
                DataTable dtP = SQLHelper.GetDataTable2(sqlP);
                if (dtP.Rows.Count > 0)
                {
                    sInfo += def + " " + dtP.Rows[0][0].ToString() + "条。<br/>";
                }
                string[] pStatus = new string[] { "Running", "Completed", "Cancelled", "Suspended" };
                string[] pStatusCN = new string[] { "运行中", "已完成", "已取消","已暂停" };
                for (int pp = 0; pp < pStatus.Length; pp++)
                {
                    string sqlRunning = sqlP + string.Format(" AND STATUS='{0}'", pStatus[pp]);
                    DataTable dtRunning = SQLHelper.GetDataTable2(sqlRunning);
                    if (dtRunning.Rows.Count > 0)
                    {
                        sInfo += pStatusCN[pp] + ":" + dtRunning.Rows[0][0].ToString() + "条 ";
                    }
                }
                #endregion

                sInfo += "<br/><br/>";
                //根据步骤
                TemplateAdmin TAdmin = new TemplateAdmin();
                DataTable dtStep = TAdmin.Templates.GetTemplate(def).GetVersion(1).GetViewList();

                sInfo += "<Table border='1'>";

                foreach (DataRow dr in dtStep.Rows)
                {
            ;                    //Removed Completed Assigned New
                    string[] stepStatus = new string[] { "Completed", "Assigned", "New", "Removed", "Overdue", "Carbon", "Reassigned" };
                    string[] stepStatusCN = new string[] { "已完成", "待处理", "待获取", "已移除", "已过期", "已暂停", "重新指派" };
                    string step = dr["Name"].ToString();

                    sInfo += "<tr>";
                    sInfo += "<td>";
                    sInfo += styleRed1 + step + styleRed2 + " ";
                    sInfo += "</td>";
                    for (int kk = 0; kk < stepStatus.Length; kk++)
                    {
                        string sql = string.Format(@"SELECT Count(*) FROM WF_MANUAL_WORKITEMS a INNER JOIN
            WF_PROC_INSTS b ON a.PROC_INST_ID=b.PROC_INST_ID
            WHERE a.NAME='{0}' AND a.Status='{1}' ", step, stepStatus[kk]);
                        DataTable dt = SQLHelper.GetDataTable2(sql);
                        if (dt.Rows.Count > 0)
                        {
                            sInfo += "<td>";
                            if (stepStatusCN[kk] == "已完成")
                            {
                                sInfo += styleBlue1;
                            }
                            else if (stepStatusCN[kk] == "待处理" || stepStatusCN[kk] == "待获取")
                            {
                                sInfo += styleSilver1;
                            }
                            sInfo += stepStatusCN[kk] + " " + dt.Rows[0][0].ToString() + "条";
                            if (stepStatusCN[kk] == "已完成")
                            {
                                sInfo += styleBlue2;
                            }
                            else if (stepStatusCN[kk] == "待处理" || stepStatusCN[kk] == "待获取")
                            {
                                sInfo += styleSilver2;
                            }
                            sInfo += "</td>";
                        }
                    }
                    sInfo += "</tr>";
                }
                sInfo += "</Table>";
            }
            lblInfo.Text = sInfo;
        }
        /// <summary>
        /// 流程类型选择事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlProcessTemplate_SelectedIndexChanged(object sender, EventArgs e)
        {
            LoadProcessSteps();

            if (this.ddlProcessTemplate.SelectedIndex == 0)
            {
                this.ddlStepName.Enabled = false;
                this.ddlStepName.Items.Clear();
            }
            else
            {
                this.ddlStepName.Enabled = true;

                //得到流程类型对应的流程步骤
                TemplateAdmin TAdmin = new TemplateAdmin();
                String l_strTemplateName = this.ddlProcessTemplate.SelectedValue;
                DataTable l_dtbDataTable = TAdmin.Templates.GetTemplate(l_strTemplateName).GetVersion(1).GetViewList();

                //加入空选择行
                DataRow l_dtrDataRow = l_dtbDataTable.NewRow();
                l_dtrDataRow[0] = DBNull.Value;
                l_dtrDataRow[1] = "";
                l_dtrDataRow[2] = DBNull.Value;

                l_dtbDataTable.Rows.InsertAt(l_dtrDataRow, 0);

                //绑定数据
                this.ddlStepName.DataSource = l_dtbDataTable;
                this.ddlStepName.DataBind();
            }

            #region 根据流程类型绑定特有字段
            switch (this.ddlProcessTemplate.SelectedValue)
            {
                //公司发文
                case ProcessConstString.TemplateName.COMPANY_SEND:
                case ProcessConstString.TemplateName.DJGT_Send://renjinquan+
                    OADept.GetDeptByIfloor(drpGFDept, 1);
                    break;
                //公司收文
                case ProcessConstString.TemplateName.COMPANY_RECEIVE:
                case ProcessConstString.TemplateName.MERGED_RECEIVE://renjinquan+
                    break;
                //函件收文
                case ProcessConstString.TemplateName.LETTER_RECEIVE:
                    OAList.BindHJLX2(ddlHSLetterType, true);
                    break;
                //函件发文
                case ProcessConstString.TemplateName.LETTER_SEND:
                    OAList.BindHJLX(ddlHFLetterType, true);
                    OADept.GetDeptByIfloor(this.ddlHFDept, 1);
                    break;
                //程序文件
                case ProcessConstString.TemplateName.PROGRAM_FILE:
                    OADept.GetDeptByIfloor(this.ddlPFDept, 1);
                    break;
                //工作联系单
                case ProcessConstString.TemplateName.AFFILIATION:
                    OADept.GetDeptByIfloor(this.ddlWRHostDept, 1);
                    OADept.GetDeptByIfloor(this.ddlWRMainSendDept, 1);
                    break;
                //请示报告
                case ProcessConstString.TemplateName.INSTUCTION_REPORT:
                    OAUser.GetUserByRole(this.ddlMainSendleader, OUConstString.RoleName.COMPANY_LEADER);
                    OADept.GetDeptByIfloor(this.ddlUnderTakeDept, 1);
                    OADept.GetDeptByIfloor(this.ddlHostDept, 1);
                    break;
            }
            #endregion
            //chenye
            //LoadProcessList();
        }