예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (comboBox2.Text != "" && textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "")
         {
             DialogResult result = MessageBox.Show("Are your sure to want to save this configuration ?\n Type Of server : " + comboBox1.Text + "\n Server : " + comboBox2.Text + "\n Database Name : " + textBox1.Text + "\n User : "******"\n Password : "******" ", "Please Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (result == DialogResult.Yes)
             {
                 File.WriteAllText(ClsConstantes.Table.serveur, comboBox2.Text.ToString());
                 File.WriteAllText(ClsConstantes.Table.database, textBox1.Text.ToString());
                 File.WriteAllText(ClsConstantes.Table.user, textBox2.Text.ToString());
                 File.WriteAllText(ClsConstantes.Table.password, textBox3.Text.ToString());
                 ClsGetdatas.GetInstance().Testeconne = 1;
                 this.Close();
                 ClsConnection.GetInstance().connecter();
             }
         }
         else
         {
             MessageBox.Show("Completez tous les champ !!!", "Saisie Obligatoire", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #2
0
        //public static GsmCommMain comm;


        public static void testFile()
        {
            if (Directory.Exists(ClsConstantes.Table.InitialDirectory) == true)
            {
            }

            else
            {
                Directory.CreateDirectory(ClsConstantes.Table.InitialDirectory);
            }

            if (File.Exists(ClsConstantes.Table.serveur) == true && File.Exists(ClsConstantes.Table.database) == true && File.Exists(ClsConstantes.Table.user) == true && File.Exists(ClsConstantes.Table.password) == true)
            {
                ClsConnection.GetInstance().connecter();
            }
            else
            {
                ConfigForms frm = new ConfigForms();
                frm.ShowDialog();
                ClsConnection.GetInstance().connecter();
            }
        }