Пример #1
0
        bool _InTableFooter;                    // true if tablecell is part of footer; simplifies HTML processing

        internal TableCell(ReportDefn r, ReportLink p, XmlNode xNode, int colIndex) : base(r, p)
        {
            _ColIndex    = colIndex;
            _ReportItems = null;
            _ColSpan     = 1;

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "ReportItems":
                    _ReportItems = new ReportItems(r, this, xNodeLoop);
                    break;

                case "ColSpan":
                    _ColSpan = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                default:
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown TableCell element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            // Must have exactly one ReportItems
            if (_ReportItems == null)
            {
                OwnerReport.rl.LogError(8, "ReportItems element is required with a TableCell but not specified.");
            }
            else if (_ReportItems.Items.Count != 1)
            {
                OwnerReport.rl.LogError(8, "Only one element in ReportItems element is allowed within a TableCell.");
            }

            // Obtain the tablecell's owner table;
            //		determine if tablecell is part of table header
            _InTableHeader = false;
            ReportLink rl;

            for (rl = this.Parent; rl != null; rl = rl.Parent)
            {
                if (rl is Table)
                {
                    _OwnerTable = (Table)rl;
                    break;
                }

                if (rl is Header && rl.Parent is Table)                 // Header and parent is Table (not TableGroup)
                {
                    _InTableHeader = true;
                }

                if (rl is Footer && rl.Parent is Table)                 // Header and parent is Table (not TableGroup)
                {
                    _InTableFooter = true;
                }
            }
            return;
        }
