private void Save() { #region Interact Information if (radioBtnActive.Checked == true) { DBconfig.InteractType = InteractType.Active; activeControl.Save(); } else { DBconfig.InteractType = InteractType.Passtive; //passiveControl.Save(); } #endregion //Save to file if (!SQLOutAdapterConfigMgt.Save(SQLOutAdapterConfigMgt._FileName)) { if (SQLOutAdapterConfigMgt.LastException != null) { MessageBox.Show(SQLOutAdapterConfigMgt.LastException.Message); } } //this.Close(); }
internal static void PreLoading() { //Load DeviceDir DeviceMgt = new DeviceDirManager(); DeviceMgt.FileName = Application.StartupPath + "\\" + DeviceDirManager.IndexFileName; if (!DeviceMgt.LoadDeviceDir()) { MessageBox.Show("Cannot load DeviceDir file."); } //Load XML file string FileName = Application.StartupPath + "\\" + SQLOutAdapterConfigMgt._FileName; if (!SQLOutAdapterConfigMgt.Load(FileName)) { if (SQLOutAdapterConfigMgt.LastException != null) { if (MessageBox.Show("Cannot load configuration file. Do you want to create an empty configuration file?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { SQLOutAdapterConfigMgt.Save(SQLOutAdapterConfigMgt._FileName); } } } }
internal void LoadConfig() { string FileName = Application.StartupPath + "\\" + SQLOutAdapterConfigMgt._FileName; if (!SQLOutAdapterConfigMgt.Load(FileName)) { MessageBox.Show("Load configuration failed. \r\n" + FileName + "\r\n", "SQLOutboundAdapter"); } this.checkBoxTimerEnable.Checked = SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.TimerEnable; this.numericUpDownInterval.Value = SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.TimerInterval; this.textBoxIName.Text = Properties.Settings.Default.InterfaceName; this.textBoxRISDBName.Text = Properties.Settings.Default.RISDBName; this.textBoxTP.Text = Properties.Settings.Default.RISTablePrefix; this.textBoxInstance.Text = Properties.Settings.Default.RISDBInstanceName; this.textBoxRISOrderSPMultiSiteSuffix.Text = Properties.Settings.Default.RISOrderSPMultiSiteSuffix; this.textBoxRISUser.Text = Properties.Settings.Default.RISDBUser; this.textBoxRISPwd.Text = Properties.Settings.Default.RISDBPassword; this.checkBoxWindowsAnthen.Checked = Properties.Settings.Default.RISDBWindowsAuthentication; this.checkBoxAutoInstall.Checked = Properties.Settings.Default.AutoInstall; this.textBoxBrokerDBName.Text = Properties.Settings.Default.BrokerDBName; this.textBoxBrokerDBPwd.Text = Properties.Settings.Default.BrokerDBPassword; this.textBoxBrokerDBUser.Text = Properties.Settings.Default.BrokerDBUser; this.textBoxBrokerServer.Text = Properties.Settings.Default.BrokerInstanceName; this.checkBoxBrokerWindowsAnthen.Checked = Properties.Settings.Default.BrokerDBWindowsAuthentication; this.textBoxDBCnn.Text = SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.ConnectionStr; }
public static AdapterDataBase db;// = new AdapterDataBase("");//TODO:ADD CONNECTION STRING public static void Preloading() { string FileName = Application.StartupPath + "\\" + SQLOutAdapterConfigMgt._FileName; //TestCase.BuildTestConfigFile(); //DEBUG Log.WriteAppStart(Application.StartupPath + "\\SQLOutboundAdapter.log"); db = new AdapterDataBase(""); if (!SQLOutAdapterConfigMgt.Load(FileName)) { Log.Write(LogType.Error, "Load configuration failed. \r\n" + FileName + "\r\n");//+ SQLOutAdapterConfigMgt.LastError); } else { //db.ConnectionString = SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.ConnectionStr; if (SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.FileConnection) { db.ConnectionString = SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.FileConnectionString; } else { db.ConnectionString = SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.ConnectionStr; } } }
private void btDefault_Click(object sender, EventArgs e) { if (channelSet.Count > 0) { if (MessageBox.Show("If you do this operation, all the existed storage procedure will delete.\nAre you sure to go on?", "Load Default Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes) { return; } } SQLOutAdapterConfigMgt.LoadDefaultPassiveChannels(channelSet, "sp_" + Program.DeviceMgt.DeviceDirInfor.Header.Name + "_", Program.DeviceMgt.DeviceDirInfor.Header.Name); ShowSPList(); }
internal void SaveConfig() { LoadDefaultSetting(); SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.TimerEnable = this.checkBoxTimerEnable.Checked; SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.TimerInterval = (int)this.numericUpDownInterval.Value; SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.ConnectionStr = this.textBoxDBCnn.Text.Trim(); string FileName = Application.StartupPath + "\\" + SQLOutAdapterConfigMgt._FileName; if (!SQLOutAdapterConfigMgt.Save(FileName)) { MessageBox.Show("Save configuration failed. \r\n" + FileName + "\r\n", "SQLOutboundAdapter"); } Properties.Settings.Default.RISDBPassword = this.textBoxRISPwd.Text; Properties.Settings.Default.RISDBUser = this.textBoxRISUser.Text.Trim(); Properties.Settings.Default.RISDBWindowsAuthentication = this.checkBoxWindowsAnthen.Checked; Properties.Settings.Default.RISDBInstanceName = this.textBoxInstance.Text.Trim(); Properties.Settings.Default.InterfaceName = this.textBoxIName.Text.Trim(); Properties.Settings.Default.RISDBName = this.textBoxRISDBName.Text.Trim(); Properties.Settings.Default.RISTablePrefix = this.textBoxTP.Text.Trim(); Properties.Settings.Default.RISOrderSPMultiSiteSuffix = this.textBoxRISOrderSPMultiSiteSuffix.Text.Trim(); Properties.Settings.Default.AutoInstall = this.checkBoxAutoInstall.Checked; Properties.Settings.Default.BrokerDBName = this.textBoxBrokerDBName.Text.Trim(); Properties.Settings.Default.BrokerDBPassword = this.textBoxBrokerDBPwd.Text; Properties.Settings.Default.BrokerDBUser = this.textBoxBrokerDBUser.Text.Trim(); Properties.Settings.Default.BrokerInstanceName = this.textBoxBrokerServer.Text.Trim(); Properties.Settings.Default.BrokerDBWindowsAuthentication = this.checkBoxBrokerWindowsAnthen.Checked; Properties.Settings.Default.Save(); CreateTableScript(); CreateSPScript(); UpdateDeviceDir(); }
//Build a test configuration file static public bool BuildTestConfigFile() { #region 3rd database connection SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.Database = "GWDataDB"; SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.Server = "CNSHW9RSZM1X"; SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.User = "******"; SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.Password = "******"; SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.TimerEnable = true; SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.TimerInterval = 1000; SQLOutAdapterConfigMgt.SQLOutAdapterConfig.ThirdPartyInteractConfig.ConnectionParameter.ConnectionStr = "Provider=SQLNCLI.1;Data Source=CNSHW9RSZM1X;Password=123456;User ID=sa;Initial Catalog=GWDataDB"; #endregion #region channel Patient_test_sp SQLOutboundChanel ch = new SQLOutboundChanel(); ch.Enable = true; ch.ChannelName = "Patient_test_SP"; ch.OperationType = ThrPartyDBOperationType.StorageProcedure; ch.OperationName = "dbo.p_Patient_test"; ch.Rule.AutoUpdateProcessFlag = false; ch.Rule.CheckProcessFlag = true; ch.Rule.RuleName = "sp_testpatient"; // column Patient_test.patientid SQLOutQueryResultItem map = new SQLOutQueryResultItem(); map.SourceField = "patientid"; map.TargetField = "patientid"; map.RedundancyFlag = true; map.ThirdPartyDBPatamter.FieldID = 0; map.ThirdPartyDBPatamter.FieldName = "PatientID"; map.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.Integer; ch.Rule.QueryResult.MappingList.Add(map); // column Patient_test.patient_name map = new SQLOutQueryResultItem(); map.SourceField = "Patient_name"; map.TargetField = "Patient_name"; map.RedundancyFlag = false; map.ThirdPartyDBPatamter.FieldID = 1; map.ThirdPartyDBPatamter.FieldName = "Patient_name"; map.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(map); // column Patient_test.address map = new SQLOutQueryResultItem(); map.SourceField = "Address"; map.TargetField = "Address"; map.RedundancyFlag = false; map.ThirdPartyDBPatamter.FieldID = 2; map.ThirdPartyDBPatamter.FieldName = "Address"; map.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(map); // column patient_test.birthdate map = new SQLOutQueryResultItem(); map.SourceField = "BirthDate"; map.TargetField = "BirthDate"; map.RedundancyFlag = false; map.ThirdPartyDBPatamter.FieldID = 3; map.ThirdPartyDBPatamter.FieldName = "BirthDate"; map.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.Date; ch.Rule.QueryResult.MappingList.Add(map); SQLOutAdapterConfigMgt.SQLOutAdapterConfig.OutboundChanels.Add(ch); #endregion #region channel Patient_test_table ch = new SQLOutboundChanel(); ch.ChannelName = "Patient_test_table"; ch.Enable = false; ch.OperationType = ThrPartyDBOperationType.Table; ch.OperationName = "dbo.p_Patient_test"; ch.Rule.AutoUpdateProcessFlag = false; ch.Rule.CheckProcessFlag = true; ch.Rule.RuleName = "sp_testpatient"; // column Patient_test.patientid map = new SQLOutQueryResultItem(); map.SourceField = "patientid"; map.TargetField = "patientid"; map.RedundancyFlag = true; map.ThirdPartyDBPatamter.FieldID = 0; map.ThirdPartyDBPatamter.FieldName = "PatientID"; map.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.Integer; ch.Rule.QueryResult.MappingList.Add(map); // column Patient_test.patient_name map = new SQLOutQueryResultItem(); map.SourceField = "Patient_name"; map.TargetField = "Patient_name"; map.RedundancyFlag = false; map.ThirdPartyDBPatamter.FieldID = 1; map.ThirdPartyDBPatamter.FieldName = "Patient_name"; map.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(map); // column Patient_test.address map = new SQLOutQueryResultItem(); map.SourceField = "Address"; map.TargetField = "Address"; map.RedundancyFlag = false; map.ThirdPartyDBPatamter.FieldID = 2; map.ThirdPartyDBPatamter.FieldName = "Address"; map.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.VarChar; ch.Rule.QueryResult.MappingList.Add(map); // column patient_test.birthdate map = new SQLOutQueryResultItem(); map.SourceField = "BirthDate"; map.TargetField = "BirthDate"; map.RedundancyFlag = false; map.ThirdPartyDBPatamter.FieldID = 3; map.ThirdPartyDBPatamter.FieldName = "BirthDate"; map.ThirdPartyDBPatamter.FieldType = System.Data.OleDb.OleDbType.Date; ch.Rule.QueryResult.MappingList.Add(map); SQLOutAdapterConfigMgt.SQLOutAdapterConfig.OutboundChanels.Add(ch); #endregion //save return(SQLOutAdapterConfigMgt.Save(SQLOutAdapterConfigMgt._FileName)); }