Exemplo n.º 1
0
        /// <summary>
        /// 根据流程编号返回流程ID
        /// </summary>
        /// <param name="workFlowCode"></param>
        /// <param name="companyID"></param>
        /// <returns></returns>
        public static int getWorkFlowIdByWorkFlowCode(string workFlowCode, int companyID = 0)
        {
            T_WorkFlow_BLL workFlowBLL = new T_WorkFlow_BLL();
            string         strWhere    = " lower(WorkFlowCode)='" + workFlowCode.ToLower() + "' ";

            if (companyID > 0)
            {
                strWhere += "and CompanyID=" + companyID;
            }
            T_WorkFlow_MDL workFlowMDL = workFlowBLL.GetModelList(strWhere).ToList().FirstOrDefault();

            return(workFlowMDL == null ? 0 : workFlowMDL.WorkFlowID);
        }
        /// <summary>
        /// 绑定所有菜单,流程,权限按钮
        /// </summary>
        private void BindModule()
        {
            if (!String.IsNullOrWhiteSpace(ddlRole.SelectValue))
            {
                DataTable roleDt = roleRightBLL.GetList("RoleID=" + ddlRole.SelectValue).Tables[0];

                #region 菜单
                StringBuilder strBuilder = new StringBuilder();
                strBuilder.Append("<table>");
                strBuilder.Append("     <thead>");
                strBuilder.Append("         <tr>");
                strBuilder.Append("             <th width=\"190px\">模块名称</th>");
                strBuilder.Append("             <th>权限按钮<input type=\"checkbox\" onclick=\"selAll(0,1,this)\" /></th>");
                strBuilder.Append("         </tr>");
                strBuilder.Append("     </thead> ");
                strBuilder.Append("     <tbody class=\"tbody\">");

                string ParentName = string.Empty;
                string ParentID   = string.Empty;
                string ModuleID   = string.Empty;
                string ModuleName = string.Empty;

                DataTable moduleDT = moduleBLL.GetCustomModuleList();
                var       index    = 0;
                foreach (DataRow row in moduleDT.Rows)
                {
                    index++;
                    ParentID   = ConvertEx.ToString(row["parentid"]);
                    ModuleID   = ConvertEx.ToString(row["Moduleid"]);
                    ModuleName = ConvertEx.ToString(row["modulename"]);

                    if (ParentName == string.Empty || ParentName != ConvertEx.ToString(row["ParentName"]))
                    {
                        strBuilder.Append("         <tr class=\"" + (index % 2 == 0 ? "bg01" : "") + "\">");
                        strBuilder.Append("             <td width=\"190px\">" + ConvertEx.ToString(row["ParentName"]) + "</td>");
                        strBuilder.Append("             <td><input type=\"checkbox\" onclick=\"selAll(1," + ParentID + ",this)\" /></td>");
                        strBuilder.Append("         </tr>");
                    }
                    strBuilder.Append("         <tr class=\"" + (index % 2 == 0 ? "bg01" : "") + "\">");
                    strBuilder.Append("             <td width=\"190px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                    strBuilder.Append("                 <input type=\"checkbox\" onclick=\"selAll(2," + ModuleID + ",this)\" />" + ModuleName);
                    strBuilder.Append("             </td>");
                    strBuilder.Append("             <td>");

                    foreach (T_SystemInfo_MDL sysInfoMDL in GetRightCharList(ConvertEx.ToString(row["RightListID"]), SystemSet._MENURIGHTCHAR))
                    {
                        strBuilder.Append("<input type=\"checkbox\" allChk=\"1\" parentMenu=\"" + ParentID + "\" sonMenu=\"" + ModuleID + "\"  ");
                        strBuilder.Append(SetRightCharChecked(roleDt, ConvertEx.ToInt(ddlRole.SelectValue),
                                                              ConvertEx.ToInt(ModuleID), 1, sysInfoMDL.SystemInfoCode));
                        strBuilder.Append("value=\"" + sysInfoMDL.SystemInfoCode + "\" />" + sysInfoMDL.SystemInfoName + "&nbsp;&nbsp;");
                    }
                    strBuilder.Append("             </td>");
                    strBuilder.Append("         </tr>");

                    ParentName = ConvertEx.ToString(row["ParentName"]);
                }
                strBuilder.Append("     </tbody> ");
                strBuilder.Append("</table>");
                ltMenuHtml.Text = strBuilder.ToString();

                strBuilder.Clear();
                strBuilder.Append("<table>");
                strBuilder.Append("     <thead>");
                strBuilder.Append("         <tr>");
                strBuilder.Append("             <th width=\"190px\">流程名称</th>");
                strBuilder.Append("             <th>权限按钮<input type=\"checkbox\" onclick=\"selAll(3,2,this)\" /></th>");
                strBuilder.Append("         </tr>");
                strBuilder.Append("     </thead> ");
                strBuilder.Append("     <tbody class=\"tbody\">");
                #endregion

                #region 内页
                strBuilder.Clear();
                strBuilder.Append("<table>");
                strBuilder.Append("     <thead>");
                strBuilder.Append("         <tr>");
                strBuilder.Append("             <th width=\"190px\">内页模块名称</th>");
                strBuilder.Append("             <th>权限按钮<input type=\"checkbox\" onclick=\"selAll(5,3,this)\" /></th>");
                strBuilder.Append("         </tr>");
                strBuilder.Append("     </thead> ");
                strBuilder.Append("     <tbody class=\"tbody\">");

                index = 0;
                IList <T_Module_MDL> ltModule = moduleBLL.GetModelList("IfInsidePage=1 and IfVisible=1");
                foreach (T_Module_MDL moduleMDL in ltModule)
                {
                    index++;
                    strBuilder.Append("         <tr class=\"" + (index % 2 == 0 ? "bg01" : "") + "\">");
                    strBuilder.Append("             <td width=\"190px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                    strBuilder.Append("                 <input type=\"checkbox\" onclick=\"selAll(6,'" + moduleMDL.BH + "',this)\" />" + moduleMDL.ModuleName);
                    strBuilder.Append("             </td>");
                    strBuilder.Append("             <td>");
                    foreach (T_SystemInfo_MDL sysInfoMDL in GetRightCharList(moduleMDL.RightListID, SystemSet._MENURIGHTCHAR))
                    {
                        strBuilder.Append("<input type=\"checkbox\" allChk=\"3\" ModelBH=\"" + moduleMDL.BH + "\"  ");
                        strBuilder.Append(SetRightCharChecked(roleDt, ConvertEx.ToInt(ddlRole.SelectValue),
                                                              0, 3, sysInfoMDL.SystemInfoCode, moduleMDL.BH));
                        strBuilder.Append("value=\"" + sysInfoMDL.SystemInfoCode + "\" />" + sysInfoMDL.SystemInfoName + "&nbsp;&nbsp;");
                    }
                    strBuilder.Append("             </td>");
                    strBuilder.Append("         </tr>");
                }
                strBuilder.Append("     </tbody> ");
                strBuilder.Append("</table>");
                ltInsidePageHtml.Text = strBuilder.ToString();
                #endregion

                #region 流程
                if (!String.IsNullOrWhiteSpace(ddlCompany.SelectValue))
                {
                    strBuilder.Clear();
                    strBuilder.Append("<table>");
                    strBuilder.Append("     <thead>");
                    strBuilder.Append("         <tr>");
                    strBuilder.Append("             <th width=\"190px\">流程名称</th>");
                    strBuilder.Append("             <th>权限按钮<input type=\"checkbox\" onclick=\"selAll(3,2,this)\" /></th>");
                    strBuilder.Append("         </tr>");
                    strBuilder.Append("     </thead> ");
                    strBuilder.Append("     <tbody class=\"tbody\">");

                    index = 0;
                    IList <T_WorkFlow_MDL> ltWorkFlow = flowBLL.GetModelList("CompanyID=" + ddlCompany.SelectValue);
                    foreach (T_WorkFlow_MDL flowMDL in ltWorkFlow)
                    {
                        index++;
                        strBuilder.Append("         <tr class=\"" + (index % 2 == 0 ? "bg01" : "") + "\">");
                        strBuilder.Append("             <td width=\"190px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                        strBuilder.Append("                 <input type=\"checkbox\" onclick=\"selAll(4," + flowMDL.WorkFlowID + ",this)\" />" + flowMDL.WorkFlowName);
                        strBuilder.Append("             </td>");
                        strBuilder.Append("             <td>");
                        foreach (T_SystemInfo_MDL sysInfoMDL in GetRightCharList(flowMDL.RightListID, SystemSet._WORKFLOWRIGHTCHAR))
                        {
                            strBuilder.Append("<input type=\"checkbox\" allChk=\"2\" parentWorkFlow=\"" + flowMDL.WorkFlowID + "\"  ");
                            strBuilder.Append(SetRightCharChecked(roleDt, ConvertEx.ToInt(ddlRole.SelectValue),
                                                                  flowMDL.WorkFlowID, 2, sysInfoMDL.SystemInfoCode));
                            strBuilder.Append("value=\"" + sysInfoMDL.SystemInfoCode + "\" />" + sysInfoMDL.SystemInfoName + "&nbsp;&nbsp;");
                        }
                        strBuilder.Append("             </td>");
                        strBuilder.Append("         </tr>");
                    }
                    strBuilder.Append("     </tbody> ");
                    strBuilder.Append("</table>");
                    ltWorkFlowHtml.Text = strBuilder.ToString();
                }
                #endregion
            }
        }