Exemple #1
0
 public object Exec(RdlRuntime.Context context)
 {
     if (_key >= 0)
     {
         return(Report.Rtb.Exec(_key, context));
     }
     else
     {
         return(_expression);
     }
 }
Exemple #2
0
 internal object GetValue(RdlRuntime.Context context)
 {
     if (_dataField != null)
     {
         return(context.CurrentRow[_dataField]);
     }
     else if (_value != null)
     {
         return(_value.Exec(context));
     }
     return(null);
 }
Exemple #3
0
        public override void Render(RdlRender.Container box)
        {
            base.Render(box);

            DataSet ds = Report.DataSets[_dataSetName];

            if (ds == null)
            {
                throw new Exception("Invalid dataSetName " + _dataSetName + " in DataRegion " + _name);
            }

            _context = new RdlRuntime.Context(
                ParentContext(ds),
                ds,
                _filters,
                null,
                null);
            box.ContextBase = true;
        }
Exemple #4
0
        public RdlRender.FixedContainer Render()
        {
            FixedContainer topBox = new FixedContainer(null, this, new BoxStyle(Style.DefaultStyle));

            topBox.Name = "Report";
            if (_width.points > 0)
            {
                topBox.Width = _width.points;
                topBox.CanGrowHorizonally = false;
            }

            // Set up the compiler
            CompilerParameters cp = new CompilerParameters();

            cp.GenerateExecutable    = false;
            cp.GenerateInMemory      = true;
            cp.TreatWarningsAsErrors = false;
            if (File.Exists(System.AppDomain.CurrentDomain.RelativeSearchPath + @"\rdlEngine.dll"))
            {
                cp.ReferencedAssemblies.Add(System.AppDomain.CurrentDomain.RelativeSearchPath + @"\rdlEngine.dll");
            }
            else if (File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + @"\rdlEngine.dll"))
            {
                cp.ReferencedAssemblies.Add(System.AppDomain.CurrentDomain.BaseDirectory + @"\rdlEngine.dll");
            }
            else
            {
                throw new Exception("Unable to file rdlEngine.dll");
            }

            // Replace the aggregate function calls with deletage calls.
            int ct = _functions.Count;

            for (int i = 0; i < ct; i++)
            {
                _functions[i] = ReplaceAggregatesWithDelegates(_functions[i]);
            }

            // Build the source code for the named functions.
            string addFns    = string.Empty;
            string functions = string.Empty;

            for (int i = 0; i < _functions.Count; i++)
            {
                addFns    += "     AddFunction( AddressOf fn_" + i.ToString() + " )\n";
                functions += _functions[i] + "\n";
            }

            string source = RdlEngine.RdlResource.RuntimeCode;

            source = source.Replace(@"' Add Functions", addFns);
            source = source.Replace(@"' Functions", functions);

            // Compile the runtime source
            CodeDomProvider provider = new VBCodeProvider();
            CompilerResults cr       = provider.CompileAssemblyFromSource(cp, new string[] { source });

            if (cr.Errors.Count > 0)
            {
                throw new Exception("Compile errors");
            }

            // Get a reference to a RunTimeBase object.
            Assembly CodeAssembly = cr.CompiledAssembly;
            Type     ty           = CodeAssembly.GetType("RdlRuntime.RunTimeClass");

            Rtb = (RdlRuntime.RuntimeBase)Activator.CreateInstance(ty,
                                                                   new object[] { this });

            // Initialize the data sets.
            _dataSets.Initialize();

            // Set the default DataSet for the report
            if (_dataSchema != null)
            {
                _reportDataSet = _dataSets[_dataSchema];
            }
            else
            {
                _reportDataSet = _dataSets.FirstDataSet;
            }

            // Set up the default data context.
            _context = new RdlRuntime.Context(
                null, _reportDataSet, null, null, null);
            topBox.ContextBase = true;

            // Render the report.
            _body.Render(topBox);

            topBox.LinkToggles();

            return(topBox);
        }
