/// <summary> /// Gets all ACL /// </summary> /// <param name="customerActionId">Customer action identifier; 0 to load all records</param> /// <param name="customerRoleId">Customer role identifier; 0 to load all records</param> /// <param name="allow">Value indicating whether action is allowed; null to load all records</param> /// <returns>ACL collection</returns> public override DBACLCollection GetAllAcl(int customerActionId, int customerRoleId, bool?allow) { var result = new DBACLCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ACLLoadAll"); db.AddInParameter(dbCommand, "CustomerActionID", DbType.Int32, customerActionId); db.AddInParameter(dbCommand, "CustomerRoleID", DbType.Int32, customerRoleId); if (allow.HasValue) { db.AddInParameter(dbCommand, "Allow", DbType.Boolean, allow.Value); } else { db.AddInParameter(dbCommand, "Allow", DbType.Boolean, null); } using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetAclFromReader(dataReader); result.Add(item); } } return(result); }
private static ACLCollection DBMapping(DBACLCollection dbCollection) { if (dbCollection == null) { return(null); } var collection = new ACLCollection(); foreach (var dbItem in dbCollection) { var item = DBMapping(dbItem); collection.Add(item); } return(collection); }