Ejemplo n.º 1
0
 public bool ExistsFieldInfo(TableField tf)
 {
     foreach (TableField temp in tableFieldCollection)
     {
         if (temp.GisName == tf.GisName)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
 public void ReadConfig(string filePath)
 {
     if (this._listTable != null && this._listTable.Count > 0)
     {
         return;
     }
     try
     {
         if (!File.Exists(filePath))
         {
             return;
         }
         XmlDocument xmlDoc = new XmlDocument();
         xmlDoc.Load(filePath);
         if (xmlDoc == null)
         {
             return;
         }
         XmlNode root = xmlDoc.SelectSingleNode("Tables");
         if (root == null)
         {
             return;
         }
         foreach (XmlNode node in root.ChildNodes)
         {
             if (node.Name != "Table")
             {
                 continue;
             }
             if (node.Attributes["name"] == null)
             {
                 continue;
             }
             string name = "", fc2D = "";
             if (node.Attributes["name"] != null)
             {
                 name = node.Attributes["name"].Value.Trim(); if (string.IsNullOrEmpty(name))
                 {
                     continue;
                 }
             }
             if (node.Attributes["fc2D"] != null)
             {
                 fc2D = node.Attributes["fc2D"].Value.Trim();
                 //if (string.IsNullOrEmpty(fc2D)) continue;
             }
             Table table = new Table(name, fc2D);
             foreach (XmlNode cnode in node.ChildNodes)
             {
                 if (cnode.Name != "StdField")
                 {
                     continue;
                 }
                 if (cnode.Attributes["cadname"] == null)
                 {
                     continue;
                 }
                 string fieldName = "", fieldAliasName = "", dataType = "";
                 if (cnode.Attributes["gisname"] != null)
                 {
                     fieldName = cnode.Attributes["gisname"].Value.Trim();
                 }
                 if (cnode.Attributes["cadname"] != null)
                 {
                     fieldAliasName = cnode.Attributes["cadname"].Value.Trim();
                 }
                 if (cnode.Attributes["datatype"] != null)
                 {
                     dataType = cnode.Attributes["datatype"].Value.Trim();
                 }
                 TableField tf = new TableField(fieldName, fieldAliasName, dataType);
                 table.TableFieldCollection.Add(tf);
             }
             this.Add(table);
         }
     }
     catch (System.Exception ex)
     {
     }
 }