Esempio n. 1
0
 private void cmbEdition_SelectedIndexChanged(object sender, EventArgs e)
 {
     cmbBranch.Enabled = true;
     if (select == 1)
     {
         Edition = "ePlus Professional Edition";
         //select = 0;
         cmbEdition.Enabled = false;
     }
     else
     {
         Edition = cmbEdition.SelectedItem.ToString();
     }
     settings1.getconnectionstring(Edition);
     settings           = settings1.ReadSettings();
     dbinfo1.ServerName = settings.serverName;
     dbinfo1.DBName     = settings.dbName;
     dbinfo1.DBPort     = settings.dbPort;
     dbinfo1.DBUser     = settings.userName;
     dbinfo1.DBPWD      = settings.password;
     connectionString   = dbinfo.getConnectionString(dbinfo1);
     //Dgv.DataSource = null;
     // Dgv.Rows.Clear();
     cnn = new MySqlConnection(connectionString);
     openconnection(cnn);
 }
Esempio n. 2
0
        public xmlSettings ReadSettings()
        {
            xmlSettings settings = new xmlSettings();

            //MessageBox.Show(xmlSettingsFile);
            if (!File.Exists(xmlSettingsFile))
            {
                settings.success      = false;
                settings.errorMessage = "File not found (" + xmlSettingsFile + ")";
                return(settings);
            }
            string        xmlElement = "";
            XmlTextReader reader     = new XmlTextReader(xmlSettingsFile);

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    xmlElement = reader.Name;
                    //MessageBox.Show(objXmlTextReader.Name);
                    break;

                case XmlNodeType.Text:
                    switch (xmlElement)
                    {
                    case "SERVER":
                        settings.serverName = reader.Value;
                        break;

                    case "DATABASE":
                        settings.dbName = reader.Value;
                        break;

                    case "PORT":
                        settings.dbPort = reader.Value;
                        break;

                    case "USER":
                        settings.userName = reader.Value;
                        break;

                    case "PWD":
                        settings.password = reader.Value;
                        break;

                    case "TIMER":
                        settings.timer = reader.Value;
                        break;
                    }
                    break;
                }
            }
            reader.Close();
            settings.success      = true;
            settings.errorMessage = "";
            return(settings);
        }
 private void cmbEdition_SelectedIndexChanged(object sender, EventArgs e)
 {
     cmbBranch.Enabled = true;
     Edition           = cmbEdition.SelectedItem.ToString();
     //MessageBox.Show(Edition);
     settings1.getconnectionstring(Edition);
     settings           = settings1.ReadSettings();
     dbinfo1.ServerName = settings.serverName;
     dbinfo1.DBName     = settings.dbName;
     dbinfo1.DBPort     = settings.dbPort;
     dbinfo1.DBUser     = settings.userName;
     dbinfo1.DBPWD      = settings.password;
     connectionString   = dbinfo.getConnectionString(dbinfo1);
     //Dgv.DataSource = null;
     // Dgv.Rows.Clear();
     cnn = new MySqlConnection(connectionString);
     openconnection(cnn);
 }