public static bool Save(List <RightLkFunctionGroup> insertList, List <RightLkFunctionGroup> deleteList, List <RightLkFunctionGroup> updateList) { using (var conn = new SqlConnection(Conn.getConn())) { if (conn.State != ConnectionState.Open) { conn.Open(); } using (var trans = conn.BeginTransaction()) { foreach (var item in insertList) { var result = Insert(item, conn, trans); if (result) { continue; } trans.Rollback(); return(false); } foreach (var item in updateList) { var result = Update(item, conn, trans); if (result) { continue; } trans.Rollback(); return(false); } foreach (var item in deleteList) { var result = Delete(item, conn, trans); if (result) { continue; } RightDal.Delete(item, conn, trans); trans.Rollback(); return(false); } trans.Commit(); } if (conn.State != ConnectionState.Closed) { conn.Close(); } } return(true); }
public static bool UpdateRight(Right right, out string msg) { if (!RightDal.Update(right)) { msg = "修改失败"; return(false); } msg = "修改成功"; return(true); }
public static bool InsertRight(Right right, out string msg) { if (!RightDal.Insert(right)) { msg = "新增失败"; return(false); } msg = "新增成功"; return(true); }
public static bool Delete(RightFunction rightFunction) { using (var conn = new SqlConnection(Conn.getConn())) { if (conn.State != ConnectionState.Open) { conn.Open(); } using (var trans = conn.BeginTransaction()) { //1、删除功能信息 var result = Delete(rightFunction, conn, trans); if (!result) { trans.Rollback(); return(false); } //2、删除当前功能对应的功能分组信息 RightLkFunctionGroupDal.DeleteByFunctionSysid(new RightLkFunctionGroup { FunctionSysid = rightFunction.Sysid }, conn, trans); //3、删除当前功能对应的功能命令信息 RightLkFunctionCommandDal.DeleteByFunctionSysid(new RightLkFunctionCommand { FunctionSysid = rightFunction.Sysid }, conn, trans); //4、删除当前功能对应的权限分配信息 RightDal.DeleteByFunctionSysid(new Right { FunctionSysid = rightFunction.Sysid }, conn, trans); trans.Commit(); } if (conn.State != ConnectionState.Closed) { conn.Close(); } } return(true); }
public static bool Delete(RightUserGroup rightUserGroup) { using (var conn = new SqlConnection(Conn.getConn())) { if (conn.State != ConnectionState.Open) { conn.Open(); } using (var trans = conn.BeginTransaction()) { //1、删除用户组 var result = Delete(rightUserGroup, conn, trans); if (!result) { trans.Rollback(); return(false); } //2、删除当前组对应的用户分组信息 RightLkUserGroupDal.DeleteByGroupSysid(new RightLkUserGroup { GroupSysid = rightUserGroup.Sysid }, conn, trans); //3、删除当前组对应的权限分配信息 RightDal.DeleteByUserGroupSysid(new Right { UserGroupSysid = rightUserGroup.Sysid }, conn, trans); trans.Commit(); } if (conn.State != ConnectionState.Closed) { conn.Close(); } } return(true); }
public static List <Right> QueryByCommandSysid(string commandSysid) { return(RightDal.QueryByCommandSysid(commandSysid)); }
public static bool DeleteRight(Right right) { return(RightDal.Delete(right)); }
public static Right QuerySingle(string sysid) { return(RightDal.QuerySingle(sysid)); }
public static List <Right> QueryAll() { return(RightDal.QueryAll()); }
public static List <Right> QueryByUserGroupSysid(string userGroupSysid) { return(RightDal.QueryByUserGroupSysid(userGroupSysid)); }
public static List <RightMenu> QueryAllRightMenu() { return(RightDal.QueryAllRightMenu()); }
public static bool Save(string userGroupSysid, List <Right> rights) { return(RightDal.Save(userGroupSysid, rights)); }