diff --git a/Bootstrap.DataAccess.MySQL/Role.cs b/Bootstrap.DataAccess.MySQL/Role.cs
index 7d79dc5e..bc146056 100644
--- a/Bootstrap.DataAccess.MySQL/Role.cs
+++ b/Bootstrap.DataAccess.MySQL/Role.cs
@@ -94,44 +94,6 @@ namespace Bootstrap.DataAccess.MySQL
return ret;
}
- ///
- /// 删除角色表
- ///
- ///
- public override bool DeleteRole(IEnumerable value)
- {
- bool ret = false;
- var ids = string.Join(",", value);
- using (TransactionPackage transaction = DbAccessManager.DBAccess.BeginTransaction())
- {
- using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, $"delete from UserRole where RoleID in ({ids})"))
- {
- try
- {
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- cmd.CommandText = $"delete from RoleGroup where RoleID in ({ids})";
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- cmd.CommandText = $"delete from NavigationRole where RoleID in ({ids})";
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- cmd.CommandText = $"delete from Roles where ID in ({ids})";
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- transaction.CommitTransaction();
- ret = true;
- }
- catch (Exception ex)
- {
- transaction.RollbackTransaction();
- throw ex;
- }
- }
- }
- return ret;
- }
-
///
///
///
diff --git a/Bootstrap.DataAccess.SQLite/Role.cs b/Bootstrap.DataAccess.SQLite/Role.cs
index 4968527c..109fb23c 100644
--- a/Bootstrap.DataAccess.SQLite/Role.cs
+++ b/Bootstrap.DataAccess.SQLite/Role.cs
@@ -50,44 +50,6 @@ namespace Bootstrap.DataAccess.SQLite
return ret;
}
- ///
- /// 删除角色表
- ///
- ///
- public override bool DeleteRole(IEnumerable value)
- {
- bool ret = false;
- var ids = string.Join(",", value);
- using (TransactionPackage transaction = DbAccessManager.DBAccess.BeginTransaction())
- {
- using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, $"delete from UserRole where RoleID in ({ids})"))
- {
- try
- {
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- cmd.CommandText = $"delete from RoleGroup where RoleID in ({ids})";
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- cmd.CommandText = $"delete from NavigationRole where RoleID in ({ids})";
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- cmd.CommandText = $"delete from Roles where ID in ({ids})";
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- transaction.CommitTransaction();
- ret = true;
- }
- catch (Exception ex)
- {
- transaction.RollbackTransaction();
- throw ex;
- }
- }
- }
- return ret;
- }
-
///
///
///
diff --git a/Bootstrap.DataAccess/Role.cs b/Bootstrap.DataAccess/Role.cs
index b7a684e8..f9d04fb3 100644
--- a/Bootstrap.DataAccess/Role.cs
+++ b/Bootstrap.DataAccess/Role.cs
@@ -139,10 +139,32 @@ namespace Bootstrap.DataAccess
{
bool ret = false;
var ids = string.Join(",", value);
- using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.StoredProcedure, "Proc_DeleteRoles"))
+ using (TransactionPackage transaction = DbAccessManager.DBAccess.BeginTransaction())
{
- cmd.Parameters.Add(DbAccessManager.DBAccess.CreateParameter("@ids", ids));
- ret = DbAccessManager.DBAccess.ExecuteNonQuery(cmd) == -1;
+ using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, $"delete from UserRole where RoleID in ({ids})"))
+ {
+ try
+ {
+ DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
+
+ cmd.CommandText = $"delete from RoleGroup where RoleID in ({ids})";
+ DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
+
+ cmd.CommandText = $"delete from NavigationRole where RoleID in ({ids})";
+ DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
+
+ cmd.CommandText = $"delete from Roles where ID in ({ids})";
+ DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
+
+ transaction.CommitTransaction();
+ ret = true;
+ }
+ catch (Exception ex)
+ {
+ transaction.RollbackTransaction();
+ throw ex;
+ }
+ }
}
return ret;
}