Пример #2
0
        // Constructor
        internal ReportDefn(XmlNode xNode, ReportLog replog, string folder, NeedPassword getpswd, int objcount, CrossDelegate crossdel) // report has no parents
        {
            rl           = replog;                                                                                                      // used for error reporting
            _ObjectCount = objcount;                                                                                                    // starting number for objects in this report; 0 other than for subreports
            GetDataSourceReferencePassword = getpswd;
            _ParseFolder      = folder;
            _Description      = null;
            _Author           = null;
            _AutoRefresh      = -1;
            _DataSourcesDefn  = null;
            _DataSetsDefn     = null;
            _Body             = null;
            _Width            = null;
            _PageHeader       = null;
            _PageFooter       = null;
            _PageHeight       = null;
            _PageWidth        = null;
            _LeftMargin       = null;
            _RightMargin      = null;
            _TopMargin        = null;
            _BottomMargin     = null;
            _EmbeddedImages   = null;
            _Language         = null;
            _CodeModules      = null;
            _Code             = null;
            _Classes          = null;
            _DataTransform    = null;
            _DataSchema       = null;
            _DataElementName  = null;
            _DataElementStyle = DataElementStyleEnum.AttributeNormal;
            _LUReportItems    = new Hashtable();                // to hold all the textBoxes
            _LUAggrScope      = new ListDictionary();           // to hold all dataset, dataregion, grouping names
            _LUEmbeddedImages = new ListDictionary();           // probably not very many
            _LUDynamicNames   = new Hashtable();
            _DataCache        = new List <ICacheData>();

            // EBN 30/03/2014
            SubReportGetContent = crossdel;

            // Run thru the attributes
            foreach (XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                case "Name":
                    _Name = new Name(xAttr.Value);
                    break;
                }
            }

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "Description":
                    _Description = xNodeLoop.InnerText;
                    break;

                case "Author":
                    _Author = xNodeLoop.InnerText;
                    break;

                case "AutoRefresh":
                    _AutoRefresh = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "DataSources":
                    _DataSourcesDefn = new DataSourcesDefn(this, null, xNodeLoop);
                    break;

                case "DataSets":
                    _DataSetsDefn = new DataSetsDefn(this, null, xNodeLoop);
                    break;

                case "Body":
                    _Body = new Body(this, null, xNodeLoop);
                    break;

                case "ReportParameters":
                    _ReportParameters = new ReportParameters(this, null, xNodeLoop);
                    break;

                case "Width":
                    _Width = new RSize(this, xNodeLoop);
                    break;

                case "PageHeader":
                    _PageHeader = new PageHeader(this, null, xNodeLoop);
                    break;

                case "PageFooter":
                    _PageFooter = new PageFooter(this, null, xNodeLoop);
                    break;

                case "PageHeight":
                    _PageHeight = new RSize(this, xNodeLoop);
                    break;

                case "PageWidth":
                    _PageWidth = new RSize(this, xNodeLoop);
                    break;

                case "LeftMargin":
                    _LeftMargin = new RSize(this, xNodeLoop);
                    break;

                case "RightMargin":
                    _RightMargin = new RSize(this, xNodeLoop);
                    break;

                case "TopMargin":
                    _TopMargin = new RSize(this, xNodeLoop);
                    break;

                case "BottomMargin":
                    _BottomMargin = new RSize(this, xNodeLoop);
                    break;

                case "EmbeddedImages":
                    _EmbeddedImages = new EmbeddedImages(this, null, xNodeLoop);
                    break;

                case "Language":
                    _Language = new Expression(this, null, xNodeLoop, ExpressionType.String);
                    break;

                case "Code":
                    _Code = new Code(this, null, xNodeLoop);
                    break;

                case "CodeModules":
                    _CodeModules = new CodeModules(this, null, xNodeLoop);
                    break;

                case "Classes":
                    _Classes = new Classes(this, null, xNodeLoop);
                    break;

                case "DataTransform":
                    _DataTransform = xNodeLoop.InnerText;
                    break;

                case "DataSchema":
                    _DataSchema = xNodeLoop.InnerText;
                    break;

                case "DataElementName":
                    _DataElementName = xNodeLoop.InnerText;
                    break;

                case "DataElementStyle":
                    _DataElementStyle = fyiReporting.RDL.DataElementStyle.GetStyle(xNodeLoop.InnerText, this.rl);
                    break;

                default:
                    // don't know this element - log it
                    this.rl.LogError(4, "Unknown Report element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }

            if (_Body == null)
            {
                rl.LogError(8, "Body not specified for report.");
            }

            if (_Width == null)
            {
                rl.LogError(4, "Width not specified for report.  Assuming page width.");
            }

            if (rl.MaxSeverity <= 4)                    // don't do final pass if already have serious errors
            {
                FinalPass(folder);                      // call final parser pass for expression resolution
            }

            // Cleanup any dangling resources
            if (_DataSourcesDefn != null)
            {
                _DataSourcesDefn.CleanUp(null);
            }
        }
