示例#1
0
        internal void LoadValues(Report rpt)
        {
            if (_dataSetReference != null)
            {
                DataSet ds = rpt.DataSets[_dataSetReference.DataSetName];
                if (ds == null)
                {
                    throw new Exception("Invalid data set " + _dataSetReference.DataSetName + " in DefaultValue");
                }

                if (ds.Fields[_dataSetReference.ValueField] == null)
                {
                    throw new Exception("Invalid value field " + _dataSetReference.ValueField + " in DefaultValue");
                }
                if (ds.Fields[_dataSetReference.LableField] == null)
                {
                    throw new Exception("Invalid label field " + _dataSetReference.LableField + " in DefaultValue");
                }

                System.Data.DataSet dsTemp = new System.Data.DataSet();
                ds.Initialize(dsTemp);
                Rdl.Runtime.Context context = new Rdl.Runtime.Context(null, ds, null, null, null);
                while (context.CurrentRow != null)
                {
                    _values.Add(new Expression(
                                    context.CurrentRow[_dataSetReference.ValueField].ToString(), this, false));

                    context.MoveNext();
                }
            }
        }
示例#2
0
        public void LoadValidValues(Report rpt)
        {
            _validValues = new List <ParameterValue>();
            if (_validValuesDS != null)
            {
                DataSet ds = rpt.DataSets[_validValuesDS.DataSetName];
                if (ds == null)
                {
                    throw new Exception("Invalid data set " + _validValuesDS.DataSetName + " in ReportParameter");
                }

                if (ds.Fields[_validValuesDS.ValueField] == null)
                {
                    throw new Exception("Invalid value field " + _validValuesDS.ValueField + " in ReportParameter");
                }
                if (_validValuesDS.LableField != null && ds.Fields[_validValuesDS.LableField] == null)
                {
                    throw new Exception("Invalid label field " + _validValuesDS.LableField + " in ReportParameter");
                }

                //System.Data.DataSet dsTemp = new System.Data.DataSet();
                //ds.Initialize(dsTemp);
                ds.Reset();
                Rdl.Runtime.Context context = new Rdl.Runtime.Context(null, ds, null, null, null);
                ValidValues.Clear();
                while (context.CurrentRow != null)
                {
                    string value = context.CurrentRow[_validValuesDS.ValueField].ToString();
                    string label = string.Empty;

                    if (_validValuesDS.LableField != null)
                    {
                        label = context.CurrentRow[_validValuesDS.LableField].ToString();
                    }
                    ParameterValue pv = new ParameterValue(value, label);
                    if (!_validValues.Contains(pv))
                    {
                        _validValues.Add(pv);
                    }

                    context.MoveNext();
                }
            }
        }
示例#3
0
        internal override void Render(Rdl.Render.Container box, Rdl.Runtime.Context context)
        {
            bool hidden = false;

            context = new Rdl.Runtime.Context(
                context,
                null,
                null,
                _grouping,
                _sortBy);

            TextBox tb = FindToggleItem(_visibility);

            if (_visibility != null && _visibility.ToggleItem == null)
            {
                hidden = _visibility.IsHidden(context);
            }
            ;

            // Loop through all of the rows in the data context
            decimal top = 0;

            while (true)
            {
                if (_grouping == null && context.CurrentRow == null)
                {
                    break;
                }
                if (_grouping != null && context.GroupIndex >= context.GroupCount)
                {
                    break;
                }

                foreach (Row tr in _tableRows)
                {
                    Rdl.Render.FixedContainer rowBox = null;
                    if (box != null && !hidden)
                    {
                        rowBox             = box.AddFixedContainer(this, Style, context);
                        rowBox.Name        = "RowBox";
                        rowBox.Top         = top;
                        rowBox.Width       = box.Width;
                        rowBox.ContextBase = true;

                        if (tb != null)
                        {
                            tb.LinkedToggles.Add(new Toggle(rowBox, tb));
                        }
                    }

                    tr.Render(rowBox, context);

                    if (box != null && !hidden)
                    {
                        top       += rowBox.Height;
                        box.Height = top;
                    }
                }

                context.LinkToggles();
                if (_grouping == null)
                {
                    context.MoveNext();
                }
                else
                {
                    context.NextGroup();
                }
            }
        }