public List <PopedomInfo> GetPopedomInfos() { string sql = "select * from PopedomInfo where ParentID <> 0 "; List <PopedomInfo> list = new List <PopedomInfo>(); Dictionary <int, List <PopedomInfo> > dicti = new Dictionary <int, List <PopedomInfo> >(); PopedomInfo p = null; try { SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.Text, sql, null); while (reader.Read()) { p = new PopedomInfo(); p.PopedomId = Convert.ToInt32(reader["PopedomId"]); p.PopedomName = reader["PopedomName"].ToString(); p.ParentID = Convert.ToInt32(reader["ParentID"]); p.Url = reader["Url"].ToString(); list.Add(p); } } catch (Exception e) { throw e; } return(list); }
public List <PopedomInfo> GetPopedomInfoByUserId(int userId) { string sql = "select * from PopedomInfo where PopedomInfo.PopedomId in (select PopedomId from RolePoperdomInfo where RoleID in (select RoleId from UserInfoRole where UserId = @UserId))"; List <PopedomInfo> list = new List <PopedomInfo>(); Dictionary <int, List <PopedomInfo> > dicti = new Dictionary <int, List <PopedomInfo> >(); SqlParameter[] param = { new SqlParameter("@UserId", userId) }; PopedomInfo p = null; try { SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.Text, sql, param); while (reader.Read()) { p = new PopedomInfo(); p.PopedomId = Convert.ToInt32(reader["PopedomId"]); p.PopedomName = reader["PopedomName"].ToString(); p.ParentID = Convert.ToInt32(reader["ParentID"]); p.Url = reader["Url"].ToString(); list.Add(p); } } catch (Exception e) { throw e; } return(list); }