private void button_annuler_Click(object sender, EventArgs e)
        {
            FicheVendeur fv = new FicheVendeur();

            fv.Show(this);
            this.Hide();
        }
예제 #2
0
        private void Visualiser_Click(object sender, EventArgs e)
        {
            FicheVendeur fv = new FicheVendeur();

            fv.Show(this);
            this.Hide();
        }
예제 #3
0
        private void button_FicheVendeurConsultationBien_Click(object sender, EventArgs e)
        {
            ApplicationState.id_vendeur = textBox2.Text;
            FicheVendeur fv = new FicheVendeur();

            fv.Show(this);
        }
예제 #4
0
        private void Annuler_NouveauBien(object sender, EventArgs e)
        {
            FicheVendeur fv = new FicheVendeur();

            fv.Show(this);
            this.Hide();
        }
예제 #5
0
        private void Button_Valider_Click(object sender, EventArgs e)
        {
            #region insertion du bien
            OleDbConnection dbConnection = new OleDbConnection(ApplicationState.ChaineBd);
            dbConnection.Open();

            string sql1 = "INSERT Into Bien (SURFACE_HABITABLE, SURFACE_PARCELLE, NB_PIéCES, NB_CHAMBRES, NB_SALLE_DE_BAIN, GARAGE, CAVE, PRIX_VENDEUR, ADRESSE, DATE_MISE_EN_VENTE, COMMENTAIRE, STATUT, CODE_VILLE, NUM_CLIENT)";
            string sql2 = "VALUES ('" + textBox_AjSurfaceHabitableBien.Text + "','" + textBox_AjSurfaceParcelleBien.Text + "','" + nbPiecesBien.Text + "','" + nbChambreBien.Text + "','" + nbSDBien.Text + "', '" + checkBox_GarageOuiBien.Checked + "', '" + checkBoxCaveOuiBien.Checked + "', '" + textBox_AjPrixVendeurBien.Text + "','" + textBox_AjRueBien.Text.Replace("'", "''") + "','" + dateTimePicker1.Value + "', '" + textBox_AjCommentaireBien.Text.Replace("'", "''") + "', 'D',(SELECT v.code_ville from VILLE v where v.NOM_VILLE LIKE '" + textBox_AjVilleBien.Text + "' AND v.code_postal like '" + textBox_AjCPBien.Text + "'),'" + textBox_AjCodeVendeur.Text + "' ) ";
            string sql  = sql1 + sql2;


            OleDbCommand cmd = new OleDbCommand(sql, dbConnection);
            cmd.ExecuteNonQuery();

            #endregion
            #region  mail de notification aux commerciaux

            MailMessage email = new MailMessage();
            email.From = new MailAddress("*****@*****.**");
            string sqlMailCommerciaux = "SELECT Email from COMMERCIAL";
            cmd = new OleDbCommand(sqlMailCommerciaux, dbConnection);
            OleDbDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                email.To.Add(new MailAddress(reader.GetString(0)));
            }
            reader.Close();

            email.IsBodyHtml = false;
            email.Subject    = "Arrivée d'un nouveau Bien";
            email.Body       = "Description du Bien : \n Nom vendeur: " + textBox_AjNomVendeur.Text.Replace(" ", "") + " " + textBox_AjPrenomVendeur.Text.Replace(" ", "") + "\n Adresse du bien: " + textBox_AjRueBien.Text + "\n " + textBox_AjVilleBien.Text + " " + textBox_AjCPBien.Text + "\n Prix : " + textBox_AjPrixVendeurBien.Text + "\n Surface habitable : " + textBox_AjSurfaceHabitableBien.Text + "\n Surface parcelle : " + textBox_AjSurfaceParcelleBien.Text + "\n Nb Pièces: " + nbPiecesBien.Value.ToString() + "\n Nb Chambres : " + nbChambreBien.Value.ToString() + "\n Nb Sdb: " + nbSDBien.Value.ToString() + "\n Commentaire :" + textBox_AjCommentaireBien.Text;
            Console.WriteLine(email.Body);
            SmtpClient smtp = new SmtpClient();

            smtp.Host        = "smtp.gmail.com";
            smtp.EnableSsl   = true;
            smtp.Credentials = new System.Net.NetworkCredential("ImmoJackyTeam", "ImmoBilly123");
            smtp.Send(email);



            #endregion
            MessageBox.Show("Saved");

            FicheVendeur fv = new FicheVendeur();
            fv.Show(this);
            this.Hide();
        }
        private void button_valider_MouseClick(object sender, MouseEventArgs e)
        {
            string ChaineBd = "Provider=SQLOLEDB;Data Source=INFO-joyeux;Initial Catalog=IMMOBILLY_JACKYTEAM;Persist Security Info=True; Integrated Security=sspi;";

            OleDbConnection dbConnection = new OleDbConnection(ChaineBd);

            dbConnection.Open();

            string       sql = "UPDATE VENDEUR SET Nom_Client = '" + textBox1_Nom.Text.Replace("'", "''") + "', Prénom_Client = '" + textBox2_Prenom.Text.Replace("'", "''") + "', Téléphone =  '" + textBox3_Telephone.Text + "', E_mail = '" + textBox4_E_Mail.Text + "', Adresse = '" + textBox12_Adresse.Text.Replace("'", "''") + "', code_ville = (select code_ville from ville where upper(nom_ville) = '" + textBox11_Ville.Text.Replace("'", "''") + "' and Code_Postal = '" + textBox1.Text + "') where Num_Client = '" + ApplicationState.id_vendeur + "'  ";
            OleDbCommand cmd = new OleDbCommand(sql, dbConnection);

            cmd.ExecuteNonQuery();
            MessageBox.Show("Saved");

            FicheVendeur fv = new FicheVendeur();

            fv.Show(this);
            this.Hide();
        }