コード例 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string connString = string.Empty;

            connString += "Server=" + textBoxServer.Text + ";";
            connString += "Port=" + textBoxPort.Text + ";";
            connString += "User Id=" + textBoxDBUser.Text + ";";
            connString += "Password="******";";
            connString += "DataBase=" + textBoxDB.Text + ";";
            DB_PostgreSQL dataBase = new DB_PostgreSQL();

            if (dataBase.testConnection(connString))
            {
                MessageBox.Show("Connexion établie");
            }
            else
            {
                MessageBox.Show("Erreur de Configuration ");
            }
        }
コード例 #2
0
        private void buttonSaveconnString_Click(object sender, EventArgs e)
        {
            DB_PostgreSQL dataBase   = new DB_PostgreSQL();
            string        connString = string.Empty;

            connString += "Server=" + textBoxServer.Text + ";";
            connString += "Port=" + textBoxPort.Text + ";";
            connString += "User Id=" + textBoxDBUser.Text + ";";
            connString += "Password="******";";
            connString += "DataBase=" + textBoxDB.Text + ";";
            if (dataBase.testConnection(connString))
            {
                GlobalVars.connString = connString;
                ConfigSettings.WriteSetting("connString", connString);
                buttonOptions_Click(sender, e);
            }
            else
            {
                MessageBox.Show("Vérifiez la configuration de la base de données =>" + connString);
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            //----------------------------------------------------
            DB_PostgreSQL dataBase   = new DB_PostgreSQL();
            string        connString = string.Empty;

            connString           += "Server=" + textBoxServer.Text + ";";
            connString           += "Port=" + textBoxPort.Text + ";";
            connString           += "User Id=" + textBoxDBUser.Text + ";";
            connString           += "Password="******";";
            connString           += "DataBase=" + textBoxDB.Text + ";";
            GlobalVars.connString = connString;
            if (dataBase.testConnection(connString))
            {
                ConfigSettings.WriteSetting("connString", connString);
            }
            else
            {
                MessageBox.Show("Vérifiez la configuration de la base de données =>" + connString);
            }
            //--------------------------------------------------------
            string Printer      = comboPrinters.Text;
            string Page         = comboPage.SelectedIndex.ToString();
            string NbTicket     = textNbTicket.Text;
            string MaxPressing  = textMaxPressing.Text;
            string MaxRepassage = textMaxRepassage.Text;
            string MaxTenture   = textMaxTenture.Text;
            string MaxAutre     = textMaxAutre.Text;

            GlobalVars.page              = comboPage.SelectedIndex.ToString();
            GlobalVars.namePrinter       = Printer;
            GlobalVars.nombreCopieTicket = NbTicket;
            GlobalVars.maxAutre          = MaxAutre;
            GlobalVars.maxPressing       = MaxPressing;
            GlobalVars.maxRepassage      = MaxRepassage;
            GlobalVars.maxTenture        = MaxTenture;
            ConfigSettings.WriteSetting("Printer", Printer);
            ConfigSettings.WriteSetting("Page", Page);
            ConfigSettings.WriteSetting("NbTicket", NbTicket);
            ConfigSettings.WriteSetting("MaxPressing", MaxPressing);
            ConfigSettings.WriteSetting("MaxRepassage", MaxRepassage);
            ConfigSettings.WriteSetting("MaxTenture", MaxTenture);
            ConfigSettings.WriteSetting("MaxAutre", MaxAutre);
            //--------------------------------------------------------
            string PrefixFacture  = textPrefixFacture.Text;
            string PremierFacture = textPremierFacture.Text;
            string PrefixClient   = textPrefixClient.Text;

            GlobalVars.PrefixFacture  = PrefixFacture;
            GlobalVars.PremierFacture = PremierFacture;
            GlobalVars.PrefixClient   = PrefixClient;
            ConfigSettings.WriteSetting("prefixFacutre", PrefixFacture);
            ConfigSettings.WriteSetting("firstFacutre", PremierFacture);
            ConfigSettings.WriteSetting("prefixClient", PrefixClient);
            //----------------------------------------------------------
            //----------------------------------------------------------
            MyUtils myUtils = new MyUtils();

            if (validateFields())
            {
                InfoSociete societe = new InfoSociete();
                societe.nom     = txtNom.Text;
                societe.adresse = txtAdresse.Text;
                societe.tel     = txttele.Text;
                societe.fax     = txtfax.Text;
                if (tbxPhoto.Text != string.Empty)
                {
                    societe.logo = myUtils.GetPhoto(tbxPhoto.Text);
                }
                societe.SaveData();
            }
            //-------------------------------------------------------------
            this.Close();
        }