Пример #3
0
        internal Table(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p, xNode)
        {
            _TableColumns             = null;
            _Header                   = null;
            _TableGroups              = null;
            _Details                  = null;
            _Footer                   = null;
            _FillPage                 = true;
            _DetailDataElementName    = "Details";
            _DetailDataCollectionName = "Details_Collection";
            _DetailDataElementOutput  = DataElementOutputEnum.Output;
            _IsGrid                   = xNode.Name != "Table"; // a grid is a restricted table to no data behind it

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "TableColumns":
                    _TableColumns = new TableColumns(r, this, xNodeLoop);
                    break;

                case "Header":
                    _Header = new Header(r, this, xNodeLoop);
                    break;

                case "TableGroups":
                    _TableGroups = new TableGroups(r, this, xNodeLoop);
                    break;

                case "Details":
                    _Details = new Details(r, this, xNodeLoop);
                    break;

                case "Footer":
                    _Footer = new Footer(r, this, xNodeLoop);
                    break;

                case "FillPage":
                    _FillPage = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "DetailDataElementName":
                    _DetailDataElementName = xNodeLoop.InnerText;
                    break;

                case "DetailDataCollectionName":
                    _DetailDataCollectionName = xNodeLoop.InnerText;
                    break;

                case "DetailDataElementOutput":
                    _DetailDataElementOutput = fyiReporting.RDL.DataElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    if (DataRegionElement(xNodeLoop))                                   // try at DataRegion level
                    {
                        break;
                    }
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown " + xNode.Name + " element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            DataRegionFinish();                                 // Tidy up the DataRegion
            if (_TableColumns == null)
            {
                OwnerReport.rl.LogError(8, "TableColumns element must be specified for a " + xNode.Name + ".");
                return;
            }

            // Verify Grid restrictions
            if (_IsGrid)
            {
                if (_TableGroups != null)
                {
                    OwnerReport.rl.LogError(8, "TableGroups not allowed in Grid element '" + xNode.Name + "'.");
                }
            }

            if (OwnerReport.rl.MaxSeverity < 8)
            {
                VerifyCC();                                     // Verify column count
            }
        }
        static void GetCustomReportItem(Dictionary <string, CustomReportItemEntry> crieDir, XmlNode xNode)
        {
            string friendlyTypeName = null;
            string codemodule       = null;
            string classname        = null;

            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "Type":
                    friendlyTypeName = xNodeLoop.InnerText;
                    break;

                case "CodeModule":
                    codemodule = xNodeLoop.InnerText;
                    break;

                case "ClassName":
                    classname = xNodeLoop.InnerText;
                    break;

                default:
                    break;
                }
            }
            if (friendlyTypeName == null)
            {
                return;         // nothing to do if no provider specified
            }
            CustomReportItemEntry crie;

            try
            {   // load the module early; saves problems with concurrency later
                string   msg        = null;
                Type     dotNetType = null;
                Assembly la         = null;
                if (codemodule != null && classname != null)
                {
                    // Check to see if previously loaded.  Many CustomReportItems share same CodeModule.
                    Assembly[] allLoadedAss = AppDomain.CurrentDomain.GetAssemblies();
                    foreach (Assembly ass in allLoadedAss)
                    {
                        var type = ass.GetType();
                        if (type.GetMethod("Location") != null)
                        {
                            if (ass.Location.Equals(codemodule, StringComparison.CurrentCultureIgnoreCase))
                            {
                                la = ass;
                                break;
                            }
                        }
                    }

                    if (la == null)     // not previously loaded?
                    {
                        la = XmlUtil.AssemblyLoadFrom(codemodule);
                    }
                    if (la == null)
                    {
                        msg = string.Format("{0} could not be loaded", codemodule);
                    }
                    else
                    {
                        dotNetType = la.GetType(classname);
                    }
                }

                crie = new CustomReportItemEntry(friendlyTypeName, dotNetType, msg);
                crieDir.Add(friendlyTypeName, crie);
            }
            catch (Exception e)
            {      // keep exception;  if this CustomReportItem is ever used we will see the message
                crie = new CustomReportItemEntry(friendlyTypeName, null, e.Message);
                crieDir.Add(friendlyTypeName, crie);
            }
        }
