public virtual bool EditRBACResourceGroup(RBACResourceGroupInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT * FROM RBAC_ResourceGroup WHERE RBAC_ResourceGroup_ID = " + entity.RBAC_ResourceGroup_ID; DtAdd = DBHelper.Query(SqlAdd); try { if (DtAdd.Rows.Count > 0) { DrAdd = DtAdd.Rows[0]; DrAdd["RBAC_ResourceGroup_ID"] = entity.RBAC_ResourceGroup_ID; DrAdd["RBAC_ResourceGroup_Name"] = entity.RBAC_ResourceGroup_Name; DrAdd["RBAC_ResourceGroup_ParentID"] = entity.RBAC_ResourceGroup_ParentID; DrAdd["RBAC_ResourceGroup_Site"] = entity.RBAC_ResourceGroup_Site; DBHelper.SaveChanges(SqlAdd, DtAdd); } else { return(false); } } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } return(true); }
public virtual bool AddRBACResourceGroup(RBACResourceGroupInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT TOP 0 * FROM RBAC_ResourceGroup"; DtAdd = DBHelper.Query(SqlAdd); DrAdd = DtAdd.NewRow(); DrAdd["RBAC_ResourceGroup_ID"] = entity.RBAC_ResourceGroup_ID; DrAdd["RBAC_ResourceGroup_Name"] = entity.RBAC_ResourceGroup_Name; DrAdd["RBAC_ResourceGroup_ParentID"] = entity.RBAC_ResourceGroup_ParentID; DrAdd["RBAC_ResourceGroup_Site"] = entity.RBAC_ResourceGroup_Site; DtAdd.Rows.Add(DrAdd); try { DBHelper.SaveChanges(SqlAdd, DtAdd); return(true); } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } }
public virtual RBACResourceGroupInfo GetRBACResourceGroupByID(int ID) { RBACResourceGroupInfo entity = null; SqlDataReader RdrList = null; try { string SqlList; SqlList = "SELECT * FROM RBAC_ResourceGroup WHERE RBAC_ResourceGroup_ID = " + ID; RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.Read()) { entity = new RBACResourceGroupInfo(); entity.RBAC_ResourceGroup_ID = Tools.NullInt(RdrList["RBAC_ResourceGroup_ID"]); entity.RBAC_ResourceGroup_Name = Tools.NullStr(RdrList["RBAC_ResourceGroup_Name"]); entity.RBAC_ResourceGroup_ParentID = Tools.NullInt(RdrList["RBAC_ResourceGroup_ParentID"]); entity.RBAC_ResourceGroup_Site = Tools.NullStr(RdrList["RBAC_ResourceGroup_Site"]); } return(entity); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public virtual bool EditRBACResourceGroup(RBACResourceGroupInfo entity, RBACUserInfo UserPrivilege) { if (RBAC.CheckPrivilege(UserPrivilege, "a63248fd-532f-40a8-850d-d217c5ddd38a")) { return(MyDAL.EditRBACResourceGroup(entity)); } else { throw new TradePrivilegeException("没有权限,权限代码:a63248fd-532f-40a8-850d-d217c5ddd38a错误"); } }
public virtual IList <RBACResourceGroupInfo> GetRBACResourceGroups(QueryInfo Query) { int PageSize; int CurrentPage; IList <RBACResourceGroupInfo> entitys = null; RBACResourceGroupInfo entity = null; string SqlList, SqlField, SqlOrder, SqlParam, SqlTable; SqlDataReader RdrList = null; try { CurrentPage = Query.CurrentPage; PageSize = Query.PageSize; SqlTable = "RBAC_ResourceGroup"; SqlField = "*"; SqlParam = DBHelper.GetSqlParam(Query.ParamInfos); SqlOrder = DBHelper.GetSqlOrder(Query.OrderInfos); SqlList = DBHelper.GetSqlPage(SqlTable, SqlField, SqlParam, SqlOrder, CurrentPage, PageSize); RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.HasRows) { entitys = new List <RBACResourceGroupInfo>(); while (RdrList.Read()) { entity = new RBACResourceGroupInfo(); entity.RBAC_ResourceGroup_ID = Tools.NullInt(RdrList["RBAC_ResourceGroup_ID"]); entity.RBAC_ResourceGroup_Name = Tools.NullStr(RdrList["RBAC_ResourceGroup_Name"]); entity.RBAC_ResourceGroup_ParentID = Tools.NullInt(RdrList["RBAC_ResourceGroup_ParentID"]); entity.RBAC_ResourceGroup_Site = Tools.NullStr(RdrList["RBAC_ResourceGroup_Site"]); entitys.Add(entity); entity = null; } } return(entitys); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public void AddRBACResourceGroup() { int RBAC_ResourceGroup_ID = tools.CheckInt(Request.Form["RBAC_ResourceGroup_ID"]); string RBAC_ResourceGroup_Name = tools.CheckStr(Request.Form["RBAC_ResourceGroup_Name"]); int RBAC_ResourceGroup_ParentID = tools.CheckInt(Request.Form["RBAC_ResourceGroup_ParentID"]); RBACResourceGroupInfo entity = new RBACResourceGroupInfo(); entity.RBAC_ResourceGroup_ID = RBAC_ResourceGroup_ID; entity.RBAC_ResourceGroup_Name = RBAC_ResourceGroup_Name; entity.RBAC_ResourceGroup_ParentID = RBAC_ResourceGroup_ParentID; entity.RBAC_ResourceGroup_Site = "CN"; if (MyGroupBLL.AddRBACResourceGroup(entity, Public.GetUserPrivilege())) { Public.Msg("positive", "操作成功", "操作成功", true, "group_list.aspx"); } else { Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}"); } }