public void Save() { if (!string.IsNullOrEmpty(FileName)) { Apq.DBC.XSD xsd = new Apq.DBC.XSD(); xsd.DBC.Merge(xsdDBC.DBC); xsd.DBC.Columns.Remove("ComputerID"); xsd.DBC.Columns.Remove("PwdC"); foreach (Apq.DBC.XSD.DBCRow drDBC in xsd.DBC.Rows) { DBS_XSD.DBIRow drDBI = GlobalObject.Lookup.DBI.FindByDBIID(Apq.Convert.ChangeType <int>(drDBC.DBIID)); if (drDBI != null) { drDBC.DBProduct = drDBI.DBProduct; drDBC.IP = drDBI.IP; drDBC.Port = drDBI.Port; } } StringWriter sw = new StringWriter(); xsd.WriteXml(sw, XmlWriteMode.IgnoreSchema); Common.SaveCSFile(FileName, sw.ToString()); tsslOutInfo.Text = Apq.GlobalObject.UILang["保存文件成功"]; } }
private void tsbCreateFile_Click(object sender, EventArgs e) { treeListView1.EndUpdate(); sfd.InitialDirectory = GlobalObject.XmlConfigChain[this.GetType(), "sfd_InitialDirectory"]; if (sfd.ShowDialog(this) == DialogResult.OK) { GlobalObject.XmlConfigChain[this.GetType(), "sfd_InitialDirectory"] = System.IO.Path.GetDirectoryName(sfd.FileName); Apq.DBC.XSD xsd = new Apq.DBC.XSD(); xsd.DBI.Merge(GlobalObject.Lookup.DBI, false, MissingSchemaAction.Ignore); xsd.DBI.Columns.Remove("PwdC"); StringWriter sw = new StringWriter(); xsd.WriteXml(sw, XmlWriteMode.IgnoreSchema); Common.SaveCSFile(sfd.FileName, sw.ToString()); tsslOutInfo.Text = Apq.GlobalObject.UILang["保存文件成功"]; } }
public void Open() { ofd.InitialDirectory = GlobalObject.XmlConfigChain[this.GetType(), "ofd_InitialDirectory"]; if (ofd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { GlobalObject.XmlConfigChain[this.GetType(), "ofd_InitialDirectory"] = System.IO.Path.GetDirectoryName(ofd.FileName); FileName = ofd.FileName; Apq.DBC.XSD xsd = new Apq.DBC.XSD(); string strCs = File.ReadAllText(ofd.FileName, Encoding.UTF8); string str = Apq.Security.Cryptography.DESHelper.DecryptString(strCs, GlobalObject.XmlConfigChain["Crypt", "DESKey"], GlobalObject.XmlConfigChain["Crypt", "DESIV"]); StringReader sr = new StringReader(str); xsd.ReadXml(sr); xsdDBC.DBC.Merge(xsd.DBC); tsslOutInfo.Text = Apq.GlobalObject.UILang["打开文件成功"]; } }
// 生成数据库连接文件 void tsmiCreatCSFile_Click(object sender, EventArgs e) { dataGridView1.EndEdit(); ToolStripMenuItem tsb = sender as ToolStripMenuItem; sfd.InitialDirectory = GlobalObject.XmlConfigChain[this.GetType(), "sfd_InitialDirectory"]; if (tsb != null && sfd.ShowDialog(this) == DialogResult.OK) { GlobalObject.XmlConfigChain[this.GetType(), "sfd_InitialDirectory"] = System.IO.Path.GetDirectoryName(sfd.FileName); int nDBCUseType = Apq.Convert.ChangeType <int>(tsb.Tag); Apq.DBC.XSD xsd = new Apq.DBC.XSD(); xsd.DBC.Merge(xsdDBC.DBC); xsd.DBC.Columns.Remove("ComputerID"); xsd.DBC.Columns.Remove("PwdC"); for (int i = xsd.DBC.Rows.Count - 1; i >= 0; i--) { if (Apq.Convert.ChangeType <int>(xsd.DBC.Rows[i]["DBCUseType"]) != nDBCUseType) { xsd.DBC.Rows.RemoveAt(i); continue; } DBS_XSD.DBIRow drDBI = GlobalObject.Lookup.DBI.FindByDBIID(Apq.Convert.ChangeType <int>(xsd.DBC.Rows[i]["DBIID"])); if (drDBI != null) { xsd.DBC.Rows[i]["DBProduct"] = drDBI.DBProduct; xsd.DBC.Rows[i]["IP"] = drDBI.IP; xsd.DBC.Rows[i]["Port"] = drDBI.Port; } } StringWriter sw = new StringWriter(); xsd.WriteXml(sw, XmlWriteMode.IgnoreSchema); Common.SaveCSFile(sfd.FileName, sw.ToString()); tsslOutInfo.Text = Apq.GlobalObject.UILang["保存文件成功"]; } }
// 生成数据库连接文件 void tsmiCreatCSFile_Click(object sender, EventArgs e) { dataGridView1.EndEdit(); ToolStripMenuItem tsb = sender as ToolStripMenuItem; sfd.InitialDirectory = GlobalObject.XmlConfigChain[this.GetType(), "sfd_InitialDirectory"]; if (tsb != null && sfd.ShowDialog(this) == DialogResult.OK) { GlobalObject.XmlConfigChain[this.GetType(), "sfd_InitialDirectory"] = System.IO.Path.GetDirectoryName(sfd.FileName); int nDBCUseType = Apq.Convert.ChangeType<int>(tsb.Tag); Apq.DBC.XSD xsd = new Apq.DBC.XSD(); xsd.DBC.Merge(xsdDBC.DBC); xsd.DBC.Columns.Remove("ComputerID"); xsd.DBC.Columns.Remove("PwdC"); for (int i = xsd.DBC.Rows.Count - 1; i >= 0; i--) { if (Apq.Convert.ChangeType<int>(xsd.DBC.Rows[i]["DBCUseType"]) != nDBCUseType) { xsd.DBC.Rows.RemoveAt(i); continue; } DBS_XSD.DBIRow drDBI = GlobalObject.Lookup.DBI.FindByDBIID(Apq.Convert.ChangeType<int>(xsd.DBC.Rows[i]["DBIID"])); if (drDBI != null) { xsd.DBC.Rows[i]["DBProduct"] = drDBI.DBProduct; xsd.DBC.Rows[i]["IP"] = drDBI.IP; xsd.DBC.Rows[i]["Port"] = drDBI.Port; } } StringWriter sw = new StringWriter(); xsd.WriteXml(sw, XmlWriteMode.IgnoreSchema); Common.SaveCSFile(sfd.FileName, sw.ToString()); tsslOutInfo.Text = Apq.GlobalObject.UILang["保存文件成功"]; } }
public void Save() { if (!string.IsNullOrEmpty(FileName)) { Apq.DBC.XSD xsd = new Apq.DBC.XSD(); xsd.DBC.Merge(xsdDBC.DBC); xsd.DBC.Columns.Remove("ComputerID"); xsd.DBC.Columns.Remove("PwdC"); foreach (Apq.DBC.XSD.DBCRow drDBC in xsd.DBC.Rows) { DBS_XSD.DBIRow drDBI = GlobalObject.Lookup.DBI.FindByDBIID(Apq.Convert.ChangeType<int>(drDBC.DBIID)); if (drDBI != null) { drDBC.DBProduct = drDBI.DBProduct; drDBC.IP = drDBI.IP; drDBC.Port = drDBI.Port; } } StringWriter sw = new StringWriter(); xsd.WriteXml(sw, XmlWriteMode.IgnoreSchema); Common.SaveCSFile(FileName, sw.ToString()); tsslOutInfo.Text = Apq.GlobalObject.UILang["保存文件成功"]; } }
public void Open() { ofd.InitialDirectory = GlobalObject.XmlConfigChain[this.GetType(), "ofd_InitialDirectory"]; if (ofd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { GlobalObject.XmlConfigChain[this.GetType(), "ofd_InitialDirectory"] = System.IO.Path.GetDirectoryName(ofd.FileName); FileName = ofd.FileName; Apq.DBC.XSD xsd = new Apq.DBC.XSD(); string strCs = File.ReadAllText(ofd.FileName, Encoding.UTF8); string str = Apq.Security.Cryptography.DESHelper.DecryptString(strCs, GlobalObject.XmlConfigChain["Crypt", "DESKey"], GlobalObject.XmlConfigChain["Crypt", "DESIV"]); StringReader sr = new StringReader(str); xsd.ReadXml(sr); xsdDBC.DBC.Merge(xsd.DBC); tsslOutInfo.Text = Apq.GlobalObject.UILang["打开文件成功"]; } }
private void tsbCreateFile_Click(object sender, EventArgs e) { treeListView1.EndUpdate(); sfd.InitialDirectory = GlobalObject.XmlConfigChain[this.GetType(), "sfd_InitialDirectory"]; if (sfd.ShowDialog(this) == DialogResult.OK) { GlobalObject.XmlConfigChain[this.GetType(), "sfd_InitialDirectory"] = System.IO.Path.GetDirectoryName(sfd.FileName); Apq.DBC.XSD xsd = new Apq.DBC.XSD(); xsd.DBI.Merge(GlobalObject.Lookup.DBI, false, MissingSchemaAction.Ignore); xsd.DBI.Columns.Remove("PwdC"); StringWriter sw = new StringWriter(); xsd.WriteXml(sw, XmlWriteMode.IgnoreSchema); Common.SaveCSFile(sfd.FileName, sw.ToString()); tsslOutInfo.Text = Apq.GlobalObject.UILang["保存文件成功"]; } }