利用Code Analysis工具检查出7出Issues,移除未使用的变量

This commit is contained in:
Argo-Lenovo 2016-11-02 12:12:34 +08:00
parent ecaa972b77
commit 2792356db8
3 changed files with 8 additions and 57 deletions

View File

@ -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

View File

@ -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<Role> Roles = new List<Role>();
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

View File

@ -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