/// <summary> /// 值报 /// </summary> /// <param name="repName"></param> /// <param name="unit"></param> /// <returns></returns> public ArrayList GetChartData(string Trendid, string sdate, string edate) { double drvA = 0; int ret = 0; string pName = null; ArrayList list = new ArrayList(); count = pm.GetCountByChart(Trendid); //countKey = pm.GetCountkey(repName, 1); DateTime dtNow = DateTime.Now; string[] de = null; //describe 趋势参数描述 string[] un = null; //单位 string[] dv = null; //值 string[] ma = new string[7]; //mark xy轴刻度 LogHelper.WriteLog(LogHelper.EnLogType.Run, DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + " 值报开始......."); LogHelper.WriteLog(LogHelper.EnLogType.Run, DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + " count Value=" + count); try { de = new string[count]; un = new string[count]; dv = new string[count]; //判断是否多y轴,判断是否自动y轴刻度,如果是则取出y轴刻度 sql = "select T_MULITYAXIS, T_YMAX, T_YMIN, T_YAUTO from administrator.T_INFO_CHART_USERTEMPLATE where T_CHARTID='" + Trendid + "'"; DataTable dtInfo = null; //if (rlDBType == "SQL") // dtInfo = DBsql.RunDataTable(sql, out errMsg); //else // dtInfo = DBdb2.RunDataTable(sql, out errMsg); dtInfo = dl.RunDataTable(sql, out errMsg); if (dtInfo != null && dtInfo.Rows.Count > 0) { ma[0] = dtInfo.Rows[0]["T_MULITYAXIS"].ToString(); ma[1] = dtInfo.Rows[0]["T_YAUTO"].ToString(); ma[2] = dtInfo.Rows[0]["T_YMAX"].ToString(); ma[3] = dtInfo.Rows[0]["T_YMIN"].ToString(); } else { LogHelper.WriteLog(LogHelper.EnLogType.Run, DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + " 读取[xy轴刻度]信息失败......"); } //ID_KEY, CHARTID, PARAID, PARADESC, PARATYPE, SQL, REALTIME, PERIOD, SHIFT, YMAX, YMIN, YAUTO, UNIT sql = "select count(*) from administrator.T_INFO_CHART_CHARTPARA where T_CHARTID = '" + Trendid + "' "; DataTable dtLevBZ = null; int a = 0; //if (rlDBType == "SQL") //{ // dtLevBZ = DBsql.RunDataTable(sql, out errMsg); //} //else //{ // dtLevBZ = DBdb2.RunDataTable(sql, out errMsg); //} dtLevBZ = dl.RunDataTable(sql, out errMsg); if (dtLevBZ != null && Convert.ToInt32(dtLevBZ.Rows[0][0].ToString()) > 0) { #region SQL sql = "select * from administrator.T_INFO_CHART_CHARTPARA where T_CHARTID = '" + Trendid + "' and T_PARATYPE='SQL' "; DataTable dtSQL = null; DataSet dssql = null; //if (rlDBType == "SQL") //{ // dtSQL = DBsql.RunDataTable(sql, out errMsg); //} //else //{ // dtSQL = DBdb2.RunDataTable(sql, out errMsg); //} dtSQL = dl.RunDataTable(sql, out errMsg); if (dtSQL != null && dtSQL.Rows.Count > 0) { for (int i = 0; i < dtSQL.Rows.Count; i++) { de[a] = dtSQL.Rows[i]["T_PARADESC"].ToString(); un[a] = dtSQL.Rows[i]["T_UNIT"].ToString(); ma[4] += dtSQL.Rows[i]["T_YAUTO"].ToString() + ","; ma[5] += dtSQL.Rows[i]["T_YMAX"].ToString() + ","; ma[6] += dtSQL.Rows[i]["T_YMIN"].ToString() + ","; sql = dtSQL.Rows[i]["T_SQL"].ToString(); if (sql.Contains("&bt&") && sql.Contains("&et&")) { sql = sql.Replace("&bt&", DateTime.Parse(sdate).AddSeconds(Convert.ToDouble(dtSQL.Rows[i]["T_SHIFT"].ToString())).ToString()); sql = sql.Replace("&et&", DateTime.Parse(edate).AddSeconds(Convert.ToDouble(dtSQL.Rows[i]["T_SHIFT"].ToString())).ToString()); } //if (rlDBType == "SQL") //{ // dssql = DBsql.RunDataSet(sql, out errMsg); //} //else //{ // dssql = DBdb2.RunDataSet(sql, out errMsg); //} dssql = dl.RunDataSet(sql, out errMsg); for (int j = 0; j < dssql.Tables[0].Rows.Count; j++) { dv[a] += dssql.Tables[0].Rows[j][0].ToString() + "+" + dssql.Tables[0].Rows[j][1].ToString(); if (j != dssql.Tables[0].Rows.Count - 1) { dv[a] += ","; } else { dv[a] += ";"; } } a++; } } #endregion #region 实时数据库 sql = "select * from administrator.T_INFO_CHART_CHARTPARA where T_CHARTID = '" + Trendid + "' and T_PARATYPE='RT' "; DataTable dtAvg = null; DateTime dtsql = DateTime.Now; //if (rlDBType == "SQL") //{ // dtAvg = DBsql.RunDataTable(sql, out errMsg); //} //else //{ // dtAvg = DBdb2.RunDataTable(sql, out errMsg); //} dtAvg = dl.RunDataTable(sql, out errMsg); if (dtAvg != null && dtAvg.Rows.Count > 0) { for (int i = 0; i < dtAvg.Rows.Count; i++) { de[a] = dtAvg.Rows[i]["T_PARADESC"].ToString(); un[a] = dtAvg.Rows[i]["T_UNIT"].ToString(); pName = dtAvg.Rows[i]["T_REALTIME"].ToString(); DateTime date = DateTime.Parse(sdate); while (date < DateTime.Parse(edate)) { if (rtDBType == "EDNA") { //ek.GetHisValueByTime(pName, sdate, ref ret, ref drvA); } else { // pk.GetHisValue(pName, sdate, ref drvA); } dv[a] += sdate + "+" + drvA.ToString() + ","; date = date.AddSeconds(Convert.ToDouble(dtAvg.Rows[i]["T_SHIFT"].ToString())); } a++; } } #endregion } } catch (Exception ce) { LogHelper.WriteLog(LogHelper.EnLogType.Run, DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + " 程序异常: " + ce.Message); } list.Add(de); list.Add(un); list.Add(dv); list.Add(ma); return(list); }
public bool EditMemberInfo(string userIDO, string userID, string userName, string pwd, byte[] img, string treeNodeId) { string rlDBType = dl.init(); string sql = ""; string errMsg = ""; bool result = false; if (rlDBType == "SQL") { try { if (img != null) { SqlConnection sqlconn = SAC.DBOperations.DBsql.GetConnection(); if (userIDO == userID) { sql += "update T_SYS_MEMBERINFO set T_USERNAME=@T_USERNAME,T_PASSWD=@T_PASSWD,B_ATTACHMENT=@B_ATTACHMENT where T_USERID='" + userIDO + "'"; SqlCommand sqlcmd = new SqlCommand(sql, sqlconn); sqlcmd.Parameters.Add("@T_USERNAME", userName); sqlcmd.Parameters.Add("@T_PASSWD", pwd); sqlcmd.Parameters.Add("@B_ATTACHMENT", img); if (sqlcmd.ExecuteNonQuery() > 0) { result = true; } } else { sql += "update T_SYS_MEMBERINFO set T_USERID=@T_USERID,T_USERNAME=@T_USERNAME,T_PASSWD=@T_PASSWD,B_ATTACHMENT=@B_ATTACHMENT where T_USERID='" + userIDO + "'"; SqlCommand sqlcmd = new SqlCommand(sql, sqlconn); sqlcmd.Parameters.Add("@T_USERID", userID); sqlcmd.Parameters.Add("@T_USERNAME", userName); sqlcmd.Parameters.Add("@T_PASSWD", pwd); sqlcmd.Parameters.Add("@B_ATTACHMENT", img); result = DBsql.RunNonQuery("update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';", out errMsg); if (sqlcmd.ExecuteNonQuery() > 0 && result == true) { result = true; } } sqlconn.Close(); } else { if (userIDO == userID) { sql += "update T_SYS_MEMBERINFO set T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';"; } else { sql += "update T_SYS_MEMBERINFO set T_USERID='" + userID + "',T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';"; } result = dl.RunNonQuery(sql, out errMsg); } } catch (Exception ex) { LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message); } } else if (rlDBType == "DB2") { try { if (img != null) { OleDbConnection con = new OleDbConnection(DBdb2.SetConString()); con.Open(); if (userIDO == userID) { sql += "update T_SYS_MEMBERINFO set T_USERNAME=?,T_PASSWD=?,B_ATTACHMENT=? where T_USERID='" + userIDO + "'"; OleDbCommand oledbcom = new OleDbCommand(sql, con); oledbcom.Parameters.Add("?", userName); oledbcom.Parameters.Add("?", pwd); oledbcom.Parameters.Add("?", img); if (oledbcom.ExecuteNonQuery() > 0) { result = true; } } else { sql += "update T_SYS_MEMBERINFO set T_USERID=?,T_USERNAME=?,T_PASSWD=?,B_ATTACHMENT=? where T_USERID='" + userIDO + "'"; OleDbCommand oledbcom = new OleDbCommand(sql, con); oledbcom.Parameters.Add("?", userID); oledbcom.Parameters.Add("?", userName); oledbcom.Parameters.Add("?", pwd); oledbcom.Parameters.Add("?", img); result = DBdb2.RunNonQuery("update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';", out errMsg); if (oledbcom.ExecuteNonQuery() > 0 && result == true) { result = true; } } con.Close(); } else { if (userIDO == userID) { sql += "update T_SYS_MEMBERINFO set T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';"; } else { sql += "update T_SYS_MEMBERINFO set T_USERID='" + userID + "',T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';"; } result = dl.RunNonQuery(sql, out errMsg); } } catch (Exception ex) { LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message); } } else if (rlDBType == "ORACLE") { try { if (img != null) { OracleConnection con = new OracleConnection(SAC.DBOperations.OracleHelper.retStr()); con.Open(); if (userIDO == userID) { sql += "update T_SYS_MEMBERINFO set T_USERNAME=:blobtodb,T_PASSWD=:blobtodb,B_ATTACHMENT=:blobtodb where T_USERID='" + userIDO + "'"; OracleCommand orlcmd = new OracleCommand(sql, con); orlcmd.Parameters.Add("blobtodb", userName); orlcmd.Parameters.Add("blobtodb", pwd); orlcmd.Parameters.Add("blobtodb", img); if (orlcmd.ExecuteNonQuery() > 0) { result = true; } } else { sql += "update T_SYS_MEMBERINFO set T_USERID=:blobtodb,T_USERNAME=:blobtodb,T_PASSWD=:blobtodb,B_ATTACHMENT=:blobtodb where T_USERID='" + userIDO + "'"; OracleCommand orlcmd = new OracleCommand(sql, con); orlcmd.Parameters.Add("blobtodb", userID); orlcmd.Parameters.Add("blobtodb", userName); orlcmd.Parameters.Add("blobtodb", pwd); orlcmd.Parameters.Add("blobtodb", img); result = SAC.DBOperations.DBoracle.RunNonQuery("update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';", out errMsg); if (orlcmd.ExecuteNonQuery() > 0 && result == true) { result = true; } } con.Close(); } else { if (userIDO == userID) { sql += "update T_SYS_MEMBERINFO set T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';"; } else { sql += "update T_SYS_MEMBERINFO set T_USERID='" + userID + "',T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';"; } result = dl.RunNonQuery(sql, out errMsg); } } catch (Exception ex) { LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message); } } return(result); }
/// <summary> /// 根据LogName 或者AgentID 获取它在当前登录代理下的层级 /// </summary> /// <param name="loginID">当前登录代理AentID</param> /// <param name="sign">id表示通过AgentID查询 name表示通过LogName查询</param> /// <param name="value">LogName 获取 AgentID的值</param> /// <param name="msg">结果状态描述</param> /// <returns></returns> public static List <AgentSearchModel> GetAgentTree(string loginID, string sign, string value, out string msg) { try { List <AgentSearchModel> agentList = new List <AgentSearchModel>(); string pSql = "";//,WashRate A_WashR,IntoRate A_IntoR,DrawRate A_DrawR,Max_Z A_Mx_Z,Max_X A_Mx_X if (sign == "name") { pSql = "select AgentID A_ID,LogName A_UserID,AgentName A_Name,ParentID A_PID,WashRate A_WashR,IntoRate A_IntoR,DrawRate A_DrawR,Max_Z A_Mx_Z,Min_Z A_MN_Z,Principal A_Prncpl,F_3 A_Perm from T_Agent where LogName = '" + value + "'"; } else if (sign == "id") { pSql = "select AgentID A_ID,LogName A_UserID,AgentName A_Name,ParentID A_PID,WashRate A_WashR,IntoRate A_IntoR,DrawRate A_DrawR,Max_Z A_Mx_Z,Min_Z A_MN_Z, Principal A_Prncpl,F_3 A_Perm from T_Agent where AgentID = '" + value + "'"; } else { msg = "请传入正确的查询标记"; return(null); } AgentSearchModel agent = Db.Context_SqlServer.FromSql(pSql).ToFirst <AgentSearchModel>(); if (agent != null) { if (agent.A_ID == loginID) { if (!agentList.Contains(agent)) { agentList.Insert(0, agent); } msg = "ok"; return(agentList); } else { if (agent.A_ID == null || agent.A_ID == "root" || agent.A_PID == null || agent.A_PID == "root") { msg = "你无权限查看此账号数据"; return(null); } if (!agentList.Contains(agent)) { agentList.Insert(0, agent); } string pID = agent.A_PID; int i = 0; while (true) { string zSql = "select AgentID A_ID,LogName A_UserID,AgentName A_Name,ParentID A_PID,WashRate A_WashR,IntoRate A_IntoR,DrawRate A_DrawR,Max_Z A_Mx_Z,Max_X A_Mx_X, Principal A_Prncpl,F_3 A_Perm from T_Agent where AgentID = '" + pID + "'"; AgentSearchModel agentSon = Db.Context_SqlServer.FromSql(zSql).ToFirst <AgentSearchModel>(); i++; if (i > 20) { //防止造成死循环 超过20层层级的不处理 msg = "层级关系超出预期范围"; return(null); } if (agentSon != null) { if (agentSon.A_ID == loginID) { if (!agentList.Contains(agentSon)) { agentList.Insert(0, agentSon); } msg = "ok"; return(agentList); } if (agentSon.A_ID == null || agentSon.A_ID == "root" || agent.A_PID == null || agent.A_PID == "root") { msg = "你无权限查看此账号数据"; return(null); } else { if (!agentList.Contains(agentSon)) { agentList.Insert(0, agentSon); } pID = agentSon.A_PID; } } else { msg = "没有找到数据"; return(null); } } } } else { msg = "没有找到数据"; return(null); } } catch (Exception ex) { LogHelper.WriteLog(typeof(CommonDAL), ex); throw; } }
/// <summary> /// 添加人员信息 /// </summary> /// <param name="id">用户编码</param> /// <param name="name">真实姓名</param> /// <param name="pwd">登陆密码</param> /// <param name="img">图片</param> /// <returns></returns> public bool AddMember(string id, string name, string pwd, byte[] img, string orgID) { string rlDBType = dl.init(); string errMsg; string sql1 = ""; string sql2 = ""; bool result = false; if (rlDBType == "SQL") { if (img != null && img.Length > 0) { sql1 = "insert into T_SYS_MEMBERINFO(T_USERID,T_USERNAME,T_PASSWD,B_ATTACHMENT) values(@T_USERID,@T_USERNAME,@T_PASSWD,@B_ATTACHMENT);"; } else { sql1 = "insert into T_SYS_MEMBERINFO(T_USERID,T_USERNAME,T_PASSWD) values(@T_USERID,@T_USERNAME,@T_PASSWD);"; } sql2 = "insert into T_SYS_MEMBERGRP(T_USERID,T_GRPID) values('" + id + "','" + orgID + "')"; try { SqlConnection sqlconn = SAC.DBOperations.DBsql.GetConnection(); SqlCommand sqlcmd = new SqlCommand(sql1, sqlconn); if (img != null && img.Length > 0) { sqlcmd.Parameters.Add("@T_USERID", id); sqlcmd.Parameters.Add("@T_USERNAME", name); sqlcmd.Parameters.Add("@T_PASSWD", pwd); sqlcmd.Parameters.Add("@B_ATTACHMENT", img); } else { sqlcmd.Parameters.Add("@T_USERID", id); sqlcmd.Parameters.Add("@T_USERNAME", name); sqlcmd.Parameters.Add("@T_PASSWD", pwd); } if (sqlcmd.ExecuteNonQuery() > 0) { result = true; } sqlconn.Close(); dl.RunNonQuery(sql2, out errMsg); } catch (Exception ex) { LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message); } } else if (rlDBType == "DB2") { if (img != null && img.Length > 0) { sql1 = "insert into T_SYS_MEMBERINFO(T_USERID,T_USERNAME,T_PASSWD,B_ATTACHMENT) values(?,?,?,?);"; } else { sql1 = "insert into T_SYS_MEMBERINFO(T_USERID,T_USERNAME,T_PASSWD) values(?,?,?);"; } sql2 = "insert into T_SYS_MEMBERGRP(T_USERID,T_GRPID) values('" + id + "','" + orgID + "')"; try { OleDbConnection con = new OleDbConnection(SAC.DBOperations.DBdb2.SetConString()); con.Open(); OleDbCommand oledbcom = new OleDbCommand(sql1, con); if (img != null && img.Length > 0) { oledbcom.Parameters.Add("?", id); oledbcom.Parameters.Add("?", name); oledbcom.Parameters.Add("?", pwd); oledbcom.Parameters.Add("?", img); } else { oledbcom.Parameters.Add("?", id); oledbcom.Parameters.Add("?", name); oledbcom.Parameters.Add("?", pwd); } if (oledbcom.ExecuteNonQuery() > 0) { result = true; } con.Close(); dl.RunNonQuery(sql2, out errMsg); } catch (Exception ex) { LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message); } } else if (rlDBType == "ORACLE") { if (img != null && img.Length > 0) { sql1 = "insert into T_SYS_MEMBERINFO(T_USERID,T_USERNAME,T_PASSWD,B_ATTACHMENT) values(:blobtodb,:blobtodb,:blobtodb,:blobtodb);"; } else { sql1 = "insert into T_SYS_MEMBERINFO(T_USERID,T_USERNAME,T_PASSWD) values(:blobtodb,:blobtodb,:blobtodb);"; } sql2 = "insert into T_SYS_MEMBERGRP(T_USERID,T_GRPID) values('" + id + "','" + orgID + "')"; try { OracleConnection con = new OracleConnection(SAC.DBOperations.OracleHelper.retStr()); con.Open(); OracleCommand oledbcom = new OracleCommand(sql1, con); if (img != null && img.Length > 0) { oledbcom.Parameters.Add("blobtodb", id); oledbcom.Parameters.Add("blobtodb", name); oledbcom.Parameters.Add("blobtodb", pwd); oledbcom.Parameters.Add("blobtodb", img); } else { oledbcom.Parameters.Add("blobtodb", id); oledbcom.Parameters.Add("blobtodb", name); oledbcom.Parameters.Add("blobtodb", pwd); } if (oledbcom.ExecuteNonQuery() > 0) { result = true; } con.Close(); dl.RunNonQuery(sql2, out errMsg); } catch (Exception ex) { LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message); } } return(result); }
/// <summary> /// 获取会员邀请关系及会员所属代理层级关系 /// </summary> /// <param name="loginID"></param> /// <param name="userID"></param> /// <param name="msg"></param> /// <returns></returns> public static List <AgentSearchModel> GetAgentTree(string loginID, string userID, out string msg) { try { List <AgentSearchModel> agentList = new List <AgentSearchModel>(); int clntInvite = Db.Context_SqlServer.FromSql("select count(*) from T_WeiTou_Detail where logName = '" + userID + "'").ToScalar <int>(); if (clntInvite <= 0)//如果不是H5会员,则先查出此会员对应的代理ID,然后按照代理方式执行 { string aId = Db.Context_SqlServer.FromSql("select AgentID from T_Client where LogName ='" + userID + "'").ToScalar <string>(); return(GetAgentTree(loginID, "id", aId, out msg)); } string pSq = "select ClientID A_ID , logName A_UserID,InviterLogName A_Name,InviterID A_PID,AgentID3Bao A_Sub from T_WeiTou_Detail where logName = '" + userID + "'"; AgentSearchModel agent = Db.Context_SqlServer.FromSql(pSq).ToFirst <AgentSearchModel>(); if (agent == null) { msg = "没有找到数据"; return(null); } if (agent.A_PID == loginID) { if (!agentList.Contains(agent)) { agentList.Insert(0, agent); AgentSearchModel loginA = Db.Context_SqlServer.FromSql("select AgentID A_ID,LogName A_UserID,AgentName A_Name,ParentID A_PID from T_Agent where AgentID = '" + agent.A_PID + "'").ToFirst <AgentSearchModel>(); if (!agentList.Contains(loginA)) { agentList.Insert(0, loginA); } } msg = "ok"; return(agentList); } else { if (agent.A_ID == null || agent.A_PID == null) { msg = "你无权限查看此账号数据"; return(null); } if (!agentList.Contains(agent)) { agentList.Insert(0, agent); } string pID = agent.A_PID; int i = 0; while (true) { string zSql = "select ClientID A_ID , logName A_UserID,InviterLogName A_Name,InviterID A_PID from T_WeiTou_Detail where ClientID = '" + pID + "'"; AgentSearchModel agentSon = Db.Context_SqlServer.FromSql(zSql).ToFirst <AgentSearchModel>(); i++; AgentSearchModel loginAg = new AgentSearchModel(); if (i > 100) { msg = "超出邀请范围,无法查找到指定数据"; return(null); } if (agentSon == null) { agentSon = loginAg = Db.Context_SqlServer.FromSql("select AgentID A_ID,LogName A_UserID,AgentName A_Name,ParentID A_PID from T_Agent where AgentID = '" + pID + "'").ToFirst <AgentSearchModel>(); } if (agentSon == null) { msg = "超出邀请范围,无法查找到指定数据"; return(null); } if (agentSon.A_PID == loginID) { if (!agentList.Contains(agentSon)) { agentList.Insert(0, agentSon); loginAg = Db.Context_SqlServer.FromSql("select AgentID A_ID,LogName A_UserID,AgentName A_Name,ParentID A_PID from T_Agent where AgentID = '" + agentSon.A_PID + "'").ToFirst <AgentSearchModel>(); if (!agentList.Contains(loginAg)) { agentList.Insert(0, loginAg); } } msg = "ok"; return(agentList); } if (!agentList.Contains(agentSon)) { agentList.Insert(0, agentSon); } pID = agentSon.A_PID; }//while循环结束 } } catch (Exception ex) { LogHelper.WriteLog(typeof(CommonDAL), ex); throw; } }