diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 0144124..e88befb 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 0144124..e88befb 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmMetadataStat.cs b/FrmMetadataStat.cs index cb19f84..c3c1359 100644 --- a/FrmMetadataStat.cs +++ b/FrmMetadataStat.cs @@ -2,16 +2,16 @@ using System.Collections; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; -using System.Xml; using DevComponents.DotNetBar; namespace Cyberpipe { public partial class FrmMetadataStat : Office2007Form { - Dictionary dic = new Dictionary(); + public FrmMetadataStat() { InitializeComponent(); @@ -22,7 +22,7 @@ string sql = "select LAYERNAME from casic_metadataLayer where LAYERNAME like '%" + keywordsTxt.Text.Trim() + "%'"; DataTable table = OledbHelper.QueryTable(sql); - int num = table.Rows.Count; + int num = 0; resultList.Clear(); consLblC.Text = ""; @@ -32,6 +32,7 @@ if (table != null && table.Rows.Count > 0) { + num = table.Rows.Count; for (int i = 0; i < num;i++ ) { resultList.Items.Add(table.Rows[i][0].ToString()); @@ -56,7 +57,8 @@ int metadataLayernum = statistMDLayer(); int nomdLayernum = layernum - metadataLayernum; //MessageBox.Show("共有多少层?" + layernum.ToString()+"=="+metadataLayernum.ToString()+"=="+nomdLayernum.ToString()); - dic.Clear(); +// dic.Clear(); + Dictionary dic = new Dictionary(); dic.Add("已建",metadataLayernum); dic.Add("未建", nomdLayernum); @@ -74,11 +76,9 @@ foreach (string key in dic.Keys) { - if (dic[key] != 0) - { - xlist.Add(key); - ylist.Add(dic[key]); - } + if (dic[key] == 0) continue; + xlist.Add(key); + ylist.Add(dic[key]); } chart1.Series[0].Points.DataBindXY(xlist, ylist); @@ -89,73 +89,15 @@ string sql = "select * from casic_metadataLayer"; DataTable table = OledbHelper.QueryTable(sql); - mdlayernum = table.Rows.Count; + if(table!=null)mdlayernum = table.Rows.Count; return mdlayernum; } //统计有多少个图层 - private int statistLayer() { - int layernum = 0; - - string filename = Utility.filename; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(filename); - XmlNodeList Params1 = doc.SelectNodes("/Params/layers"); - - foreach (XmlNode paramsNode in Params1) //layers - { - foreach (XmlNode layerNode in paramsNode) //layer - { - //MessageBox.Show(layerNode.Attributes["label"].Value); - - if (layerNode.HasChildNodes) - { - foreach (XmlNode layerchildNode in layerNode) //layerchild - { - //MessageBox.Show(layerchildNode.Attributes["label"].Value); - if (layerchildNode.Name == "layerchild") - { - layernum++; - } - else if (layerchildNode.Name == "layertype") - { - if (layerchildNode.HasChildNodes) - { - foreach (XmlNode childNodeLayer in layerchildNode)//layertype下的layerchild - { - //MessageBox.Show(childNodeLayer.Attributes["label"].Value); - if (childNodeLayer.HasChildNodes) - { - - foreach (XmlNode n in childNodeLayer) - { - layernum++; - } - } - else - { - - layernum++; - } - } - } - } - - } - } - } - - } - - - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - return layernum; + private int statistLayer() + { + List datasrcs = Utility.layerConfig.datasrcs; + return datasrcs.SelectMany(datasrc => datasrc.layertypes).Sum(layerType => layerType.layers.Count); } //选择list @@ -174,7 +116,6 @@ + "join casic_metadatalayer on casic_metadatalayer.LAYERID = casic_metadatacontent.LAYERID " + "where casic_metadatalayer.LAYERNAME='" + layername + "'"; DataTable table = OledbHelper.QueryTable(sql); - int num = table.Rows.Count; //MessageBox.Show(num.ToString()); if (table != null && table.Rows.Count > 0) { @@ -192,10 +133,5 @@ ntLblC.Text = ""; } } - - private void buttonX1_Click(object sender, EventArgs e) - { - drawChart(); - } } } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 0144124..e88befb 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmMetadataStat.cs b/FrmMetadataStat.cs index cb19f84..c3c1359 100644 --- a/FrmMetadataStat.cs +++ b/FrmMetadataStat.cs @@ -2,16 +2,16 @@ using System.Collections; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; -using System.Xml; using DevComponents.DotNetBar; namespace Cyberpipe { public partial class FrmMetadataStat : Office2007Form { - Dictionary dic = new Dictionary(); + public FrmMetadataStat() { InitializeComponent(); @@ -22,7 +22,7 @@ string sql = "select LAYERNAME from casic_metadataLayer where LAYERNAME like '%" + keywordsTxt.Text.Trim() + "%'"; DataTable table = OledbHelper.QueryTable(sql); - int num = table.Rows.Count; + int num = 0; resultList.Clear(); consLblC.Text = ""; @@ -32,6 +32,7 @@ if (table != null && table.Rows.Count > 0) { + num = table.Rows.Count; for (int i = 0; i < num;i++ ) { resultList.Items.Add(table.Rows[i][0].ToString()); @@ -56,7 +57,8 @@ int metadataLayernum = statistMDLayer(); int nomdLayernum = layernum - metadataLayernum; //MessageBox.Show("共有多少层?" + layernum.ToString()+"=="+metadataLayernum.ToString()+"=="+nomdLayernum.ToString()); - dic.Clear(); +// dic.Clear(); + Dictionary dic = new Dictionary(); dic.Add("已建",metadataLayernum); dic.Add("未建", nomdLayernum); @@ -74,11 +76,9 @@ foreach (string key in dic.Keys) { - if (dic[key] != 0) - { - xlist.Add(key); - ylist.Add(dic[key]); - } + if (dic[key] == 0) continue; + xlist.Add(key); + ylist.Add(dic[key]); } chart1.Series[0].Points.DataBindXY(xlist, ylist); @@ -89,73 +89,15 @@ string sql = "select * from casic_metadataLayer"; DataTable table = OledbHelper.QueryTable(sql); - mdlayernum = table.Rows.Count; + if(table!=null)mdlayernum = table.Rows.Count; return mdlayernum; } //统计有多少个图层 - private int statistLayer() { - int layernum = 0; - - string filename = Utility.filename; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(filename); - XmlNodeList Params1 = doc.SelectNodes("/Params/layers"); - - foreach (XmlNode paramsNode in Params1) //layers - { - foreach (XmlNode layerNode in paramsNode) //layer - { - //MessageBox.Show(layerNode.Attributes["label"].Value); - - if (layerNode.HasChildNodes) - { - foreach (XmlNode layerchildNode in layerNode) //layerchild - { - //MessageBox.Show(layerchildNode.Attributes["label"].Value); - if (layerchildNode.Name == "layerchild") - { - layernum++; - } - else if (layerchildNode.Name == "layertype") - { - if (layerchildNode.HasChildNodes) - { - foreach (XmlNode childNodeLayer in layerchildNode)//layertype下的layerchild - { - //MessageBox.Show(childNodeLayer.Attributes["label"].Value); - if (childNodeLayer.HasChildNodes) - { - - foreach (XmlNode n in childNodeLayer) - { - layernum++; - } - } - else - { - - layernum++; - } - } - } - } - - } - } - } - - } - - - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - return layernum; + private int statistLayer() + { + List datasrcs = Utility.layerConfig.datasrcs; + return datasrcs.SelectMany(datasrc => datasrc.layertypes).Sum(layerType => layerType.layers.Count); } //选择list @@ -174,7 +116,6 @@ + "join casic_metadatalayer on casic_metadatalayer.LAYERID = casic_metadatacontent.LAYERID " + "where casic_metadatalayer.LAYERNAME='" + layername + "'"; DataTable table = OledbHelper.QueryTable(sql); - int num = table.Rows.Count; //MessageBox.Show(num.ToString()); if (table != null && table.Rows.Count > 0) { @@ -192,10 +133,5 @@ ntLblC.Text = ""; } } - - private void buttonX1_Click(object sender, EventArgs e) - { - drawChart(); - } } } diff --git a/TreeUtils.cs b/TreeUtils.cs index 65420f4..9f4f744 100644 --- a/TreeUtils.cs +++ b/TreeUtils.cs @@ -135,6 +135,6 @@ CheckParentNode(curNode.Parent); } - + } } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 0144124..e88befb 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmMetadataStat.cs b/FrmMetadataStat.cs index cb19f84..c3c1359 100644 --- a/FrmMetadataStat.cs +++ b/FrmMetadataStat.cs @@ -2,16 +2,16 @@ using System.Collections; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; -using System.Xml; using DevComponents.DotNetBar; namespace Cyberpipe { public partial class FrmMetadataStat : Office2007Form { - Dictionary dic = new Dictionary(); + public FrmMetadataStat() { InitializeComponent(); @@ -22,7 +22,7 @@ string sql = "select LAYERNAME from casic_metadataLayer where LAYERNAME like '%" + keywordsTxt.Text.Trim() + "%'"; DataTable table = OledbHelper.QueryTable(sql); - int num = table.Rows.Count; + int num = 0; resultList.Clear(); consLblC.Text = ""; @@ -32,6 +32,7 @@ if (table != null && table.Rows.Count > 0) { + num = table.Rows.Count; for (int i = 0; i < num;i++ ) { resultList.Items.Add(table.Rows[i][0].ToString()); @@ -56,7 +57,8 @@ int metadataLayernum = statistMDLayer(); int nomdLayernum = layernum - metadataLayernum; //MessageBox.Show("共有多少层?" + layernum.ToString()+"=="+metadataLayernum.ToString()+"=="+nomdLayernum.ToString()); - dic.Clear(); +// dic.Clear(); + Dictionary dic = new Dictionary(); dic.Add("已建",metadataLayernum); dic.Add("未建", nomdLayernum); @@ -74,11 +76,9 @@ foreach (string key in dic.Keys) { - if (dic[key] != 0) - { - xlist.Add(key); - ylist.Add(dic[key]); - } + if (dic[key] == 0) continue; + xlist.Add(key); + ylist.Add(dic[key]); } chart1.Series[0].Points.DataBindXY(xlist, ylist); @@ -89,73 +89,15 @@ string sql = "select * from casic_metadataLayer"; DataTable table = OledbHelper.QueryTable(sql); - mdlayernum = table.Rows.Count; + if(table!=null)mdlayernum = table.Rows.Count; return mdlayernum; } //统计有多少个图层 - private int statistLayer() { - int layernum = 0; - - string filename = Utility.filename; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(filename); - XmlNodeList Params1 = doc.SelectNodes("/Params/layers"); - - foreach (XmlNode paramsNode in Params1) //layers - { - foreach (XmlNode layerNode in paramsNode) //layer - { - //MessageBox.Show(layerNode.Attributes["label"].Value); - - if (layerNode.HasChildNodes) - { - foreach (XmlNode layerchildNode in layerNode) //layerchild - { - //MessageBox.Show(layerchildNode.Attributes["label"].Value); - if (layerchildNode.Name == "layerchild") - { - layernum++; - } - else if (layerchildNode.Name == "layertype") - { - if (layerchildNode.HasChildNodes) - { - foreach (XmlNode childNodeLayer in layerchildNode)//layertype下的layerchild - { - //MessageBox.Show(childNodeLayer.Attributes["label"].Value); - if (childNodeLayer.HasChildNodes) - { - - foreach (XmlNode n in childNodeLayer) - { - layernum++; - } - } - else - { - - layernum++; - } - } - } - } - - } - } - } - - } - - - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - return layernum; + private int statistLayer() + { + List datasrcs = Utility.layerConfig.datasrcs; + return datasrcs.SelectMany(datasrc => datasrc.layertypes).Sum(layerType => layerType.layers.Count); } //选择list @@ -174,7 +116,6 @@ + "join casic_metadatalayer on casic_metadatalayer.LAYERID = casic_metadatacontent.LAYERID " + "where casic_metadatalayer.LAYERNAME='" + layername + "'"; DataTable table = OledbHelper.QueryTable(sql); - int num = table.Rows.Count; //MessageBox.Show(num.ToString()); if (table != null && table.Rows.Count > 0) { @@ -192,10 +133,5 @@ ntLblC.Text = ""; } } - - private void buttonX1_Click(object sender, EventArgs e) - { - drawChart(); - } } } diff --git a/TreeUtils.cs b/TreeUtils.cs index 65420f4..9f4f744 100644 --- a/TreeUtils.cs +++ b/TreeUtils.cs @@ -135,6 +135,6 @@ CheckParentNode(curNode.Parent); } - + } } diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index 01abc54..d3b5986 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 0144124..e88befb 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmMetadataStat.cs b/FrmMetadataStat.cs index cb19f84..c3c1359 100644 --- a/FrmMetadataStat.cs +++ b/FrmMetadataStat.cs @@ -2,16 +2,16 @@ using System.Collections; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; -using System.Xml; using DevComponents.DotNetBar; namespace Cyberpipe { public partial class FrmMetadataStat : Office2007Form { - Dictionary dic = new Dictionary(); + public FrmMetadataStat() { InitializeComponent(); @@ -22,7 +22,7 @@ string sql = "select LAYERNAME from casic_metadataLayer where LAYERNAME like '%" + keywordsTxt.Text.Trim() + "%'"; DataTable table = OledbHelper.QueryTable(sql); - int num = table.Rows.Count; + int num = 0; resultList.Clear(); consLblC.Text = ""; @@ -32,6 +32,7 @@ if (table != null && table.Rows.Count > 0) { + num = table.Rows.Count; for (int i = 0; i < num;i++ ) { resultList.Items.Add(table.Rows[i][0].ToString()); @@ -56,7 +57,8 @@ int metadataLayernum = statistMDLayer(); int nomdLayernum = layernum - metadataLayernum; //MessageBox.Show("共有多少层?" + layernum.ToString()+"=="+metadataLayernum.ToString()+"=="+nomdLayernum.ToString()); - dic.Clear(); +// dic.Clear(); + Dictionary dic = new Dictionary(); dic.Add("已建",metadataLayernum); dic.Add("未建", nomdLayernum); @@ -74,11 +76,9 @@ foreach (string key in dic.Keys) { - if (dic[key] != 0) - { - xlist.Add(key); - ylist.Add(dic[key]); - } + if (dic[key] == 0) continue; + xlist.Add(key); + ylist.Add(dic[key]); } chart1.Series[0].Points.DataBindXY(xlist, ylist); @@ -89,73 +89,15 @@ string sql = "select * from casic_metadataLayer"; DataTable table = OledbHelper.QueryTable(sql); - mdlayernum = table.Rows.Count; + if(table!=null)mdlayernum = table.Rows.Count; return mdlayernum; } //统计有多少个图层 - private int statistLayer() { - int layernum = 0; - - string filename = Utility.filename; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(filename); - XmlNodeList Params1 = doc.SelectNodes("/Params/layers"); - - foreach (XmlNode paramsNode in Params1) //layers - { - foreach (XmlNode layerNode in paramsNode) //layer - { - //MessageBox.Show(layerNode.Attributes["label"].Value); - - if (layerNode.HasChildNodes) - { - foreach (XmlNode layerchildNode in layerNode) //layerchild - { - //MessageBox.Show(layerchildNode.Attributes["label"].Value); - if (layerchildNode.Name == "layerchild") - { - layernum++; - } - else if (layerchildNode.Name == "layertype") - { - if (layerchildNode.HasChildNodes) - { - foreach (XmlNode childNodeLayer in layerchildNode)//layertype下的layerchild - { - //MessageBox.Show(childNodeLayer.Attributes["label"].Value); - if (childNodeLayer.HasChildNodes) - { - - foreach (XmlNode n in childNodeLayer) - { - layernum++; - } - } - else - { - - layernum++; - } - } - } - } - - } - } - } - - } - - - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - return layernum; + private int statistLayer() + { + List datasrcs = Utility.layerConfig.datasrcs; + return datasrcs.SelectMany(datasrc => datasrc.layertypes).Sum(layerType => layerType.layers.Count); } //选择list @@ -174,7 +116,6 @@ + "join casic_metadatalayer on casic_metadatalayer.LAYERID = casic_metadatacontent.LAYERID " + "where casic_metadatalayer.LAYERNAME='" + layername + "'"; DataTable table = OledbHelper.QueryTable(sql); - int num = table.Rows.Count; //MessageBox.Show(num.ToString()); if (table != null && table.Rows.Count > 0) { @@ -192,10 +133,5 @@ ntLblC.Text = ""; } } - - private void buttonX1_Click(object sender, EventArgs e) - { - drawChart(); - } } } diff --git a/TreeUtils.cs b/TreeUtils.cs index 65420f4..9f4f744 100644 --- a/TreeUtils.cs +++ b/TreeUtils.cs @@ -135,6 +135,6 @@ CheckParentNode(curNode.Parent); } - + } } diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index 01abc54..d3b5986 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb index 6d9c313..d263fae 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