Beispiel #1
0
        private bool connecter()
        {
            string ConStr = "";

            DeltaCon.Close();
            DeltaConTmp1.Close();
            deltaConTmp2.Close();
            deltaConMod.Close();

            ConStr = "SERVER=" + Inif.ReadString("BDD", "hostname") + "; Allow User Variables=True; DATABASE=" + baseInit +
                     "; UID=" + Inif.ReadString("BDD", "user") + "; PASSWORD="******"BDD", "password") + "; PORT=" + Inif.ReadString("BDD", "port") + ";default command timeout=600;ConnectionTimeout=600";

            DeltaCon.ConnectionString = DeltaConTmp1.ConnectionString = deltaConMod.ConnectionString = deltaConTmp2.ConnectionString = ConStr;

            //server=localhost;User Id=root;password=za;Persist Security Info=True;database=deltareal
            ConStr = "server=" + Inif.ReadString("BDD", "hostname") + "; DATABASE=" + baseInit +
                     "; User ID=" + Inif.ReadString("BDD", "user") + "; PASSWORD="******"BDD", "password") + "; Persist Security Info=True" + ";default command timeout=600;ConnectionTimeout=600";
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                DeltaCon.Open();
                DeltaConTmp1.Open();
                deltaConTmp2.Open();
                deltaConMod.Open();

                DeltaSQLTmp.Connection = DeltaConTmp1;
                //DeltaSQLCon.Connection = DeltaConTmp1;
                Cursor.Current        = Cursors.Default;
                this.ActiveControl    = edUser;
                this.StatusLabel.Text = "Connection à la base réussie !";


                Properties.Settings.Default["deltarealConnectionString"] = ConStr;

                return(true);
            }
            catch
            {
                //var result = MessageBox.Show(this, "Connexion échouée ! Veuillez vérifier les paramètres !", "Connexion action la Base de Données.");
                Util.AfficherErreur("Connexion à la base échouée ! Veuillez vérifier les paramètres !");
                DeltaCon.Close();
                DeltaConTmp1.Close();
                deltaConTmp2.Close();
                deltaConMod.Close();
                return(false);

                //System.Windows.Forms.Application.Exit();
            }
        }
Beispiel #2
0
        private void chargerclireal(string idcli)
        {
            string sz = "SELECT '' as refentreprise, cli.idclient as iddeltareal, cli.socligne1, cli.socligne2, " +
                        "if(cli.tva = '', 0.00, cli.tva) as tauxtva from " + Fmain.baseInit + ".client cli  WHERE cli.idclient = " + idcli;

            socligne1.Text = "";

            /*"SELECT '' as refclient, cli.idclient as iddeltareal, concat(cli.socligne1, ' ', cli.socligne2) as raisonsociale, " +
             * "clidelta.idlanguage as idlanguage, langfonc.language as language, " +
             * "clidelta.idpolitesse, typepolfonc.politesse as politesse, " +
             * "clidelta.nomprenom as administrateur, " +
             * "clidelta.adresse1 as adresse, cityfonc.zip as npa, cityfonc.cityname as ville, " +
             * "cityfonc.idcity as idville, clidelta.teldirect as telpro, clidelta.mobile as telmob, " +
             * "clidelta.fax as fax, clidelta.email as email, clidelta.adresseweb as siteweb, " +
             * "if(cli.tva = '', 0, cli.tva) as tauxtva from " + Fmain.baseInit + ".client cli left join " + Fmain.baseInit + ".clientfonction clidelta ON clidelta.idclient = cli.idclient " +
             * "AND clidelta.idfonctiondelta = 9 left join " + Fmain.baseInit + ".typepolitesse typepolfonc ON typepolfonc.idpolitesse = clidelta.idpolitesse " +
             * "LEFT join " + Fmain.baseInit + ".language langfonc ON langfonc.idlanguage = clidelta.idlanguage LEFT JOIN " + Fmain.baseInit + ".city cityfonc ON cityfonc.idcity = clidelta.idville WHERE cli.idclient = " + idcli;
             */

            uf.afficherInfo(p_client, sz, comrealvista, null, "");
            if (socligne1.Text == "")
            {
                uf.AfficherErreur("Client Deltareal non trouvé !");
            }
            else
            {
                uf.enablecontrol(p_client, "2", false);
                iddeltareal.Enabled = true;
            }
        }
