Exemplo n.º 1
0
        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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        //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));
        }