public static string getDependantParameters(string path, string paramName, string paramValue, string[] visibleDependants) { try { var crcRepDef = GetReportDefinition(path); logger.DebugFormat("getDependantParameters: Report {0} User {1} base param {2} value {3} visible dependants {4}", crcRepDef.DisplayName, HttpContext.Current.User.Identity.Name, paramName, paramValue, string.Join(", ", visibleDependants)); // map the parameter values onto the report definition var choiceFactory = new CrcParameterChoiceFactory(); var choiceCollection = choiceFactory.Create(paramValue); var crServices = new CrissCrossLib.CrissCrossServices(); crServices.RefreshDependantParameters(crcRepDef, choiceCollection); // only return visible dependant params back to ui List <CrcParameterDefinition> paramsToReturn = crcRepDef.ParameterDefinitions .Where(p => visibleDependants.Contains(p.Name)).ToList(); string json = CrissCrossWebHelper.SerializeObjectIntoJson <List <CrcParameterDefinition> >(paramsToReturn); return(json); } catch (Exception e) { LogAjaxError(e, "getDependantParameters"); throw e; } }
public static string getParameterInfo(string path, string paramName) { try { var crcRepDef = GetReportDefinition(path); logger.DebugFormat("getParameterInfo: Report {0} User {1} requested Param {2}", crcRepDef.DisplayName, HttpContext.Current.User.Identity.Name, paramName); var paramDef = crcRepDef.ParameterDefinitions.First(p => p.Name == paramName); string json = CrissCrossWebHelper.SerializeObjectIntoJson <CrissCrossLib.CrcParameterDefinition>(paramDef); return(json); } catch (Exception e) { LogAjaxError(e, "getParameterInfo"); throw e; } }
public static string getMinimumParametersToDisplay(string path) { try { var crcRepDef = GetReportDefinition(path); if (crcRepDef == null) { throw new ApplicationException(String.Format("Failed to retrieve repdef object for path {0}", path)); } logger.DebugFormat("getMinimumParametersToDisplay: Report {0} User {1}", crcRepDef.DisplayName, HttpContext.Current.User.Identity.Name); var ret = new ParametersAndParamListViewModel(); ret.ParameterDefinitions = crcRepDef.GetMinimumParametersToDisplay(); ret.AvailableParameters = crcRepDef.GetAvailableParameterNames(); string json = CrissCrossWebHelper.SerializeObjectIntoJson <ParametersAndParamListViewModel>(ret); return(json); } catch (Exception e) { LogAjaxError(e, "getMinimumParametersToDisplay"); throw e; } }