private void CreateTableScript() { string interfaceName = Program.DeviceMgt.DeviceDirInfor.Header.Name; string fnameInstall = Application.StartupPath + "\\" + RuleScript.InstallTable.FileName; string fnameUninstall = Application.StartupPath + "\\" + RuleScript.UninstallTable.FileName; Program.Log.Write("Creating install table script..."); using (StreamWriter sw = File.CreateText(fnameInstall)) { //US29442 #region //Program.ServiceMgt.Config.GarbageCollection.MaxRecordCountLimitation = 500; #endregion string strSql = RuleControl.GetCreateTableSQL(interfaceName, Program.ServiceMgt.Config.GarbageCollection); sw.Write(strSql); } Program.Log.Write("Create install table script succeeded. " + fnameInstall); Program.Log.Write("Creating uninstall table script..."); using (StreamWriter sw = File.CreateText(fnameUninstall)) { string strSql = RuleControl.GetDropTableSQL(interfaceName); sw.Write(strSql); } Program.Log.Write("Create uninstall table script succeeded. " + fnameUninstall); }
private void CreateTableScript() { string dbName = this.textBoxRISDBName.Text.Trim(); string interfaceName = this.textBoxTP.Text.Trim(); string fnameInstall = Application.StartupPath + "\\" + RuleScript.InstallTable.FileName; string fnameUninstall = Application.StartupPath + "\\" + RuleScript.UninstallTable.FileName; GarbageRule gcRule = null; string serviceCfgFile = Application.StartupPath + "\\" + ConfigHelper.ServiceDefaultFileName; AdapterServiceCfgMgt mgt = new AdapterServiceCfgMgt(serviceCfgFile); if (mgt.Load()) { gcRule = mgt.Config.GarbageCollection; //US29442 #region //gcRule.MaxRecordCountLimitation = 500; #endregion } else { MessageBox.Show(this, "Cannot open file : " + serviceCfgFile + "\r\n" + mgt.LastErrorInfor, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } using (StreamWriter sw = File.CreateText(fnameInstall)) { string strSql = RuleControl.GetCreateTableSQL(interfaceName, gcRule); strSql = strSql.Replace("USE GWDataDB", "USE " + dbName); sw.Write(strSql); } using (StreamWriter sw = File.CreateText(fnameUninstall)) { string strSql = RuleControl.GetDropTableSQL(interfaceName); strSql = strSql.Replace("USE GWDataDB", "USE " + dbName); sw.Write(strSql); } }