public static BORoleRightXCollection GetByRole(string roleId) { BORoleRightXCollection collection = new BORoleRightXCollection(); SqlConnection con = new SqlConnection(BOBase.GetConnectionString()); con.Open(); try { SqlCommand cmd = new SqlCommand("P_RoleRightX_GetByRole", con); cmd.CommandType = CommandType.StoredProcedure; SQLPersistent.SetVarCharParameter(cmd.Parameters, "@RORI_ROLGUID", 50, roleId, false); SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleResult); try { while (rdr.Read()) { collection.Add(new BORoleRightX(rdr)); } } catch (Exception ex) { logger.ErrorException("Failed to fetch record", ex); return null; } finally { rdr.Close(); } } finally { con.Close(); } return collection; }