Beispiel #1
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            if (strFilePath == "")
            {
                if (ImageByteArray.Length != 0)
                {
                    ImageByteArray = new byte[] { }
                }
                ;
            }
            else
            {
                Image        temp = new Bitmap(strFilePath);
                MemoryStream strm = new MemoryStream();
                temp.Save(strm, System.Drawing.Imaging.ImageFormat.Jpeg);
                ImageByteArray = strm.ToArray();
            }
            string req4 = "update Material set Nombre=" + textBox5.Text + ", image='" + ImageByteArray + "',Prix=" + textBox4.Text + " where Nom_Mt='" + textBox6.Text + "'";

            ClassConnection.Excute(req4);
            dataGridView2.Rows.Clear();
            dataGridView2.Columns[2].Visible = false;
            string        req = "SELECT * FROM Material";
            SqlDataReader dr  = ClassConnection.FillDataReader(req);

            while (dr.Read())
            {
                dataGridView2.Rows.Add(dr[1], dr[2], dr[3], dr[4], dr[5]);
            }
            dr.Close();
            ClassConnection.CloseCnx();
        }
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     if (bunifuDropdown1.selectedIndex == -1)
     {
         MessageBox.Show("Selectioné un client", "Ereur", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     else
     {
         if (checkBox1.Checked == true)
         {
             ClassConnection.OpenCnx();
             string        delimiteur = " ";
             char[]        limite     = delimiteur.ToCharArray();
             string        value      = bunifuDropdown1.selectedValue;
             string[]      split      = value.Split(limite);
             string        req1       = "select IdClient from Client where Nom='" + split[1] + "'";
             SqlDataReader dr1        = ClassConnection.FillDataReader(req1);
             if (dr1.Read())
             {
                 Id_Client = (int)dr1["IdClient"];
                 string req2 = "insert into Commande values(" + Id_Client + ")";
                 dr1.Close();
                 ClassConnection.Excute(req2);
             }
             bunifuImageButton1.Enabled = true;
             bunifuImageButton2.Enabled = true;
         }
         else
         {
             bunifuImageButton1.Enabled = false;
             bunifuImageButton2.Enabled = false;
         }
     }
 }
Beispiel #3
0
 private void bunifuFlatButton2_Click(object sender, EventArgs e)
 {
     try
     {
         if (radioButton1.Checked == true)
         {
             string req = "update client set Prenom='" + textBox2.Text + "',Nom='" + textBox3.Text + "',Adresse='" + textBox6.Text + "',telephone='" + textBox4.Text + "',Email='" + textBox5.Text + "' where IdClient='" + textBox1.Text + "'";
             ClassConnection.Excute(req);
             MessageBox.Show("la Modification effectué", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             refresh();
         }
         if (radioButton2.Checked == true)
         {
             string req = "update client set Prenom='" + textBox2.Text + "',Nom='" + textBox3.Text + "',Adresse='" + textBox6.Text + "',telephone='" + textBox4.Text + "',Email='" + textBox5.Text + "' where Nom=" + textBox1.Text + "";
             ClassConnection.Excute(req);
             MessageBox.Show("la Modification effectué", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             refresh();
         }
         if (radioButton3.Checked == true)
         {
             string req = "update client set Prenom='" + textBox2.Text + "',Nom='" + textBox3.Text + "',Adresse='" + textBox6.Text + "',telephone='" + textBox4.Text + "',Email='" + textBox5.Text + "' where Prenom='" + textBox1.Text + "'";
             ClassConnection.Excute(req);
             MessageBox.Show("la Modification effectué", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             refresh();
         }
         else
         {
             MessageBox.Show("selectioné un radiobutton de modification", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch
     {
         MessageBox.Show("Erreur de modification", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void bunifuImageButton4_Click_1(object sender, EventArgs e)
 {
     try
     {
         if (bunifuDropdown1.selectedIndex == -1 || NomMtxt.selectedIndex == -1 || nbMtxt.Text == string.Empty || prixMtxt.Text == string.Empty)
         {
             MessageBox.Show("Tu doit Remlir tout les champs", "Ereur", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         else
         {
             string        delimiteur = " ";
             char[]        limite     = delimiteur.ToCharArray();
             string        value      = bunifuDropdown1.selectedValue;
             string[]      split      = value.Split(limite);
             string        req1       = "select IdClient from Client where Nom='" + split[1] + "'";
             SqlDataReader dr1        = ClassConnection.FillDataReader(req1);
             if (dr1.Read())
             {
                 Id_Client = (int)dr1["IdClient"];
                 string req3 = "SELECT Id_C from Commande where IdClient=" + Id_Client + "";
                 ClassConnection.OpenCnx();
                 dr1.Close();
                 SqlDataReader dr2 = ClassConnection.FillDataReader(req3);
                 if (dr2.Read())
                 {
                     Id_C = (int)dr2["Id_C"];
                 }
                 dr2.Close();
                 if (strFilePath == "")
                 {
                     if (ImageByteArray.Length != 0)
                     {
                         ImageByteArray = new byte[] { }
                     }
                     ;
                 }
                 else
                 {
                     Image        temp = new Bitmap(strFilePath);
                     MemoryStream strm = new MemoryStream();
                     temp.Save(strm, System.Drawing.Imaging.ImageFormat.Jpeg);
                     ImageByteArray = strm.ToArray();
                 }
                 string req4 = "insert into Material values('" + NomMtxt.selectedValue + "'," + nbMtxt.Text + ",'" + ImageByteArray + "'," + Id_C.ToString() + "," + prixMtxt.Text + ")";
                 dr2.Close();
                 ClassConnection.Excute(req4);
                 ClassConnection.CloseCnx();
                 MessageBox.Show("la Commande effectuer", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch
     {
         MessageBox.Show("Problem d'ajouter la Commande", "Ereur", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #5
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 7)
     {
         DialogResult dialogResult = MessageBox.Show("Voulez-Vous Supprimé ce client !!", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (dialogResult == DialogResult.Yes)
         {
             int    row = e.RowIndex;
             int    idc = (int)dataGridView1.Rows[e.RowIndex].Cells[0].Value;
             string req = "select Id_C from Commande where IdClient='" + idc + "'";
             dr2 = ClassConnection.FillDataReader(req);
             if (dr2.Read())
             {
                 string req1 = "delete from RDV where Id_C='" + dr2["Id_C"] + "'";
                 string req2 = "delete from Plats where Id_C='" + dr2["Id_C"] + "'";
                 string req3 = "delete from Material where Id_C='" + dr2["Id_C"] + "'";
                 string req4 = "delete from Commande where Id_C='" + dr2["Id_C"] + "'";
                 string req5 = "delete from Client where IdClient='" + idc + "'";
                 dr2.Close();
                 ClassConnection.Excute(req1);
                 ClassConnection.Excute(req2);
                 ClassConnection.Excute(req3);
                 ClassConnection.Excute(req4);
                 ClassConnection.Excute(req5);
                 dataGridView1.Rows.RemoveAt(e.RowIndex);
                 MessageBox.Show("la Supprision effectué", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     if (e.ColumnIndex == 8)
     {
         DialogResult dialogResult = MessageBox.Show("Voulez-Vous Modifier ce client !!", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (dialogResult == DialogResult.Yes)
         {
             int    row     = e.RowIndex;
             int    idc     = (int)dataGridView1.Rows[e.RowIndex].Cells[0].Value;
             string Prenom  = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
             string Nom     = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
             string Adresse = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
             int    Tlf     = (int)dataGridView1.Rows[e.RowIndex].Cells[4].Value;
             string Email   = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString();
             string Type    = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString();
             string req     = "update client set Prenom='" + Prenom + "',Nom='" + Nom + "',Adresse='" + Adresse + "',telephone='" + Tlf + "', Email='" + Email + "' , TypeEvenement='" + Type + "'where IdClient=" + idc + "";
             ClassConnection.Excute(req);
             MessageBox.Show("la Modification effectué", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             refresh();
         }
     }
 }
Beispiel #6
0
        private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 5)
            {
                DialogResult dialogResult = MessageBox.Show("Voulez-Vous Supprimé ce type de Material !!", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dialogResult == DialogResult.Yes)
                {
                    int    row  = e.RowIndex;
                    string NomP = dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString();

                    string req1 = "delete from Material where Nom_Mt='" + NomP + "'";
                    ClassConnection.Excute(req1);
                    dataGridView2.Rows.RemoveAt(e.RowIndex);
                    MessageBox.Show("la Supprision effectué", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
 private void bunifuImageButton8_Click(object sender, EventArgs e)
 {
     try
     {
         if (bunifuDropdown1.selectedIndex == -1 || Plattxt.selectedIndex == -1 || platnbtxt.Text == string.Empty || prixplattxt.Text == string.Empty)
         {
             MessageBox.Show("Tu doit Remlir tout les champs", "Ereur", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         else
         {
             string req3 = "SELECT Id_C from Commande where IdClient=" + Id_Client + "";
             ClassConnection.OpenCnx();
             SqlDataReader dr2 = ClassConnection.FillDataReader(req3);
             if (dr2.Read())
             {
                 Id_C = (int)dr2["Id_C"];
             }
             dr2.Close();
             if (strFilePath == "")
             {
                 if (ImageByteArray.Length != 0)
                 {
                     ImageByteArray = new byte[] { }
                 }
                 ;
             }
             else
             {
                 Image        temp = new Bitmap(strFilePath);
                 MemoryStream strm = new MemoryStream();
                 temp.Save(strm, System.Drawing.Imaging.ImageFormat.Jpeg);
                 ImageByteArray = strm.ToArray();
             }
             string req4 = "insert into Plats values('" + Plattxt.selectedValue + "'," + platnbtxt.Text + ",'" + ImageByteArray + "'," + Id_C.ToString() + "," + prixplattxt.Text + ")";
             ClassConnection.Excute(req4);
             ClassConnection.CloseCnx();
             MessageBox.Show("la Commande effectuer", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             dr2.Close();
         }
     }
     catch
     {
         MessageBox.Show("Problem d'ajouter la Commande", "Ereur", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #8
0
 private void bunifuFlatButton1_Click(object sender, EventArgs e)
 {
     try
     {
         if (Nomtxt.Text == string.Empty || prenomtxt.Text == string.Empty || adresstxt.Text == string.Empty || emailtxt.Text == string.Empty || eventtxt.Text == string.Empty)
         {
             label1.Visible = true;
             label2.Visible = true;
             label3.Visible = true;
             label4.Visible = true;
             label5.Visible = true;
             label5.Visible = true;
             label6.Visible = true;
             label1.Text    = "* champs obligatoire";
             label2.Text    = "* champs obligatoire";
             label3.Text    = "* champs obligatoire";
             label4.Text    = "* champs obligatoire";
             label5.Text    = "* champs obligatoire";
             label6.Text    = "* champs obligatoire";
         }
         else
         {
             label1.Visible = false;
             label2.Visible = false;
             label3.Visible = false;
             label4.Visible = false;
             label5.Visible = false;
             label6.Visible = false;
             string req1 = "INSERT INTO Client VALUES('" + Nomtxt.Text + "','" + prenomtxt.Text + "','" + adresstxt.Text + "'," + tlftxt.Text + ",'" + emailtxt.Text + "','" + eventtxt.Text + "')";
             ClassConnection.Excute(req1);
             SuccessDialog s = new SuccessDialog();
             s.ShowDialog();
         }
     }
     catch
     {
         MessageBox.Show("Ereur d'ajouter le client", "Ereur", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
     }
 }