public ReportParameter(string name, ReportParameterType type, object value = null) : this() { Name = name; ParameterType = type; AddValue(value); }
public NParameterValue(string label, string name, string value, ReportParameterType parameterType, bool useDefault) { _label = label; _name = name; _value = value; _parameterType = parameterType; _useDefault = useDefault; }
public ReportParameter( string name, string caption, ReportParameterType type, string sql) { this.name = name; this.caption = caption; this.type = type; this.sql = sql; }
public ReportParameter( string name, string caption, ReportParameterType type, string sql, string groupName, string comparedExpression, string sections) : this(name, caption, type, sql) { this.groupName = groupName; this.comparisonExpression = comparedExpression; this.tables = new List <string>(sections.Split(';')); }
public static void AddParameters(ReportParametersType pParams, string[] pParameterNames) { foreach (string pName in pParameterNames) { ReportParameterType param = new ReportParameterType(pName); param.DataType = DataTypeEnum.String; param.Nullable = true; param.AllowBlank = true; param.Prompt = param.Name; pParams.Add(param); } }
public NReportParameter(ReportParameter reportParameter) { Prompt = reportParameter.Prompt; Name = reportParameter.Name; MultiValue = reportParameter.MultiValue; MultiValueSpecified = reportParameter.MultiValueSpecified; AllowBlank = reportParameter.AllowBlank; switch (reportParameter.Type) { case ParameterTypeEnum.Boolean: _parameterType = ReportParameterType.Boolean; break; case ParameterTypeEnum.DateTime: _parameterType = ReportParameterType.DateTime; break; case ParameterTypeEnum.Float: _parameterType = ReportParameterType.Float; break; case ParameterTypeEnum.Integer: _parameterType = ReportParameterType.Integer; break; case ParameterTypeEnum.String: _parameterType = ReportParameterType.String; break; } if (reportParameter.ValidValues != null) { foreach (ValidValue vv in reportParameter.ValidValues) { _validValues.Add(new NValidValue(vv)); } } if (reportParameter.Dependencies != null) { foreach (string dep in reportParameter.Dependencies) { _dependencies.Add(dep); } } if (reportParameter.DefaultValues != null) { foreach (string def in reportParameter.DefaultValues) { _defaultValues.Add(def); } } }
public void Add(string name, ReportParameterType type, object value) { _parameters.Add(new ReportParameter(name, type, value)); }
private List <ReportParameter> ParseParameters(string paramsText, ref bool isDesignedReport) { var result = new List <ReportParameter>(); XDocument paramsDoc = null; try { paramsDoc = XDocument.Parse(paramsText); } catch (Exception) { // workaround: Data at the root level is invalid. Line 1, position 1 string byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()); if (paramsText.StartsWith(byteOrderMarkUtf8)) { paramsText = paramsText.Remove(0, byteOrderMarkUtf8.Length); } paramsDoc = XDocument.Parse(paramsText); } XElement firstElement = paramsDoc.Root.Elements("panel").FirstOrDefault(); isDesignedReport = firstElement != null?firstElement.Attribute("sections") != null : false; foreach (XElement el in paramsDoc.Root.Elements("panel")) { XAttribute sqlAttr = el.Attribute("sql"); string typeText = el.Attribute("type").Value; if (string.IsNullOrEmpty(typeText)) { if (isDesignedReport) { result.Add(new ReportParameter(null, el.Attribute("title").Value, ReportParameterType.Unknown, null)); } continue; } var groupNameAttribute = el.Attribute("groupName"); string groupName = isDesignedReport && groupNameAttribute != null ? groupNameAttribute.Value : null; string comparedExpr = isDesignedReport ? el.Attribute("define").Value : null; string sections = isDesignedReport ? el.Attribute("sections").Value : null; ReportParameterType pType = ReportParameter.ParseParameterType(typeText); if (pType == ReportParameterType.Unknown) { throw new InvalidOperationException(string.Format("Неизвестный тип параметра: {0}", typeText)); } // В мастере отчетов заменяем текстовый тип на текст с вариантами if (isDesignedReport && pType == ReportParameterType.Text) { pType = ReportParameterType.VarText; } var parameter = isDesignedReport ? new ReportParameter( el.Attribute("name").Value, el.Attribute("title").Value, pType, sqlAttr != null ? el.Attribute("sql").Value : null, groupName, comparedExpr, sections) : new ReportParameter( el.Attribute("name").Value, el.Attribute("title").Value, pType, sqlAttr != null ? el.Attribute("sql").Value : null); result.Add(parameter); } return(result); }