Exemple #5
0
        public override void Render(RdlRender.Container box)
        {
            bool hidden = false;

            base.Render(box);

            RdlRuntime.Context parentContext = ParentContext(null);
            _context = new RdlRuntime.Context(
                parentContext,
                null,
                null,
                _grouping,
                _sortBy);

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

            // 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 (TableRow tr in _tableRows)
                {
                    RdlRender.FixedContainer rowBox = null;
                    if (box != null && !hidden)
                    {
                        rowBox             = box.AddFixedContainer(this, Style);
                        rowBox.Name        = "RowBox";
                        rowBox.Top         = top;
                        rowBox.Width       = box.Width;
                        rowBox.ContextBase = true;
                    }

                    tr.Render(rowBox);

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

                if (_grouping == null)
                {
                    _context.MoveNext();
                }
                else
                {
                    _context.NextGroup();
                }
            }
        }
Exemple #6
0
 internal bool IsMissing(RdlRuntime.Context context)
 {
     return(!context.DataSet.Table.Columns.Contains(_dataField));
 }
Exemple #7
0
        public override void Render(RdlRender.Container box)
        {
            RdlRender.FixedContainer headerBox  = null;
            RdlRender.FlowContainer  detailsBox = null;
            RdlRender.FixedContainer footerBox  = null;
            RdlRender.FlowContainer  groupRow   = null;

            _context = new RdlRuntime.Context(
                ParentContext(null),
                null,
                null,
                _grouping,
                _sortBy);

            base.Render(box);

            if (box != null)
            {
                _box = box.AddFlowContainer(this, Style);
                _box.CanGrowVertically = true;
                _box.Width             = box.Width;
                _box.Name = "TableGroup";
            }

            // Render the header
            decimal groupTop = 0;

            while (_context.GroupIndex < _context.GroupCount)
            {
                if (_box != null)
                {
                    groupRow = _box.AddFlowContainer(this, Style);
                    groupRow.CanGrowVertically = true;
                    groupRow.Width             = _box.Width;
                    groupRow.Top         = groupTop;
                    groupRow.Name        = "GroupRrow";
                    groupRow.ContextBase = true;
                }

                if (_header != null)
                {
                    if (_box != null)
                    {
                        headerBox     = groupRow.AddFixedContainer(this, _header.Style);
                        headerBox.Top = 0;
                        headerBox.CanGrowVertically = true;
                        headerBox.Width             = groupRow.Width;
                        headerBox.Name = "GroupHeader";
                    }

                    _header.Render(headerBox);
                }

                // Create a box to hold the details and tie that
                // box to any repeat lists referencing these details.
                if (_details != null && groupRow != null)
                {
                    detailsBox     = groupRow.AddFlowContainer(this, _details.Style);
                    detailsBox.Top = (headerBox == null)?0:headerBox.Height;
                    detailsBox.CanGrowVertically = true;
                    detailsBox.Width             = groupRow.Width;
                    detailsBox.Name = "GroupDetails";

                    // If the header or footer are repeated, then add them to the repeat list of the details.
                    if (_header != null && _header.RepeatOnNewPage)
                    {
                        detailsBox.RepeatList.Add(headerBox);
                    }
                    if (_footer != null && _footer.RepeatOnNewPage)
                    {
                        detailsBox.RepeatList.Add(footerBox);
                    }
                }

                // Render the details.
                if (_details != null)
                {
                    _details.Render(detailsBox);
                }

                // Render the footer.
                if (_footer != null)
                {
                    if (groupRow != null)
                    {
                        footerBox      = groupRow.AddFixedContainer(this, _footer.Style);
                        footerBox.Name = "GroupFooter";
                        footerBox.CanGrowVertically = true;
                        footerBox.Top = ((headerBox == null) ? 0 : headerBox.Height) +
                                        ((detailsBox == null) ? 0 : detailsBox.Height);
                        footerBox.Width = _box.Width;
                    }
                    _context.RowIndex = 0;
                    _footer.Render(footerBox);
                }

                if (groupRow != null)
                {
                    groupTop += groupRow.Height;
                }

                _context.NextGroup();
            }
        }