private void DataConnectList_Load(object sender, EventArgs e) { oper = new XmlHelper(string.Format("{0}{1}", Application.StartupPath, dataSetConfigPath), XmlType.Path); RefreshList(); XmlNodeList list = oper.QueryNodes("/Base/DataConnections/Connection"); cbbDataBase.Items.Clear(); foreach (XmlNode node in list) { XmlElement ele = (XmlElement)node; cbbDataBase.Items.Add(ele.GetAttribute("Name")); } DirectoryInfo di = new DirectoryInfo(string.Format("{0}{1}{2}", Application.StartupPath, configDataPath, this.configItemName)); if (!di.Exists) di.Create(); if (this.DataTree.Nodes.Count > 0) SelectSingleItem(this.DataTree.Nodes[0].Text); }
/// <summary> /// 初始化导出方案 /// </summary> /// <param name="selectedName">被选中的节点</param> public void LoadOutputScheme(string selectedName) { OutputList.Items.Clear(); OutputSchemeList = new List<OutputScheme>(); docoper = new XmlHelper(string.Format("{0}{1}", Application.StartupPath, dataSetConfigPath), XmlType.Path); XmlNodeList list = docoper.QueryNodes("/Base/Output/Item"); var selectedindex = 0; foreach (XmlNode node in list) { XmlElement ele = (XmlElement)node; OutputList.Items.Add(ele.GetAttribute("Name")); if (ele.GetAttribute("Name") == selectedName) selectedindex = OutputList.Items.Count - 1; OutputSchemeList.Add(new OutputScheme() { Name = ele.GetAttribute("Name"), Table = ele.GetAttribute("Table"), DataBase = ele.GetAttribute("DataBase"), Select = FileStreamHelper.ReadText(string.Format("{0}{1}{2}\\Select", Application.StartupPath, outputDataPath, ele.GetAttribute("Name"))), Delete = FileStreamHelper.ReadText(string.Format("{0}{1}{2}\\Delete", Application.StartupPath, outputDataPath, ele.GetAttribute("Name"))), }); } if (OutputList.Items.Count > 0) { XmlElement ele = (XmlElement)list[selectedindex]; this.tbxOutputName.Text = ele.GetAttribute("Name"); this.tbxOutputTableName.Text = ele.GetAttribute("Table"); this.cbbOutputDataSet.Text = ele.GetAttribute("DataBase"); this.OutputList.SetSelected(selectedindex, true); } }
/// <summary> /// 初始化配置方案 /// </summary> public void LoadConfigScheme() { ConfigTree.Nodes.Clear(); docoper = new XmlHelper(string.Format("{0}{1}", Application.StartupPath, dataSetConfigPath), XmlType.Path); XmlNodeList list = docoper.QueryNodes("/Base/ConfigAddress/Config"); foreach (XmlNode node in list) { XmlElement ele = (XmlElement)node; TreeNode confignode = new TreeNode(ele.GetAttribute("Name")); ConfigTree.Nodes.Add(confignode); } if (ConfigTree.Nodes.Count > 0) { this.tbxConfigName.Text = ConfigTree.Nodes[0].Text; this.ConfigTree.SelectedNode = ConfigTree.Nodes[0]; } }
/// <summary> /// 初始化IP方案 /// </summary> public void LoadIPScheme() { IPTree.Nodes.Clear(); IPSchemeList = new List<IPScheme>(); docoper = new XmlHelper(string.Format("{0}{1}", Application.StartupPath, dataSetConfigPath), XmlType.Path); XmlNodeList list = docoper.QueryNodes("/Base/IPAddress/IP"); foreach (XmlNode node in list) { XmlElement ele = (XmlElement)node; List<ReplaceScheme> strList = new List<ReplaceScheme>(); foreach (XmlNode replacenode in ele.ChildNodes) { XmlElement replaceele = (XmlElement)replacenode; string oldstr = string.Empty; string newstr = string.Empty; foreach (XmlNode strnode in replaceele.ChildNodes) { if (strnode.Name == "OldStr") oldstr = strnode.InnerText; if (strnode.Name == "NewStr") newstr = strnode.InnerText; } strList.Add(new ReplaceScheme() { Name = replaceele.GetAttribute("Name"), FilePath = replaceele.GetAttribute("Path"), OldStr = oldstr, NewStr = newstr, }); } IPSchemeList.Add(new IPScheme() { Name = ele.GetAttribute("Name"), IPAddress = ele.GetAttribute("IPAddress"), SubNetMask = ele.GetAttribute("SubnetMask"), DefaultIPGateway = ele.GetAttribute("DefaultIPGateway"), DNSServerSearchOrder = ele.GetAttribute("DNSServerSearchOrder"), DNSServerSpare = ele.GetAttribute("DNSServerSpare"), ReplaceSchemes = strList, }); TreeNode IPnode = new TreeNode(ele.GetAttribute("Name")); IPTree.Nodes.Add(IPnode); } if (IPSchemeList.Count() > 0) SelectSingleIP(IPSchemeList[0].Name); }
/// <summary> /// 刷新数据源 /// </summary> public void RefreshDataSources() { docoper = new XmlHelper(string.Format("{0}{1}", Application.StartupPath, dataSetConfigPath), XmlType.Path); XmlNodeList list = docoper.QueryNodes("/Base/DataConnections/Connection"); SourceListFrom.Items.Clear(); SourceListTo.Items.Clear(); OperatorSourcesList.Items.Clear(); cbbOutputDataSet.Items.Clear(); dataSourceList.Clear(); foreach (XmlNode node in list) { XmlElement ele = (XmlElement)node; SourceListFrom.Items.Add(ele.GetAttribute("Name")); SourceListTo.Items.Add(ele.GetAttribute("Name")); OperatorSourcesList.Items.Add(ele.GetAttribute("Name")); cbbOutputDataSet.Items.Add(ele.GetAttribute("Name")); dataSourceList.Add(ele.GetAttribute("Name"), ele.InnerText); } }
private void DataConnectList_Load(object sender, EventArgs e) { oper = new XmlHelper(string.Format("{0}{1}", Application.StartupPath, dataSetConfigPath), XmlType.Path); RefreshList(); }