Пример #5
0
        internal bool ReportItemElement(XmlNode xNodeLoop)
        {
            switch (xNodeLoop.Name)
            {
            case "Style":
                _Style = new Style(OwnerReport, this, xNodeLoop);
                break;

            case "Action":
                _Action = new Action(OwnerReport, this, xNodeLoop);
                break;

            case "Top":
                _Top = new RSize(OwnerReport, xNodeLoop);
                break;

            case "Left":
                _Left = new RSize(OwnerReport, xNodeLoop);
                break;

            case "Height":
                _Height = new RSize(OwnerReport, xNodeLoop);
                break;

            case "Width":
                _Width = new RSize(OwnerReport, xNodeLoop);
                break;

            case "ZIndex":
                _ZIndex = XmlUtil.Integer(xNodeLoop.InnerText);
                break;

            case "Visibility":
                _Visibility = new Visibility(OwnerReport, this, xNodeLoop);
                break;

            case "ToolTip":
                _ToolTip = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.String);
                break;

            case "Label":
                _Label = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.Variant);
                break;

            case "LinkToChild":
                _LinkToChild = xNodeLoop.InnerText;
                break;

            case "Bookmark":
                _Bookmark = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.String);
                break;

            case "RepeatWith":
                _RepeatWith = xNodeLoop.InnerText;
                break;

            case "Custom":
                _Custom = new Custom(OwnerReport, this, xNodeLoop);
                break;

            case "DataElementName":
                _DataElementName = xNodeLoop.InnerText;
                break;

            case "DataElementOutput":
                _DataElementOutput = fyiReporting.RDL.DataElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                break;

            case "rd:DefaultName":
                break;          // MS tag: we don't use but don't want to generate a warning

            default:
                return(false);                          // Not a report item element
            }
            return(true);
        }
        static void GetDataSource(IDictionary dsDir, XmlNode xNode)
        {
            string provider          = null;
            string codemodule        = null;
            string cname             = null;
            string inter             = "SQL";
            string tselect           = null;
            bool   replaceparameters = false;

            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "DataProvider":
                    provider = xNodeLoop.InnerText;
                    break;

                case "CodeModule":
                    codemodule = xNodeLoop.InnerText;
                    break;

                case "Interface":
                    inter = xNodeLoop.InnerText;
                    break;

                case "ClassName":
                    cname = xNodeLoop.InnerText;
                    break;

                case "TableSelect":
                    tselect = xNodeLoop.InnerText;
                    break;

                case "ReplaceParameters":
                    if (xNodeLoop.InnerText.ToLower() == "true")
                    {
                        replaceparameters = true;
                    }
                    break;

                default:
                    break;
                }
            }
            if (provider == null)
            {
                return;         // nothing to do if no provider specified
            }
            SqlConfigEntry sce;

            try
            {   // load the module early; saves problems with concurrency later
                string   msg = null;
                Assembly la  = null;
                if (codemodule != null && cname != null)
                {
                    // When running report server and RdlEngineConfig is configured for local directy
                    // The file cannot be found without adding the current directoyr
                    if (System.IO.File.Exists(codemodule) == false && System.IO.Path.GetFileName(codemodule) == codemodule)
                    {
                        if (AppDomain.CurrentDomain.RelativeSearchPath != null)
                        {
                            codemodule = System.IO.Path.Combine(AppDomain.CurrentDomain.RelativeSearchPath, codemodule);
                        }
                        else if (AppDomain.CurrentDomain.BaseDirectory != null)
                        {
                            codemodule = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, codemodule);
                        }
                    }

                    if (System.IO.File.Exists(codemodule) == false)
                    {
                        sce = new SqlConfigEntry(provider, codemodule, cname, null, tselect, codemodule + " could not be found");
                        dsDir.Add(provider, sce);
                        return;
                    }

                    // check to see if the DLL has been previously loaded
                    //   many of the DataProvider done by fyiReporting are in a single code module
                    foreach (SqlConfigEntry sc in dsDir.Values)
                    {
                        if (sc.FileName == codemodule &&
                            sc.CodeModule != null)
                        {
                            la = sc.CodeModule;
                            break;
                        }
                    }
                    if (la == null)
                    {
                        la = XmlUtil.AssemblyLoadFrom(codemodule);
                    }
                    if (la == null)
                    {
                        msg = string.Format("{0} could not be loaded", codemodule);
                    }
                }
                sce = new SqlConfigEntry(provider, codemodule, cname, la, tselect, msg);
                dsDir.Add(provider, sce);
            }
            catch (Exception e)
            {      // keep exception;  if this DataProvided is ever useed we will see the message
                sce = new SqlConfigEntry(provider, codemodule, cname, null, tselect, e.Message);
                dsDir.Add(provider, sce);
            }
            sce.ReplaceParameters = replaceparameters;
        }
