예제 #1
0
        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)
                    {
                        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);
            }
        }
예제 #2
0
        private Color ReadXmlColor(XmlReader xr)
        {
            string sc = xr.ReadString();

            return(XmlUtil.ColorFromHtml(sc, Color.Empty));
        }
예제 #3
0
        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)
                {
                    // 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;
        }
예제 #4
0
        public 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 = Oranikle.Report.Engine.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);
        }