示例#1
0
        private void btn_fermer_Click(object sender, RoutedEventArgs e)
        {
            int i, codeEchan, qte;

            for (i = 0; i < ltb_resultat.Items.Count; i++)
            {
                CURS   cs      = new CURS(_chaineConnexion);
                string requete = "SELECT ECHAN_CODE FROM echantillon WHERE ECHAN_NOM = '" + ltb_resultat.Items[i] + "'; ";
                cs.ReqSelect(requete);
                codeEchan = Int32.Parse(cs.champ("ECHAN_CODE").ToString());
                cs.fermer();

                qte = Int32.Parse(ltb_qte.Items[i].ToString());

                CURS   cs3      = new CURS(_chaineConnexion);
                string requete3 = "INSERT INTO distribuer VALUES ( " + -_rapNum + " , " + codeEchan + " , " + qte + ");";
                cs3.ReqAdmin(requete3);
                cs3.fermer();
            }

            this.Close();
        }
示例#2
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            TextRange textrange = new TextRange(
                rtbx_bilan.Document.ContentStart,
                rtbx_bilan.Document.ContentEnd
                );

            if (tbx_NRapport.Text != "" && textrange.Text != "")
            {
                string dt = Convert.ToString(dtp_date);
                dt = dt.Replace('/', '-');
                string   checkbox_value = dt;
                char[]   splitters      = new char[] { '-' };
                string[] laCase         = checkbox_value.Split(splitters);
                string   value          = laCase[2];
                char[]   split          = new char[] { ' ' };
                string[] laCas          = value.Split(split);
                dt = laCas[0] + "-" + laCase[1] + "-" + laCase[0] + " " + laCas[1];


                MessageBoxResult retour = MessageBox.Show("Vous venez de valider un rapport de visite !. Avez-vous donner des échantillons ?", "Alerte", MessageBoxButton.YesNo);
                if (retour == MessageBoxResult.Yes)
                {
                    CURS   cs3      = new CURS(_chaineConnexion);
                    string requete3 = "INSERT INTO rapport_visite VALUES ( '" + _matricule + "' , " + tbx_NRapport.Text + " , " + tbx_test.Text + ", '" + dt + "' , '" + textrange.Text + "');";
                    cs3.ReqAdmin(requete3);
                    cs3.fermer();
                    CURS   cs5      = new CURS(_chaineConnexion);
                    string requete5 = "SELECT MOTIF_CODE FROM motif WHERE MOTIF_LIBELLE = '" + cbx_motif.Text + "' ;";
                    cs5.ReqSelect(requete5);
                    string code_motif;
                    code_motif = cs5.champ("MOTIF_CODE").ToString();
                    CURS   cs4      = new CURS(_chaineConnexion);
                    string requete4 = "INSERT INTO motiver VALUES ( " + code_motif + " , " + tbx_NRapport.Text + " , '" + _matricule + "' );";
                    cs4.ReqAdmin(requete4);
                    cs4.fermer();

                    Echantillons echan = new Echantillons(_chaineConnexion, Int32.Parse(tbx_NRapport.Text));
                    echan.Show();

                    Reload();
                }
                else
                {
                    CURS   cs3      = new CURS(_chaineConnexion);
                    string requete3 = "INSERT INTO rapport_visite VALUES ( '" + _matricule + "' , " + tbx_NRapport.Text + " , " + tbx_test.Text + " , '" + dt + "' , '" + textrange.Text + "');";
                    cs3.ReqAdmin(requete3);
                    cs3.fermer();
                    CURS   cs5      = new CURS(_chaineConnexion);
                    string requete5 = "SELECT MOTIF_CODE FROM motif WHERE MOTIF_LIBELLE = '" + cbx_motif.Text + "' ;";
                    cs5.ReqSelect(requete5);
                    string code_motif;
                    code_motif = cs5.champ("MOTIF_CODE").ToString();
                    CURS   cs4      = new CURS(_chaineConnexion);
                    string requete4 = "INSERT INTO motiver VALUES ( " + code_motif + " , " + tbx_NRapport.Text + " , '" + _matricule + "' );";
                    cs4.ReqAdmin(requete4);
                    cs4.fermer();


                    MessageBox.Show("Rapport enregistrer !");
                    Reload();
                }
            }
            else
            {
                MessageBox.Show("Vous n'avez pas remplis tout les champs ! ");
            }
        }