Example #1
0
        private static List <string> GetTableFullNames()
        {
            var list  = new List <string>();
            var nodes = XmlManager.GetList("/Tables/Table", XmlEnum.Field);

            if (nodes != null && nodes.Count > 0)
            {
                for (var i = 0; i < nodes.Count; i++)
                {
                    var node = nodes[i];
                    try
                    {
                        var name  = node.Attributes["Name"].Value;
                        var title = node.Attributes["Title"].Value;
                        if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(title))
                        {
                            list.Add(string.Format("{0}({1})", title, name));
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return(list);
        }
Example #2
0
        public void Check()
        {
            var nodes = XmlManager.GetList("/Folders/Folder", XmlEnum.DataTree);

            if (nodes != null && nodes.Count > 0)
            {
                for (var i = 0; i < nodes.Count; i++)
                {
                    var node = nodes[i];
                    var name = node.Attributes["Name"].Value;
                    Check(System.IO.Path.Combine(ParameterManager.Folder, name), node);
                }
            }
        }
Example #3
0
        private static Dictionary <CollectTable, List <ExcelField> > GetFields(string queryString)
        {
            var dict  = new Dictionary <CollectTable, List <ExcelField> >();
            var nodes = XmlManager.GetList(queryString, XmlEnum.Field);
            var a     = 0;

            if (nodes != null)
            {
                foreach (System.Xml.XmlNode node in nodes)
                {
                    var table = new CollectTable
                    {
                        Name      = node.Attributes["Name"].Value,
                        Title     = node.Attributes["Title"].Value,
                        TableName = node.Attributes["TableName"].Value,
                        Model2    = node.Attributes["Model2"].Value,
                        Model3    = node.Attributes["Model3"].Value
                    };

                    if (node.Attributes["Regex"] != null)
                    {
                        table.Regex = node.Attributes["Regex"].Value;
                    }
                    if (node.Attributes["Model"] != null)
                    {
                        table.Model = node.Attributes["Model"].Value;
                    }
                    if (node.Attributes["CollectIndex"] != null)
                    {
                        if (int.TryParse(node.Attributes["CollectIndex"].Value, out a))
                        {
                            table.CollectIndex = a;
                        }
                    }
                    if (node.Attributes["StartIndex"] != null)
                    {
                        if (int.TryParse(node.Attributes["StartIndex"].Value, out a))
                        {
                            table.StartIndex = a;
                        }
                    }
                    var list = GetFields(node, table.TableName);
                    dict.Add(table, list);
                }
            }


            return(dict);
        }
Example #4
0
        private static List <string> GetChildFolder()
        {
            var list  = new List <string>();
            var nodes = XmlManager.GetList("/Folders/Folder", XmlEnum.DataTree);

            if (nodes != null && nodes.Count > 0)
            {
                for (var i = 0; i < nodes.Count; i++)
                {
                    var node = nodes[i];
                    list.AddRange(GetChildFolder(node, Folder));
                }
            }
            return(list);
        }
Example #5
0
        private static List <Rule> GetRules()
        {
            var nodes = XmlManager.GetList("/Tables/Rules/Category", XmlEnum.Field);

            if (nodes == null || nodes.Count == 0)
            {
                return(null);
            }
            var list = new List <Rule>();

            for (var i = 0; i < nodes.Count; i++)
            {
                var node     = nodes[i];
                var category = node.Attributes["Name"].Value;
                if (string.IsNullOrEmpty(category))
                {
                    continue;
                }
                var children = node.SelectNodes("/Rule");
                if (children == null || children.Count == 0)
                {
                    continue;
                }
                for (var j = 0; j < children.Count; j++)
                {
                    var entry = children[j];
                    list.Add(new Rule
                    {
                        ID       = entry.Attributes["ID"].Value,
                        Title    = entry.Attributes["Title"].Value,
                        Category = category
                    });
                }
            }

            return(list);
        }
Example #6
0
        private static List <CollectXZQ> GetCollectXZQ()
        {
            var list  = new List <CollectXZQ>();
            var nodes = XmlManager.GetList("/Tables/Citys/Citys", XmlEnum.Field);

            if (nodes != null && nodes.Count > 0)
            {
                for (var i = 0; i < nodes.Count; i++)
                {
                    var node  = nodes[i];
                    var model = new CollectXZQ
                    {
                        XZQDM = node.Attributes["Code"].Value,
                        XZQMC = node.Attributes["Name"].Value
                    };
                    var children = node.SelectNodes("City");
                    if (children != null && children.Count > 0)
                    {
                        var result = new List <XZC>();
                        for (var j = 0; j < children.Count; j++)
                        {
                            var child = children[j];
                            var entry = new XZC
                            {
                                XZCDM = child.Attributes["Code"].Value,
                                XZCMC = child.Attributes["Name"].Value
                            };
                            result.Add(entry);
                        }
                        model.Children = result.OrderBy(e => e.XZCDM).ToList();
                    }
                    list.Add(model);
                }
            }
            return(list.OrderBy(e => e.XZQDM).ToList());
        }
Example #7
0
        private static List <StockTable> GetStockTables()
        {
            var list   = new List <StockTable>();
            var tables = XmlManager.GetList("/Tables/Table", XmlEnum.Field);

            if (tables != null)
            {
                var length = 0;
                for (var i = 0; i < tables.Count; i++)
                {
                    var table      = tables[i];
                    var stockTable = new StockTable
                    {
                        Name    = table.Attributes["Name"].Value,
                        Title   = table.Attributes["Title"].Value,
                        IsSpace = table.Attributes["IsSpace"].Value == "true" ? true : false
                    };
                    if (table.Attributes["Type"] != null)
                    {
                        stockTable.Type = table.Attributes["Type"].Value;
                    }

                    var fields = table.SelectNodes("Field");
                    if (fields != null)
                    {
                        var ff = new List <Models.Field>();
                        for (var j = 0; j < fields.Count; j++)
                        {
                            var fi  = fields[j];
                            var str = fi.Attributes["Type"].Value;
                            if (!string.IsNullOrEmpty(str))
                            {
                                var item = new Models.Field()
                                {
                                    Name   = fi.Attributes["Name"].Value,
                                    Title  = fi.Attributes["Title"].Value,
                                    Length = int.TryParse(fi.Attributes["Length"].Value, out length) ? length : 0,
                                };
                                switch (str.ToLower())
                                {
                                case "int":
                                    item.Type = Models.FieldType.Int;
                                    break;

                                case "float":
                                    item.Type = Models.FieldType.Float;
                                    break;

                                case "char":
                                    item.Type = Models.FieldType.Char;
                                    break;
                                }
                                if (fi.Attributes["Min"] != null && int.TryParse(fi.Attributes["Min"].Value, out length))
                                {
                                    item.Min = length;
                                }
                                ff.Add(item);
                            }
                        }
                        stockTable.Fields = ff;
                    }
                    list.Add(stockTable);
                }
            }
            return(list);
        }