Пример #7
0
        private void DrawMap(Report rpt, Graphics g, string mapfile, double max, double min)
        {
            string file = XmlUtil.XmlFileExists(mapfile);

            MapData mp;

            if (file != null)
            {
                mp = MapData.Create(file);
            }
            else
            {
                rpt.rl.LogError(4, string.Format("Map Subtype file {0} not found.", mapfile));
                mp = new MapData();         // we'll at least put up something; but it won't be right
            }
            float scale = mp.GetScale(Layout.PlotArea.Width, Layout.PlotArea.Height);

            for (int iRow = 1; iRow <= CategoryCount; iRow++)
            {
                for (int iCol = 1; iCol <= SeriesCount; iCol++)
                {
                    string sv = GetSeriesValue(rpt, iCol);

                    string            c  = this.GetDataValueString(rpt, iRow, iCol);
                    List <MapPolygon> pl = mp.GetPolygon(sv);
                    if (pl == null)
                    {
                        continue;
                    }
                    Brush br = new SolidBrush(XmlUtil.ColorFromHtml(c, Color.Transparent));
                    foreach (MapPolygon mpoly in pl)
                    {
                        PointF[] polygon  = mpoly.Polygon;
                        PointF[] drawpoly = new PointF[polygon.Length];
                        // make points relative to plotarea --- need to scale this as well
                        for (int ip = 0; ip < drawpoly.Length; ip++)
                        {
                            drawpoly[ip] = new PointF(Layout.PlotArea.X + (polygon[ip].X * scale), Layout.PlotArea.Y + (polygon[ip].Y * scale));
                        }
                        g.FillPolygon(br, drawpoly);
                        if (_showToolTips)
                        {
                            StringBuilder sb = new StringBuilder();
                            sb.Append("PolyToolTip:");
                            sb.Append(sv.Replace('|', '/'));        // we treat '|' as a separator character; don't allow in string
                            sb.Append(' ');
                            sb.Append(c.Replace('|', '/'));
                            foreach (PointF pf in drawpoly)
                            {
                                sb.AppendFormat(NumberFormatInfo.InvariantInfo, "|{0}|{1}", pf.X, pf.Y);
                            }
                            g.AddMetafileComment(new System.Text.ASCIIEncoding().GetBytes(sb.ToString()));
                        }
                    }
                    br.Dispose();
                }
            }
            // draw the outline of the map
            foreach (MapObject mo in mp.MapObjects)
            {
                mo.Draw(g, scale, Layout.PlotArea.X, Layout.PlotArea.Y);
            }
        }
Пример #8
0
        TrueFalseAutoEnum _UsedInQuery;   // Enum True | False | Auto (default)
        //	Indicates whether or not the parameter is
        //	used in a query in the report. This is
        //	needed to determine if the queries need
        //	to be re-executed if the parameter
        //	changes. Auto indicates the
        //	UsedInQuery setting should be
        //	autodetected as follows: True if the
        //	parameter is referenced in any query
        //	value expression.

        internal ReportParameter(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
        {
            _Name         = null;
            _dt           = TypeCode.Object;
            _Nullable     = false;
            _DefaultValue = null;
            _AllowBlank   = false;
            _Prompt       = null;
            _ValidValues  = null;
            _UsedInQuery  = TrueFalseAutoEnum.Auto;
            // Run thru the attributes
            foreach (XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                case "Name":
                    _Name = new Name(xAttr.Value);
                    break;
                }
            }
            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "DataType":
                    _dt          = DataType.GetStyle(xNodeLoop.InnerText, this.OwnerReport);
                    _NumericType = DataType.IsNumeric(_dt);
                    break;

                case "Nullable":
                    _Nullable = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "DefaultValue":
                    _DefaultValue = new DefaultValue(r, this, xNodeLoop);
                    break;

                case "AllowBlank":
                    _AllowBlank = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "Prompt":
                    _Prompt = xNodeLoop.InnerText;
                    break;

                case "Hidden":
                    _Hidden = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    OwnerReport.rl.LogError(4, "ReportParameter element Hidden is currently ignored.");                                 // TODO
                    break;

                case "MultiValue":
                    _MultiValue = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "ValidValues":
                    _ValidValues = new ValidValues(r, this, xNodeLoop);
                    break;

                case "UsedInQuery":
                    _UsedInQuery = TrueFalseAuto.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown ReportParameter element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            if (_Name == null)
            {
                OwnerReport.rl.LogError(8, "ReportParameter name is required but not specified.");
            }

            if (_dt == TypeCode.Object)
            {
                OwnerReport.rl.LogError(8, string.Format("ReportParameter DataType is required but not specified or invalid for {0}.", _Name == null? "<unknown name>": _Name.Nm));
            }
        }
