示例#1
0
        public static bool OpenDBConnection()
        {
            if (myConn != null)
            {
                return(true);
            }

            if (myConn == null)
            {
                string cs = string.Format("server={0};userid={1};password={2};database=pck",
                                          settings.DBServer,
                                          settings.DBUser,
                                          CryptoSystem.Decrypt(settings.DBPassword));
                try
                {
                    myConn = new MySqlConnection(cs);
                    myConn.Open();

                    //MySqlCommand cmd = myConn.CreateCommand();
                    //cmd.CommandText = "SET autocommit = 0";
                    //cmd.ExecuteNonQuery();
                }
                catch (MySqlException ex)
                {
                    MessageLogger.Add("Error opening DB connection " + ex.ToString(), MessageLogger.MsgLevel.error);
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
 private void UpdateComponents(SAPSettings s)
 {
     txtSAPHost.Text     = s.hostname;
     txtSAPUser.Text     = s.user;
     txtSAPPassword.Text = CryptoSystem.Decrypt(s.password);
     txtSAPClient.Text   = s.client;
     txtDevice.Text      = s.device;
 }
示例#3
0
        public bool SaveSettings()
        {
            var settings = new DBSettings();

            settings.DBServer   = txtDBHost.Text;
            settings.DBUser     = txtDBUser.Text;
            settings.DBPassword = CryptoSystem.Encrypt(txtDBPassword.Text);

            return(XMLConfigHandler.SaveConfig(settings));
        }
示例#4
0
        public bool SaveSettings()
        {
            var s = new SAPSettings();

            s.hostname = txtSAPHost.Text;
            s.user     = txtSAPUser.Text;
            s.password = CryptoSystem.Encrypt(txtSAPPassword.Text);
            s.client   = txtSAPClient.Text;
            s.device   = txtDevice.Text;

            return(XMLConfigHandler.SaveConfig(s));
        }
示例#5
0
        public DBSettingsCntrl()
        {
            InitializeComponent();

            DBSettings s = (DBSettings)XMLConfigHandler.ReadConfig(typeof(DBSettings));

            if (s != null)
            {
                txtDBHost.Text     = s.DBServer;
                txtDBUser.Text     = s.DBUser;
                txtDBPassword.Text = CryptoSystem.Decrypt(s.DBPassword);
            }
        }