diff --git a/Bootstrap.DataAccess/GroupHelper.cs b/Bootstrap.DataAccess/GroupHelper.cs index 02fa034e..89bfd44f 100644 --- a/Bootstrap.DataAccess/GroupHelper.cs +++ b/Bootstrap.DataAccess/GroupHelper.cs @@ -157,14 +157,7 @@ namespace Bootstrap.DataAccess dt.Columns.Add("UserID", typeof(int)); dt.Columns.Add("GroupID", typeof(int)); //判断用户是否选定角色 - if (!string.IsNullOrEmpty(groupIds)) - { - groupIds.Split(',').ToList().ForEach(groupId => - { - DataRow row = dt.NewRow(); - dt.Rows.Add(id, groupId); - }); - } + if (!string.IsNullOrEmpty(groupIds)) groupIds.Split(',').ToList().ForEach(groupId => dt.Rows.Add(id, groupId)); using (TransactionPackage transaction = DBAccessManager.SqlDBAccess.BeginTransaction()) { try @@ -249,14 +242,7 @@ namespace Bootstrap.DataAccess DataTable dt = new DataTable(); dt.Columns.Add("GroupID", typeof(int)); dt.Columns.Add("RoleID", typeof(int)); - if (!string.IsNullOrEmpty(groupIds)) - { - groupIds.Split(',').ToList().ForEach(groupId => - { - DataRow dr = dt.NewRow(); - dt.Rows.Add(groupId, id); - }); - } + if (!string.IsNullOrEmpty(groupIds)) groupIds.Split(',').ToList().ForEach(groupId => dt.Rows.Add(groupId, id)); using (TransactionPackage transaction = DBAccessManager.SqlDBAccess.BeginTransaction()) { try diff --git a/Bootstrap.DataAccess/RoleHelper.cs b/Bootstrap.DataAccess/RoleHelper.cs index 68c87169..575c5ea1 100644 --- a/Bootstrap.DataAccess/RoleHelper.cs +++ b/Bootstrap.DataAccess/RoleHelper.cs @@ -67,14 +67,7 @@ namespace Bootstrap.DataAccess dt.Columns.Add("UserID", typeof(int)); dt.Columns.Add("RoleID", typeof(int)); //判断用户是否选定角色 - if (!string.IsNullOrEmpty(roleIds)) - { - roleIds.Split(',').ToList().ForEach(roleId => - { - DataRow row = dt.NewRow(); - dt.Rows.Add(id, roleId); - }); - } + if (!string.IsNullOrEmpty(roleIds)) roleIds.Split(',').ToList().ForEach(roleId => dt.Rows.Add(id, roleId)); using (TransactionPackage transaction = DBAccessManager.SqlDBAccess.BeginTransaction()) { try @@ -241,14 +234,7 @@ namespace Bootstrap.DataAccess dt.Columns.Add("NavigationID", typeof(int)); dt.Columns.Add("RoleID", typeof(int)); //判断用户是否选定角色 - if (!string.IsNullOrEmpty(roleIds)) - { - roleIds.Split(',').ToList().ForEach(roleId => - { - DataRow row = dt.NewRow(); - dt.Rows.Add(id, roleId); - }); - } + if (!string.IsNullOrEmpty(roleIds)) roleIds.Split(',').ToList().ForEach(roleId => dt.Rows.Add(id, roleId)); using (TransactionPackage transaction = DBAccessManager.SqlDBAccess.BeginTransaction()) { try @@ -299,7 +285,7 @@ namespace Bootstrap.DataAccess return CacheManager.GetOrAdd(key, CacheSection.RetrieveIntervalByKey(RolebyGroupDataKey), k => { List Roles = new List(); - string sql= "select r.ID, r.RoleName, r.[Description], case ur.RoleID when r.ID then 'checked' else '' end [status] from Roles r left join RoleGroup ur on r.ID = ur.RoleID and GroupID = @GroupID"; + string sql = "select r.ID, r.RoleName, r.[Description], case ur.RoleID when r.ID then 'checked' else '' end [status] from Roles r left join RoleGroup ur on r.ID = ur.RoleID and GroupID = @GroupID"; DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql); try { @@ -335,14 +321,7 @@ namespace Bootstrap.DataAccess DataTable dt = new DataTable(); dt.Columns.Add("RoleID", typeof(int)); dt.Columns.Add("GroupID", typeof(int)); - if (!string.IsNullOrEmpty(roleIds)) - { - roleIds.Split(',').ToList().ForEach(roleId => - { - DataRow row = dt.NewRow(); - dt.Rows.Add(roleId,id); - }); - } + if (!string.IsNullOrEmpty(roleIds)) roleIds.Split(',').ToList().ForEach(roleId => dt.Rows.Add(roleId, id)); using (TransactionPackage transaction = DBAccessManager.SqlDBAccess.BeginTransaction()) { try diff --git a/Bootstrap.DataAccess/UserHelper.cs b/Bootstrap.DataAccess/UserHelper.cs index 4fd1f6f8..063c7fa5 100644 --- a/Bootstrap.DataAccess/UserHelper.cs +++ b/Bootstrap.DataAccess/UserHelper.cs @@ -214,14 +214,7 @@ namespace Bootstrap.DataAccess DataTable dt = new DataTable(); dt.Columns.Add("RoleID", typeof(int)); dt.Columns.Add("UserID", typeof(int)); - if (!string.IsNullOrEmpty(userIds)) - { - userIds.Split(',').ToList().ForEach(userId => - { - DataRow dr = dt.NewRow(); - dt.Rows.Add(id, userId); - }); - } + if (!string.IsNullOrEmpty(userIds)) userIds.Split(',').ToList().ForEach(userId => dt.Rows.Add(id, userId)); using (TransactionPackage transaction = DBAccessManager.SqlDBAccess.BeginTransaction()) { try @@ -301,14 +294,7 @@ namespace Bootstrap.DataAccess DataTable dt = new DataTable(); dt.Columns.Add("UserID", typeof(int)); dt.Columns.Add("GroupID", typeof(int)); - if (!string.IsNullOrEmpty(userIds)) - { - userIds.Split(',').ToList().ForEach(userId => - { - DataRow dr = dt.NewRow(); - dt.Rows.Add(userId, id); - }); - } + if (!string.IsNullOrEmpty(userIds)) userIds.Split(',').ToList().ForEach(userId => dt.Rows.Add(userId, id)); using (TransactionPackage transaction = DBAccessManager.SqlDBAccess.BeginTransaction()) { try