using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Text;
using System.Text.RegularExpressions;
using DSWeb.SoftMng.BLL;
using DSWeb.SoftMng.Model;
using System.Linq;
using System.Web.Script.Serialization;
using DSWeb.SoftMng.Filter;
using DSWeb.SoftMng.Common;
namespace DSWeb.Modules
{
public partial class ModuleGridSource : System.Web.UI.Page
{
private string strHandle;//值list表示返回数据信息
private int iCurrentPage;//当前页数
private int iShowPage;//显示最大页数
private string strSearch;//查询条件
private string strModuleID;//模块GID
private string strSelectedUserID;//被操作人GID
private string strSelectedModuleID;//被操作模块GID
private string strSearchShowName;//要查询的用户名
private string strSearchDeptName;//要查询的部门名称
private string strSearchModuleName;//要查询的模块名称
private string strUserID;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
#region 传值参数
if (Request.QueryString["handle"] != null)
{
strHandle = Request.QueryString["handle"].ToString().ToLower().Trim();
}
if (Request.QueryString["search"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
strSearch = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["search"].ToString())));
}
if (Request.QueryString["id"] != null)
{
strModuleID = Request.QueryString["id"].ToString();
}
if (Request.QueryString["cur_page"] != null)
{
iCurrentPage = int.Parse(Request.QueryString["cur_page"].ToString().Trim());
}
else
{
iCurrentPage = 0;
}
if (Request.QueryString["show_page"] != null)
{
iShowPage = int.Parse(Request.QueryString["show_page"].ToString().Trim());
}
else
{
iShowPage = 0;
}
if (Request.QueryString["seluser"] != null)
{
strSelectedUserID = Request.QueryString["seluser"].ToString();
}
if(Request.QueryString["searchuser"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
strSearchShowName = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["searchuser"].ToString())));
}
if (Request.QueryString["searchdept"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
strSearchDeptName = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["searchdept"].ToString())));
}
if (Request.QueryString["searchmod"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
strSearchModuleName = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["searchmod"].ToString())));
}
if (Request.QueryString["selmod"] != null)
{
strSelectedModuleID = Request.QueryString["selmod"].ToString();
}
if (strHandle != null)
{
if (strHandle.Equals("list"))
{
Response.Write(GetModulesList());
}
if (strHandle.Equals("modtree"))
{
Response.Write(GetModuleTree());
}
if (strHandle.Equals("listpage"))
{
Response.Write(GetModulesListPage().ToString());
}
if (strHandle.Equals("delete") && strModuleID != null)
{
Response.Write(DeleteModule(strModuleID));
}
if (strHandle.Equals("modusertree") && strSelectedUserID != null)
{
Response.Write(GetUserModuleTree(strSelectedUserID));
}
if (strHandle.Equals("checkuser") && strSearchShowName != null)
{
Response.Write(SearchUserByName(strSearchShowName));
}
if (strHandle.Equals("checkdept") && strSearchDeptName != null)
{
Response.Write(SearchDeptByName(strSearchDeptName));
}
if (strHandle.Equals("checkmod") && strSearchModuleName != null)
{
Response.Write(SearchModuleByName(strSearchModuleName));
}
if (strHandle.Equals("addmod") && strSelectedUserID != null && strSelectedModuleID != null)
{
Response.Write(AddUserModule(strSelectedUserID, strSelectedModuleID));
}
if (strHandle.Equals("removemod") && strSelectedUserID != null && strSelectedModuleID != null)
{
Response.Write(RemoveUserModule(strSelectedUserID, strSelectedModuleID));
}
if (strHandle.Equals("validusermod") && strModuleID != null)
{
Response.Write(ValidateExistUserActionModule(strModuleID));
}
}
#endregion
}
#region 验证当前模块是否已经被指定到用户ACTION
///
/// 验证当前模块是否已经被指定到用户ACTION
///
/// 模块GID
/// 值1表示存在 值不等于1表示不存在
private int ValidateExistUserActionModule(string tempModuleID)
{
int iResult = 0;
UserActionDA userActionDA = new UserActionDA();
int iTempCount = userActionDA.GetExistUserActionModule(tempModuleID);
if (iTempCount > 0)
{
iResult = 1;
}
else
{
iResult = -1;
}
return iResult;
}
#endregion
#region 移除用户权限模块
///
/// 移除用户权限模块
///
/// 用户GID
/// 模块GID
/// 值1表示移除成功 值不等1表示移除失败
public string RemoveUserModule(string tempSelectedUserID,string tempSelectedModuleID)
{
string iResult = "";
UserActionDA userActionDA = new UserActionDA();
//先判断当前要添加的模块是否用户已经开通了
if (userActionDA.IsExistUserModule(tempSelectedUserID, tempSelectedModuleID))
{
iResult = userActionDA.DeleteUserAction(tempSelectedUserID, tempSelectedModuleID)==1?"1": tempSelectedModuleID+":删除失败";
}
else
{
iResult = tempSelectedModuleID + ":不存在相应的模块权限";//不存在相应的模块权限
}
return iResult;
}
#endregion
#region 添加用户权限模块
///
/// 添加用户权限模块
///
/// 用户GID
/// 模块GID
/// 值1表示添加成功 值不等1表示添加失败
public string AddUserModule(string tempSelectedUserID, string tempSelectedModuleID)
{
UserActionDA userActionDA = new UserActionDA();
sys_secCompanyBLL arg_1C_0 = new sys_secCompanyBLL();
sys_module model = new sys_moduleBLL().GetModel(tempSelectedModuleID);
sys_secCompany sys_secCompany = arg_1C_0.GetModelList("").FirstOrDefault();
if (sys_secCompany == null)
{
return "未配置相关参数,表 [Sys_SecCompany] 无数据";
}
if (new JavaScriptSerializer().Deserialize(DSWeb.SoftMng.Common.Common.string_Decrypt(sys_secCompany.CompanySecretKey, "Dw9pVb9r")).MenuControl)
{
int recordCount = new user_actionBLL().GetRecordCount("ACTIONID =(SELECT TOP 1 GID FROM [ACTION] WHERE MODULEID='" + tempSelectedModuleID + "') AND USERID in (select Gid from [user])");
sys_secModule sys_secModule = new sys_secModuleBLL().GetModelList("IdenSecretkey = '" + DSWeb.SoftMng.Common.Common.string_Encrypt(tempSelectedModuleID, "2cP46Gox") + "'").FirstOrDefault();
if (sys_secModule == null)
{
return "模块【" + model.DESCRIPTION + "】已被禁用,无操作权限";
}
SecrietStr secrietStr = new JavaScriptSerializer().Deserialize(DSWeb.SoftMng.Common.Common.string_Decrypt(sys_secModule.ModuleSecretkey, "2cP46Gox"));
if (!Convert.ToBoolean(secrietStr.Enabled))
{
return "模块【" + secrietStr.Name + "】已被禁用";
}
if (recordCount >= Convert.ToInt32(secrietStr.Times))
{
return string.Concat(new object[]
{
"模块【",
secrietStr.Name,
"】使用人数超出系统限制,限制",
secrietStr.Times,
"人,已分配",
recordCount,
"人"
});
}
if (!userActionDA.IsExistUserModule(tempSelectedUserID, tempSelectedModuleID))
{
return userActionDA.InsertUserAction(tempSelectedUserID, tempSelectedModuleID, Session["USERID"].ToString())==1? "模块【" + model.DESCRIPTION + "】添加成功" : "模块【" + model.DESCRIPTION + "】添加失败";
}
return "";
}
else
{
if (!userActionDA.IsExistUserModule(tempSelectedUserID, tempSelectedModuleID))
{
return userActionDA.InsertUserAction(tempSelectedUserID, tempSelectedModuleID, Session["USERID"].ToString()) == 1 ? "模块【" + model.DESCRIPTION + "】添加成功" : "模块【" + model.DESCRIPTION + "】添加失败";
}
return "";
}
}
#endregion
#region 通过模块名称模糊查询获取模块信息
///
/// 通过模块名称模糊查询获取模块信息
///
/// 模块名称
/// 返回模块JSON
private string SearchModuleByName(string tempModuleName)
{
StringBuilder searchModBuilder = new StringBuilder();
ModuleDA moduleDA = new ModuleDA();
IList moduleEntities = new List();
moduleEntities = moduleDA.GetModuleByDescriptionLike(tempModuleName);
searchModBuilder.Append("{");
searchModBuilder.Append("\"mods\":");
searchModBuilder.Append("[");
if (moduleEntities.Count > 0)
{
for (int i = 0; i < moduleEntities.Count; i++)
{
if (i == moduleEntities.Count - 1)
{
searchModBuilder.Append("{");
searchModBuilder.Append("\"gid\":\"" + moduleEntities[i].Gid + "\",");
searchModBuilder.Append("\"modname\":\"" + moduleEntities[i].ModuleName + "\"");
searchModBuilder.Append("}");
}
else
{
searchModBuilder.Append("{");
searchModBuilder.Append("\"gid\":\"" + moduleEntities[i].Gid + "\",");
searchModBuilder.Append("\"modname\":\"" + moduleEntities[i].ModuleName + "\"");
searchModBuilder.Append("},");
}
}
}
searchModBuilder.Append("]");
searchModBuilder.Append("}");
return searchModBuilder.ToString();
}
#endregion
#region 通过部门名称模糊查询获取部门信息
///
/// 通过部门名称模糊查询获取部门信息
///
/// 部门名称
/// 返回部门JSON
private string SearchDeptByName(string tempDeptName)
{
StringBuilder searchDeptBuilder = new StringBuilder();
SysDeptDA sysDeptDA = new SysDeptDA();
IList sysDeptEntities = new List();
sysDeptEntities = sysDeptDA.GetDeptsByDeptName(tempDeptName);
searchDeptBuilder.Append("{");
searchDeptBuilder.Append("\"depts\":");
searchDeptBuilder.Append("[");
if (sysDeptEntities.Count > 0)
{
for (int i = 0; i < sysDeptEntities.Count; i++)
{
if (i == sysDeptEntities.Count - 1)
{
searchDeptBuilder.Append("{");
searchDeptBuilder.Append("\"gid\":\"" + sysDeptEntities[i].GID + "\",");
searchDeptBuilder.Append("\"deptname\":\"" + sysDeptEntities[i].DEPTNAME + "\"");
searchDeptBuilder.Append("}");
}
else
{
searchDeptBuilder.Append("{");
searchDeptBuilder.Append("\"gid\":\"" + sysDeptEntities[i].GID + "\",");
searchDeptBuilder.Append("\"deptname\":\"" + sysDeptEntities[i].DEPTNAME + "\"");
searchDeptBuilder.Append("},");
}
}
}
searchDeptBuilder.Append("]");
searchDeptBuilder.Append("}");
return searchDeptBuilder.ToString();
}
#endregion
#region 根据检索的用户名称进行模糊查询
///
/// 根据检索的用户名称进行模糊查询
///
/// 用户ShowName
/// 返回JSON数据
private string SearchUserByName(string tempShowName)
{
StringBuilder searchUserBuilder = new StringBuilder();
UserDA userDA = new UserDA();
IList userEntities = new List();
userEntities = userDA.GetUserByShowNameLike(tempShowName);
searchUserBuilder.Append("{");
searchUserBuilder.Append("\"users\":");
searchUserBuilder.Append("[");
if (userEntities.Count > 0)
{
for(int i=0;i
/// 删除模块信息
///
/// 模块GID
/// 值1表示删除成功 值-1表示删除失败 值-2表示当前模板下有子模板不能删除,需要将所有子模板删除后,才能删除此模板
private int DeleteModule(string tempModuleGID)
{
int iResult = 0;
IList moduleEntities = new List();
ModuleDA moduleDA = new ModuleDA();
moduleEntities = moduleDA.GetSubModule(tempModuleGID);
if (moduleEntities.Count > 0)
{
iResult = -2;//表示当前模板下有子模板不能删除,需要将所有子模板删除后,才能删除此模板
}
else
{
iResult = moduleDA.DeleteModule(tempModuleGID);
}
return iResult;
}
#endregion
#region 获取模块列表总页数
///
/// 获取模块列表总页数
///
/// 返回总页数
private int GetModulesListPage()
{
ModuleDA moduleDA = new ModuleDA();
string strSql = "SELECT COUNT(*) FROM sys_module WHERE 1>0 ";
string strCondition = "";
if (strSearch != null)
{
if (!strSearch.Trim().Equals(""))
{
string tempSearch = strSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "name"://Customer
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
strCondition += String.Format(" AND (NAME LIKE '%{0}%' OR DESCRIPTION LIKE '%{0}%') ", strArg[1].Replace("\"", ""));
}
break;
case "url"://BillNO
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
strCondition += String.Format(" AND MODULEURL LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
}
break;
case "parent"://ETD BeginDate
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
strCondition += String.Format(" AND PARENTID IN (SELECT GID FROM sys_module WHERE NAME LIKE '%{0}%' OR DESCRIPTION LIKE '%{0}%') ", strArg[1].Replace("\"", ""));
}
break;
default:
break;
}
}
}
strSql += strCondition;
}
}
int iTotal = int.Parse(moduleDA.GetExcuteSql(strSql).Tables[0].Rows[0][0].ToString());
return iTotal;
}
#endregion
#region 获取模块列表信息
///
/// 获取模块列表信息
///
/// 返回JSON列表信息
private string GetModulesList()
{
ModuleDA moduleDA = new ModuleDA();
DataTable sourceTable;
string strCondition = "";
string strTopInclude = "";
string strTopNotInclude = "";
if (strSearch != null)
{
if (!strSearch.Trim().Equals(""))
{
string tempSearch = strSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "name"://Customer
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
strCondition += String.Format(" AND (NAME LIKE '%{0}%' OR DESCRIPTION LIKE '%{0}%') ", strArg[1].Replace("\"", ""));
}
break;
case "url"://BillNO
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
strCondition += String.Format(" AND MODULEURL LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
}
break;
case "parent"://ETD BeginDate
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
strCondition += String.Format(" AND PARENTID IN (SELECT GID FROM sys_module WHERE NAME LIKE '%{0}%' OR DESCRIPTION LIKE '%{0}%') ", strArg[1].Replace("\"", ""));
}
break;
default:
break;
}
}
}
}
}
string strSql = "";
if (iCurrentPage > 0 && iShowPage > 0)
{
if (iCurrentPage == 1)
{
strSql = String.Format(" SELECT {0} A.GID, A.NAME, A.DESCRIPTION, A.MODULEURL,A.MODULEICON, A.STATE, A.SORT, '查看',B.SHOWNAME, A.CREATETIME,A.TYPE "
+ " FROM sys_module as A LEFT JOIN [user] as B ON A.CREATEUSER = B.GID WHERE 1>0 " + strCondition + " ORDER BY A.NAME ASC ", "top " + iShowPage.ToString());
}
else
{
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
strTopInclude = "top " + iShowPage.ToString();
strSql = String.Format(" SELECT {0} A.GID, A.NAME, A.DESCRIPTION, A.MODULEURL,A.MODULEICON, A.STATE, A.SORT, '查看',B.SHOWNAME, A.CREATETIME,A.TYPE "
+ " FROM sys_module as A LEFT JOIN [user] as B ON A.CREATEUSER = B.GID WHERE 1>0 AND A.GID NOT IN "
+ " (SELECT {1} GID FROM sys_module WHERE 1>0 " + strCondition + " ORDER BY NAME ASC ) " + strCondition
+ " ORDER BY A.NAME ASC ", strTopInclude, strTopNotInclude);
}
}
else
{
strSql = " SELECT A.GID, A.NAME, A.DESCRIPTION, A.MODULEURL,A.MODULEICON, A.STATE, A.SORT, '查看',B.SHOWNAME, A.CREATETIME,A.TYPE "
+ " FROM sys_module as A LEFT JOIN [user] as B ON A.CREATEUSER = B.GID WHERE 1>0 " + strCondition + " ORDER BY A.NAME ASC ";
}
sourceTable = moduleDA.GetExcuteSql(strSql).Tables[0];
StringBuilder sourceBuilder = new StringBuilder();
sourceBuilder.Append("{");
sourceBuilder.Append("rows:[");
for (int i = 0; i < sourceTable.Rows.Count; i++)
{
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
sourceBuilder.Append("data:[");
sourceBuilder.Append("\"0\",");
for (int j = 1; j < sourceTable.Columns.Count; j++)
{
if (j == sourceTable.Columns.Count - 1)
{
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\"");
}
else
{
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\",");
}
}
if (i == sourceTable.Rows.Count - 1)
{
sourceBuilder.Append("]}");
}
else
{
sourceBuilder.Append("]},");
}
}
sourceBuilder.Append("]");
sourceBuilder.Append("}");
return sourceBuilder.ToString();
}
#endregion
#region 获取树JSON信息
///
/// 获取树JSON信息
///
/// 返回树JSON信息
private string GetModuleTree()
{
ModuleDA moduleDA = new ModuleDA();
IList moduleEntities = new List();
moduleEntities = moduleDA.GetAll();
IList parentModuleEntities = new List();
parentModuleEntities = moduleDA.GetParentModule();
List tempEntities = moduleDA.GetAllSubModules();
StringBuilder leftNav = new StringBuilder();
StringBuilder sourceBuilder = new StringBuilder();
StringBuilder subBuilder = new StringBuilder();
sourceBuilder.Append("{id:0");
if (parentModuleEntities.Count > 0)
{
sourceBuilder.Append(",item:[");
foreach (ModuleEntity parentModuleEntity in parentModuleEntities)
{
subBuilder.Append("{id:\"" + parentModuleEntity.Gid + "\",");
subBuilder.Append("text:\"" + parentModuleEntity.ModuleDescription + "\"");
string strItems = "";
strItems = GetSubJs(parentModuleEntity.Gid, tempEntities, "");
if (!strItems.Trim().Equals(""))
{
subBuilder.Append(",item:[");
subBuilder.Append(strItems);
subBuilder.Append("]},");
}
else
{
subBuilder.Append("},");
}
}
string strChilds = subBuilder.ToString();
strChilds = strChilds.Substring(0, strChilds.Length - 1);//去除末尾逗号
sourceBuilder.Append(strChilds);
sourceBuilder.Append("]");
}
sourceBuilder.Append("}");
return sourceBuilder.ToString();
}
#endregion
#region 获取树JSON信息
///
/// 获取树JSON信息
///
/// 返回树JSON信息
private string GetUserModuleTree(string tempSelectedUserID)
{
ModuleDA moduleDA = new ModuleDA();
IList moduleEntities = new List();
moduleEntities = moduleDA.GetUserAll(tempSelectedUserID);
IList parentModuleEntities = new List();
parentModuleEntities = moduleDA.GetUserParentModule(tempSelectedUserID);
List tempEntities = moduleDA.GetUserAllSubModules(tempSelectedUserID);
StringBuilder leftNav = new StringBuilder();
StringBuilder sourceBuilder = new StringBuilder();
StringBuilder subBuilder = new StringBuilder();
sourceBuilder.Append("{id:0");
if (parentModuleEntities.Count > 0)
{
sourceBuilder.Append(",item:[");
foreach (ModuleEntity parentModuleEntity in parentModuleEntities)
{
subBuilder.Append("{id:\"" + parentModuleEntity.Gid + "\",");
subBuilder.Append("text:\"" + parentModuleEntity.ModuleDescription + "\"");
string strItems = "";
strItems = GetSubJs(parentModuleEntity.Gid, tempEntities, "");
if (!strItems.Trim().Equals(""))
{
subBuilder.Append(",item:[");
subBuilder.Append(strItems);
subBuilder.Append("]},");
}
else
{
subBuilder.Append("},");
}
}
string strChilds = subBuilder.ToString();
strChilds = strChilds.Substring(0, strChilds.Length - 1);//去除末尾逗号
sourceBuilder.Append(strChilds);
sourceBuilder.Append("]");
}
sourceBuilder.Append("}");
return sourceBuilder.ToString();
}
#endregion
#region 获取所有子模块信息
///
/// 获取所有子模块信息
///
/// 父节点GID
/// 全部子节点实体类
/// 返回值
/// JSON树信息
public String GetSubJs(string parentGid, List tempEntities, string tempJSON)
{
StringBuilder valBuilder = new StringBuilder();
StringBuilder childBuilder = new StringBuilder();
foreach (ModuleEntity mdle in tempEntities)
{
if (parentGid.Trim().Equals(mdle.ParentID))
{
bool isParentNode = IsParent(tempEntities, mdle.Gid);
string strTempNode = GetJSON(mdle, isParentNode);
string strTempValue = "";
if (isParentNode)
{
strTempValue = GetSubJs(mdle.Gid, tempEntities, strTempNode);
childBuilder.Append(strTempValue);
}
if (strTempValue.Trim().Equals(""))
{
childBuilder.Append(strTempNode);
}
}
}
if (childBuilder.Length > 1)
{
string strChilds = childBuilder.ToString();
strChilds = strChilds.Substring(0, strChilds.Length - 1);//去除末尾逗号
if (!tempJSON.Equals(""))
{
tempJSON = tempJSON.Replace("{0}", strChilds);
valBuilder.Append(tempJSON);
}
else
{
valBuilder.Append(strChilds);
}
}
return valBuilder.ToString();
}
#endregion
#region 获取节点JSON信息
///
/// 获取节点JSON信息
///
///
///
///
private string GetJSON(ModuleEntity tempModuleEntity, bool tempIsParent)
{
StringBuilder jsonBuilder = new StringBuilder();
jsonBuilder.Append("{id:\"" + tempModuleEntity.Gid + "\",");
jsonBuilder.Append("text:\"" + tempModuleEntity.ModuleDescription + "\"");
if (tempIsParent)//如果当前节点有子节点,则增加子节点信息 item[{0}]
{
jsonBuilder.Append(",item:[{0}]},");
}
else
{
jsonBuilder.Append("},");
}
return jsonBuilder.ToString();
}
#endregion
/////
///// 获取
/////
/////
/////
//private string GetNodeJSON(ModuleEntity tempModuleEntity)
//{
// StringBuilder NodeBuilder = new StringBuilder();
// NodeBuilder.Append("id:" + tempModuleEntity.Gid + ",");
// NodeBuilder.Append("text:" + tempModuleEntity.ModuleDescription + ",");
// return NodeBuilder.ToString();
//}
#region 遍历模块查看此模块是否为父模块
///
/// 遍历模块查看此模块是否为父模块
///
/// 所有节点信息实体类
/// 要查询的模块GID
/// True-存在子节点 False-不存在子节点
public bool IsParent(List tempEntities, string strGID)
{
bool IsExist = false;
foreach (ModuleEntity mdle in tempEntities)
{
if (mdle.ParentID.Trim().Equals(strGID))
{
IsExist = true;
}
}
return IsExist;
}
#endregion
}
}