public void CreatPassiveSPScript(XCollection <SQLOutboundChanel> channelSet) { string interfaceName = Program.DeviceMgt.DeviceDirInfor.Header.Name; string fnameInstall = Application.StartupPath + "\\" + RuleScript.InstallSP.FileName; string fnameUninstall = Application.StartupPath + "\\" + RuleScript.UninstallSP.FileName; //Install //using (StreamWriter sw = File.CreateText(fnameInstall)) // 20110706 OSQL & SQLMgmtStudio only support ASCII and UNICODE { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (SQLOutboundChanel channel in channelSet) { sb.AppendLine(channel.SPStatement); } //sw.Write(sb.ToString()); File.WriteAllText(fnameInstall, sb.ToString(), Encoding.Unicode); } //UnInstall using (StreamWriter sw = File.CreateText(fnameUninstall)) { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (SQLOutboundChanel channel in channelSet) { string strSql = RuleControl.GetOutboundSPUninstall(interfaceName, channel.Rule); sb.AppendLine(strSql); } sw.Write(sb.ToString()); } }
private void CreateInboundSPScript(IInboundRule[] ruleList) { string interfaceName = Program.DeviceMgt.DeviceDirInfor.Header.Name; string fnameInstall = Application.StartupPath + "\\" + RuleScript.InstallSP.FileName; string fnameUninstall = Application.StartupPath + "\\" + RuleScript.UninstallSP.FileName; Program.Log.Write("Creating install storage procedure script..."); //using (StreamWriter sw = File.CreateText(fnameInstall)) // 20110706 OSQL & SQLMgmtStudio only support ASCII and UNICODE { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (IInboundRule rule in ruleList) { string strSql = RuleControl.GetInboundSP(interfaceName, rule); sb.AppendLine(strSql); IRuleSupplier supplier = rule as IRuleSupplier; if (supplier != null) { string strSqlSupplied = supplier.GetInstallDBScript(); if (strSqlSupplied != null) { sb.AppendLine(strSqlSupplied); } } } //sw.Write(sb.ToString()); File.WriteAllText(fnameInstall, sb.ToString(), Encoding.Unicode); } Program.Log.Write("Create install storage procedure script succeeded. " + fnameInstall); Program.Log.Write("Creating uninstall storage procedure script..."); using (StreamWriter sw = File.CreateText(fnameUninstall)) { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (IInboundRule rule in ruleList) { string strSql = RuleControl.GetInboundSPUninstall(interfaceName, rule); sb.AppendLine(strSql); IRuleSupplier supplier = rule as IRuleSupplier; if (supplier != null) { string strSqlSupplied = supplier.GetUninstallDBScript(); if (strSqlSupplied != null) { sb.AppendLine(strSqlSupplied); } } } sw.Write(sb.ToString()); } Program.Log.Write("Create uninstall storage procedure script succeeded. " + fnameUninstall); }
private void CreateLookupTableScript(LookupTable[] tableList) { if (tableList == null) { Program.Log.Write(LogType.Warning, "LookupTable array is NULL, do not create any private look up table."); return; } string installTable = Application.StartupPath + "\\" + RuleScript.InstallLUT.FileName; string uninstallTable = Application.StartupPath + "\\" + RuleScript.UninstallLUT.FileName; Program.Log.Write("Creating install private look up table script..."); //using (StreamWriter sw = File.CreateText(installTable)) // 20110706 OSQL & SQLMgmtStudio only support ASCII and UNICODE { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (LookupTable table in tableList) { string strSql = RuleControl.GetCreateLUTSQL(table); sb.AppendLine(strSql); } //sw.Write(sb.ToString()); File.WriteAllText(installTable, sb.ToString(), Encoding.Unicode); } Program.Log.Write("Create install private look up table script succeeded. " + installTable); Program.Log.Write("Creating uninstall private look up table script..."); using (StreamWriter sw = File.CreateText(uninstallTable)) { StringBuilder sb = new StringBuilder(); sb.AppendLine(GWDataDB.GetUseDataBaseSql()); foreach (LookupTable table in tableList) { string strSql = RuleControl.GetDropLUTSQL(table); sb.AppendLine(strSql); } sw.Write(sb.ToString()); } Program.Log.Write("Create uninstall private look up table script succeeded. " + uninstallTable); }