Beispiel #3
0
 private void bt_suppr_Click(object sender, EventArgs e)
 {
     if (uf.ValeurParCond(comrealvistamod, "fact_facturation", "idfacture, idclient", "idfacture", "idclient = " + refclient.Text) != "")
     {
         uf.AfficherErreur("Attention, ce client a déjà une facture !");
         return;
     }
     if (uf.confirmer_questionON(this, "Etes-vous sûre de supprimer cette ligne ?") == DialogResult.No)
     {
         annule();
         return;
     }
     uf.executeSQL(comrealvista, "fact_client", "", "", 3, "idclient = " + gv_client.CurrentRow.Cells["g_refclient"].Value.ToString());
     uf.executeSQL(comrealvista, "fact_clientarchive", "", "", 3, "idclient = " + gv_client.CurrentRow.Cells["g_refclient"].Value.ToString());
     gv_client.Rows.Remove(gv_client.CurrentRow);
     annule();
 }
Beispiel #4
0
        private void bt_valider_Click(object sender, EventArgs e)
        {
            decimal dprix = 0;

            decimal.TryParse(uf.valtexte(edprix), out dprix);

            decimal drabaisp = 0;
            decimal drabaism = 0;

            decimal.TryParse(uf.valtexte(edrabaismontant), out drabaism);
            decimal.TryParse(uf.valtexte(edrabaispourcent), out drabaisp);
            if (unite.SelectedIndex < 0)
            {
                uf.AfficherErreur("Veuillez l'unité de cet article !");
                return;
            }
            if (drabaisp > 0)
            {
                drabaism = 0;
            }

            if (dprix == 0)
            {
                uf.AfficherErreur("Veuillez entrer le prix de cet article !");
                return;
            }
            if (etat == 2 && dprix == 0)
            {
                uf.AfficherErreur("Veuillez entrer le prix de cet article !");
                return;
            }

            string champ = "identreprise, codearticle, descriptif_ligne1, descriptif_ligne2, descriptif_ligne3, descriptif_ligne4, descriptif_ligne5, remarque, idunite";
            string val   = "115 $ ART 02 $ DESCR 2 $ remarque 2 $ 3 $ 20.30";

            val = Fmain.identreprisesel + "$" + valtexte(codearticle) + "$" + valtexte(descriptif_ligne1) + "$" + valtexte(descriptif_ligne2) + "$" + valtexte(descriptif_ligne3) + "$" + valtexte(descriptif_ligne4) + "$" + valtexte(descriptif_ligne5) + "$"
                  + valtexte(remarque) + "$" + uf.valcombo(unite);

            if (etat == 2)
            {
                string newid = uf.executeSQL(comrealvista, "fact_articles", champ, val, etat, "");
                uf.executeSQL(comrealvista, "fact_prix", "idarticleprix, dateprix, prix", newid + "$" + string.Format("{0:yyyy-MM-dd}", eddateprix.Value) + "$" + uf.getFormatCur(dprix), 2, "");
                if (drabaisp > 0 || drabaism > 0)
                {
                    uf.executeSQL(comrealvista, "fact_rabais", "idarticlerabais, dateranaisde, dateranaisa, rabaispourcent, rabaismontant", newid + "$" + string.Format("{0:yyyy-MM-dd}", eddaterabaisde.Value) + "$" + string.Format("{0:yyyy-MM-dd}", eddaterabaisa.Value) + "$" + uf.getFormatCur(edrabaispourcent) + "$" + uf.getFormatCur(edrabaismontant), 2, "");
                }
            }
            else if (etat == 1)
            {
                uf.executeSQL(comrealvista, "fact_articles", champ, val, etat, "idarticle = " + gv_article.CurrentRow.Cells["g_idarticle"].Value.ToString());
            }
            if (etat == 1)
            {
                curligne = gv_article.CurrentRow.Index;
            }
            else
            {
                curligne = gv_article.RowCount - 1;
            }
            uf.afficherInfo(this, reqdon, comrealvista, gv_article, "");
            annule();
        }