修改BUG,SaveRolesByUserId方法缓存没有清理

This commit is contained in:
Argo-Lenovo 2016-11-10 14:06:00 +08:00
parent e51ea2c04d
commit 90079c8c3d
2 changed files with 23 additions and 12 deletions

View File

@ -44,17 +44,28 @@ namespace Bootstrap.Admin.Controllers
var v = new NavigatorBarModel("~/Admin/Dicts");
return View(v);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult Roles()
{
var v = new NavigatorBarModel("~/Admin/Roles");
return View(v);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult Menus()
{
var v = new NavigatorBarModel("~/Admin/Menus");
return View(v);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult Logs()
{
var v = new NavigatorBarModel("~/Admin/Logs");

View File

@ -80,20 +80,20 @@ namespace Bootstrap.DataAccess
{
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserID", id, ParameterDirection.Input));
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd, transaction);
if (dt.Rows.Count > 0)
{
// insert batch data into config table
using (SqlBulkCopy bulk = new SqlBulkCopy((SqlConnection)transaction.Transaction.Connection, SqlBulkCopyOptions.Default, (SqlTransaction)transaction.Transaction))
{
bulk.BatchSize = 1000;
bulk.DestinationTableName = "UserRole";
bulk.ColumnMappings.Add("UserID", "UserID");
bulk.ColumnMappings.Add("RoleID", "RoleID");
bulk.WriteToServer(dt);
}
}
transaction.CommitTransaction();
}
}
roleIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).AsParallel()
.ForAll(r => CacheManager.Clear(key => key == string.Format("{0}-{1}", RetrieveRolesByUserIDDataKey, id) || key == string.Format("{0}-{1}", UserHelper.RetrieveUsersByRoleIDDataKey, r)));
CacheCleanUtility.ClearCache(userIds: id.ToString(), roleIds: roleIds);
ret = true;
}
catch (Exception ex)