using Lskj.Business.Impl; using Lskj.Control; using Lskj.Core; using Lskj.Util; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; using System.Xml.Linq; namespace Lskj.CpeMethod { public partial class Form1 : BaseForm { public static string Connection1 = "QkYyNjE3QTcxQjc4RDFFMDlERjlFMDc1QkIyMDVGRjdDRUIyMEVEOUM5NjBCQjc5NTA5NzdEQTk0MkNEQTE1RTFGMEIwMThFNUJDQTE0RjE1NjQwM0U5QTYxMThCMDY2MTA4NkE2OTIxNTNBQjQ0MjRDMDIwM0Q5OEVDQjkwQTVCN0RENjJBODkxNUNGOUM5OEI5RTEzN0E3ODBERjg2OURCNEQ5QTlCMzhCQUZGQ0FBNUREMjY4M0FCODg2RTkxMDRERTQ3MjRGQTE1MERDOTJGRDFDRjY2REQ1ODYyREUzN0RGM0ZBQzc4NzJENjIwNDg4RUUyNkI3ODE1RjlDM0I0MjNCQzcyOENDN0VDMTg0QUU0MjgwMDVDMENBOUZF"; /// /// 远程数据库名 /// public static string DataBase = "lserp"; /// /// 远程服务器名 /// private static string serverName = "114.116.135.188,16678"; public Form1() { InitializeComponent(); } /// /// 一键遍历程序所有方法执行翻译 /// /// /// private void OnCycleClick(object sender, EventArgs e) { //创建数据库连接 DBConfig.Instance.ServerName = "114.116.135.188,16678"; DBConfig.Instance.DataBase = "lserp"; DBConfig.Instance.CreateConnection(); //让数据库可以跨数据库查询,添加 BaseImpl.ExecSqlValue("exec sp_configure 'show advanced options',1 reconfigure exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure"); string connStr = Lskj.Business.Impl.ErrorMessage.GetConnection(); string theDatabase = "p_CpeMethod"; string sqlStr = string.Empty; try { //BaseImpl.GetResult(string.Format("SELECT * FROM OPENDATASOURCE('SQLOLEDB','{0}').lserp.dbo.p_CpeMethod", connStr)); theDatabase = string.Format("OPENDATASOURCE( 'SQLOLEDB ', '{0}').lserp.dbo.p_CpeMethod", connStr); } catch { } DirectoryInfo folder = new DirectoryInfo(PubUtil.AbsolutelyPath); foreach (FileInfo file in folder.GetFiles("*.xml")) { XElement File = XElement.Load(file.FullName + ""); foreach (XElement Xel in File.Descendants("member")) { XElement summary = Xel.Element("summary"); if (summary != null) { XElement MethodExplain = summary.Element("para"); if (MethodExplain != null) { string MethodExplainStr = MethodExplain.Value.ToString().Substring(3); string MethodName = Xel.FirstAttribute.Value.ToString().Substring(2); sqlStr += string.Format("insert into {2} (p_ErrMethod,p_interpretText) VALUES ('{0}', '{1}') ;\r\n", MethodName, MethodExplainStr, "p_CpeMethod"); } } } } try { SqlHelper.ExecuteNonQuery(sqlStr); } catch (Exception) { } } } }