Пример #9
0
        bool _Clustered;                                    // Determines if data series are clustered
        // (displayed along distinct rows). Only
        // applies to bar and column chart types.  Defaults to false.

        internal ThreeDProperties(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
        {
            _Enabled        = false;
            _ProjectionMode = ThreeDPropertiesProjectionModeEnum.Perspective;
            _Rotation       = 0;
            _Inclination    = 0;
            _Perspective    = 0;
            _HeightRatio    = 0;
            _DepthRatio     = 0;
            _Shading        = ThreeDPropertiesShadingEnum.None;
            _GapDepth       = 0;
            _WallThickness  = 0;
            _DrawingStyle   = ThreeDPropertiesDrawingStyleEnum.Cube;
            _Clustered      = false;

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "Enabled":
                    _Enabled = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "ProjectionMode":
                    _ProjectionMode = ThreeDPropertiesProjectionMode.GetStyle(xNodeLoop.InnerText);
                    break;

                case "Rotation":
                    _Rotation = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "Inclination":
                    _Inclination = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "Perspective":
                    _Perspective = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "HeightRatio":
                    _HeightRatio = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "DepthRatio":
                    _DepthRatio = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "Shading":
                    _Shading = ThreeDPropertiesShading.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "GapDepth":
                    _GapDepth = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "WallThickness":
                    _WallThickness = XmlUtil.Integer(xNodeLoop.InnerText);
                    break;

                case "DrawingStyle":
                    _DrawingStyle = ThreeDPropertiesDrawingStyle.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "Clustered":
                    _Clustered = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    break;
                }
            }
        }
Пример #10
0
        static void GetDataSource(XmlNode xNode)
        {
            string provider          = null;
            string codemodule        = null;
            string cname             = null;
            string inter             = "SQL";
            string tselect           = null;
            bool   replaceparameters = false;

            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "DataProvider":
                    provider = xNodeLoop.InnerText;
                    break;

                case "CodeModule":
                    codemodule = xNodeLoop.InnerText;
                    break;

                case "Interface":
                    inter = xNodeLoop.InnerText;
                    break;

                case "ClassName":
                    cname = xNodeLoop.InnerText;
                    break;

                case "TableSelect":
                    tselect = xNodeLoop.InnerText;
                    break;

                case "ReplaceParameters":
                    if (xNodeLoop.InnerText.ToLower() == "true")
                    {
                        replaceparameters = true;
                    }
                    break;

                default:
                    break;
                }
            }
            if (provider == null)
            {
                return;                                 // nothing to do if no provider specified
            }
            SqlConfigEntry sce;

            try
            {               // load the module early; saves problems with concurrency later
                string   msg = null;
                Assembly la  = null;
                if (codemodule != null && cname != null)
                {
                    la = XmlUtil.AssemblyLoadFrom(codemodule);
                    if (la == null)
                    {
                        msg = string.Format("{0} could not be loaded", codemodule);
                    }
                }
                sce = new SqlConfigEntry(provider, cname, la, tselect, msg);
                SqlEntries.Add(provider, sce);
            }
            catch (Exception e)
            {                           // keep exception;  if this DataProvided is ever useed we will see the message
                sce = new SqlConfigEntry(provider, cname, null, tselect, e.Message);
                SqlEntries.Add(provider, sce);
            }
            sce.ReplaceParameters = replaceparameters;
        }