/// <summary> /// 生成模块信息 /// </summary> /// <param name="sb">字符串</param> static void BuildModule(ref StringBuilder sb) { var mdlList = DawnAuthModuleBLL.ISelect("mdl_ident<1", "mdl_rank"); if (mdlList.Count > 0) { sb.Append("\n"); sb.Append("#region 模块列表\n"); sb.Append("\n"); foreach (var item in mdlList) { sb.Append("/// <summary>\n"); sb.AppendFormat("/// {0}\n", item.MdlName); if (!string.IsNullOrEmpty(item.MdlDesc)) { sb.Append("/// <remarks>\n"); sb.AppendFormat("/// {0}\n", item.MdlDesc); sb.Append("/// </remarks>\n"); } sb.Append("/// </summary>\n"); sb.AppendFormat("public const string ModuleBy{0} = \"{0}\";\n", item.MdlCode); } sb.Append("\n"); sb.Append("#endregion\n"); } }
/// <summary> /// 模块功能数据列表 /// </summary> /// <param name="id">数据表单</param> /// <returns>执行结果</returns> public ActionResult Search(FormCollection form) { string strWhere = null; var pgParam = "Nothing,Nothing"; //隶属模块 var sltModule = TypeHelper.TypeToInt32(form["sltModule"], -1); if (sltModule > 0) { pgParam += string.Format(",sltModule,{0}", sltModule); if (strWhere == null) { strWhere = string.Format("mdl_id='{0}'", sltModule); } else { strWhere += string.Format(" and mdl_id='{0}'", sltModule); } } //功能编码 var txtCode = form["txtCode"] as string; if (!string.IsNullOrEmpty(txtCode) && ValidHelper.EngIsEngAndNums(txtCode)) { pgParam += string.Format(",txtCode,{0}", txtCode); if (strWhere == null) { strWhere = string.Format("charindex('{0}',fun_code)>0", txtCode); } else { strWhere += string.Format(" and charindex('{0}',fun_code)>0", txtCode); } } var dataPager = new PagerHelperCHS(); dataPager.PageSize = GeneralHandler.PageSize; if (form.Count > 1) { dataPager.PageCurrent = TypeHelper.TypeToInt32(form["pager"], 1); } else { dataPager.PageCurrent = TypeHelper.TypeToInt32(form["id"], 1); } int pageCount, recordCount; var dataList = DawnAuthFunctionBLL.SelectPSPisAllPurposeRowNumber(dataPager.PageSize, dataPager.PageCurrent, "fun_time desc,mdl_id", strWhere, out pageCount, out recordCount); dataPager.PageCount = pageCount; dataPager.RecordCount = recordCount; dataPager.PageRecordCount = dataList.Count; ViewBag.Pager = dataPager; ViewBag.PagerParam = pgParam; ViewBag.ModuleList = DawnAuthModuleBLL.ISelect(); return(View("List", dataList)); }
/// <summary> /// 递归模块信息·补空格模式 /// </summary> /// <returns>数据集合</returns> public static IList <DawnAuthModuleMDL> GetPowerTree() { IList <DawnAuthModuleMDL> treeList = new List <DawnAuthModuleMDL>(); IList <DawnAuthModuleMDL> rootList = DawnAuthModuleBLL.ISelect(string.Format("mdl_father = -1 and mdl_ident > 0")); foreach (var item in rootList) { treeList.Add(item); GetPowerTreeNode(treeList, item.MdlId, " "); } return(treeList); }
/// <summary> /// 生成状态机制 /// </summary> /// <param name="sb"></param> static void BuildStatus(ref StringBuilder sb) { var mdlList = DawnAuthModuleBLL.ISelect("mdl_ident<1", "mdl_rank"); if (mdlList.Count > 0) { foreach (var mdlInfo in mdlList) { var statList = DawnAuthStatusBLL.ISelect(string.Format("mdl_id='{0}'", mdlInfo.MdlId), "stat_mark"); if (statList.Count > 0) { sb.Append("\n"); sb.AppendFormat("#region 状态机制·{0}\n", mdlInfo.MdlName); sb.Append("\n"); sb.Append("/// <summary>\n"); sb.AppendFormat("/// 状态机制·{0}\n", mdlInfo.MdlName); if (!string.IsNullOrEmpty(mdlInfo.MdlDesc)) { sb.Append("/// <remarks>\n"); sb.AppendFormat("/// {0}\n", mdlInfo.MdlDesc); sb.Append("/// </remarks>\n"); } sb.Append("/// </summary>\n"); sb.AppendFormat("public enum StatusOf{0} : int\n", mdlInfo.MdlCode); sb.Append("{\n"); int statCount = statList.Count; foreach (var statInfo in statList) { statCount--; sb.Append("/// <summary>\n"); sb.AppendFormat("/// {0}\n", statInfo.StatName); sb.Append("/// </summary>\n"); if (statCount > 0) { sb.AppendFormat("{0}={1},\n", statInfo.StatCode, statInfo.StatMark); } else { sb.AppendFormat("{0}={1}\n", statInfo.StatCode, statInfo.StatMark); } } sb.Append("}\n"); sb.Append("\n"); sb.Append("#endregion\n"); } } } }
/// <summary> /// 生成模块功能 /// </summary> /// <param name="sb">字符串</param> static void BuildFunction(ref StringBuilder sb) { var mdlList = DawnAuthModuleBLL.ISelect("mdl_ident<1", "mdl_rank"); if (mdlList.Count > 0) { foreach (var mdlInfo in mdlList) { var funList = DawnAuthFunctionBLL.ISelect(string.Format("mdl_id='{0}' and fun_ident < 1", mdlInfo.MdlId), "fun_mark"); if (funList.Count > 0) { sb.Append("\n"); sb.AppendFormat("#region {0}\n", mdlInfo.MdlName); sb.Append("\n"); sb.Append("/// <summary>\n"); sb.AppendFormat("/// {0}\n", mdlInfo.MdlName); if (!string.IsNullOrEmpty(mdlInfo.MdlDesc)) { sb.Append("/// <remarks>\n"); sb.AppendFormat("/// {0}\n", mdlInfo.MdlDesc); sb.Append("/// </remarks>\n"); } sb.Append("/// </summary>\n"); sb.AppendFormat("public enum {0} : int\n", mdlInfo.MdlCode); sb.Append("{\n"); int funCount = funList.Count; foreach (var funInfo in funList) { funCount--; sb.Append("/// <summary>\n"); sb.AppendFormat("/// {0}\n", funInfo.FunName); sb.Append("/// </summary>\n"); if (funCount > 0) { sb.AppendFormat("{0}={1},\n", funInfo.FunCode, funInfo.FunMark); } else { sb.AppendFormat("{0}={1}\n", funInfo.FunCode, funInfo.FunMark); } } sb.Append("}\n"); sb.Append("\n"); sb.Append("#endregion\n"); } } } }
/// <summary> /// 递归模块信息·子 /// </summary> /// <param name="treeList">树存储器</param> /// <param name="fId">父编号</param> /// <param name="tbMarker">符号标识</param> private static void GetTreeNode(IList <DawnAuthModuleMDL> treeList, int fId, string tbMarker) { IList <DawnAuthModuleMDL> nodeList = DawnAuthModuleBLL.ISelect(string.Format("mdl_father='{0}'", fId)); if (nodeList == null || nodeList.Count <= 0) { return; } foreach (DawnAuthModuleMDL nodeInfo in nodeList) { nodeInfo.MdlName = tbMarker + nodeInfo.MdlName; treeList.Add(nodeInfo); string strMarker = tbMarker + " "; GetTreeNode(treeList, nodeInfo.MdlId, strMarker); } }
/// <summary> /// 模块功能数据列表 /// </summary> /// <param name="id">页码</param> /// <returns>执行结果</returns> public ActionResult List(string id) { var pager = new PagerHelperCHS(); pager.PageSize = GeneralHandler.PageSize; pager.PageCurrent = TypeHelper.TypeToInt32(id, 1); int pageCount, recordCount; var dataList = DawnAuthFunctionBLL.SelectPSPisAllPurposeRowNumber(pager.PageSize, pager.PageCurrent, null, out pageCount, out recordCount); pager.PageCount = pageCount; pager.RecordCount = recordCount; pager.PageRecordCount = dataList.Count; ViewBag.Pager = pager; ViewBag.PagerParam = null; ViewBag.ModuleList = DawnAuthModuleBLL.ISelect(); return(View(dataList)); }
/// <summary> /// 生成实时模块 /// </summary> /// <param name="sb">字符串</param> static void BuildRealMoudle(ref StringBuilder sb) { var mdlList = DawnAuthModuleBLL.ISelect("mdl_ident > 0", "mdl_rank"); if (mdlList.Count > 0) { sb.Append("\n"); sb.Append("#region 实时验证模块列表\n"); sb.Append("\n"); sb.Append("/// <summary>\n"); sb.Append("/// 实时验证模块列表\n"); sb.Append("/// </summary>\n"); sb.Append("public enum RealMoudle: int\n"); sb.Append("{\n"); int mdlCount = mdlList.Count; foreach (var item in mdlList) { mdlCount--; sb.Append("/// <summary>\n"); sb.AppendFormat("/// {0}\n", item.MdlName); if (!string.IsNullOrEmpty(item.MdlDesc)) { sb.Append("/// <remarks>\n"); sb.AppendFormat("/// {0}\n", item.MdlDesc); sb.Append("/// </remarks>\n"); } sb.Append("/// </summary>\n"); if (mdlCount > 0) { sb.AppendFormat("{0}={1},\n", item.MdlCode, item.MdlIdent); } else { sb.AppendFormat("{0}={1}\n", item.MdlCode, item.MdlIdent); } } sb.Append("}\n"); sb.Append("\n"); sb.Append("#endregion\n"); } }