コード例 #1
0
        public ModifierFacture(Factures Formf, Facture f,Accueil ac)
        {
            InitializeComponent();
            this.Formf = Formf;
            this.f = f;
            this.ac = ac;

            ToolTip t = new ToolTip();

            t.ShowAlways = true;
            t.SetToolTip(textBox5, "Insertion des numéros uniquement (Ex : 1,01).");

            t.ShowAlways = true;
            t.SetToolTip(textBox6, "Insertion des numéros uniquement (Ex : 1,01).");

            t.ShowAlways = true;
            t.SetToolTip(textBox7, "Insertion des numéros uniquement (Ex : 1,01).");

            t.ShowAlways = true;
            t.SetToolTip(pictureBox3, "Ajouter");

            t.ShowAlways = true;
            t.SetToolTip(pictureBox4, "Modifier");

            t.ShowAlways = true;
            t.SetToolTip(pictureBox5, "Supprimer");
        }
コード例 #2
0
        private void supprimer()
        {
            if (dataGridView1.Rows.Count == 0)
            {
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult result = MessageBox.Show("Voulez-vous vraiment supprimer cette facture?", "Supprimer Facture", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    int     numero_Facture = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value.ToString());
                    Facture F = new Facture(numero_Facture);
                    F.supprimerFacture();

                    this.factureTableAdapter.Fill(this.gestioncommercialeDataSet1.facture);
                }
            }
        }
コード例 #3
0
 private void modifier()
 {
     if (dataGridView1.Rows.Count == 0)
     {
         MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         int             numero_Facture     = Convert.ToInt16(dataGridView1.CurrentRow.Cells[0].Value);
         string          date_Facture       = dataGridView1.CurrentRow.Cells[1].Value.ToString();
         double          timbre_Facture     = Convert.ToDouble(dataGridView1.CurrentRow.Cells[2].Value);
         double          remise_Facture     = Convert.ToDouble(dataGridView1.CurrentRow.Cells[3].Value);
         double          montantHT_Facture  = Convert.ToDouble(dataGridView1.CurrentRow.Cells[4].Value);
         double          montantTTC_Facture = Convert.ToDouble(dataGridView1.CurrentRow.Cells[5].Value);
         string          statut_Facture     = dataGridView1.CurrentRow.Cells[6].Value.ToString();
         int             Client_codeClient  = Convert.ToInt16(dataGridView1.CurrentRow.Cells[7].Value);
         Facture         f = new Facture(numero_Facture, date_Facture, timbre_Facture, remise_Facture, montantHT_Facture, montantTTC_Facture, statut_Facture, Client_codeClient);
         ModifierFacture m = new ModifierFacture(this, f, ac);
         m.Show();
         ac.Enabled = false;
     }
 }
コード例 #4
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox8.Text == "")
            {
                MessageBox.Show("Vous devez remplir les champs vides!", "Champs vides", MessageBoxButtons.OK);
                label1.ForeColor = Color.Black;
                label2.ForeColor = Color.Black;
                label9.ForeColor = Color.Black;
                label4.ForeColor = Color.Black;
                label5.ForeColor = Color.Black;
                label6.ForeColor = Color.Black;
                label8.ForeColor = Color.Black;
                label9.ForeColor = Color.Black;
                if (textBox1.Text == "")
                {
                    label1.ForeColor = Color.Red;
                }
                if (textBox8.Text == "")
                {
                    label9.ForeColor = Color.Red;
                }
            }
            else
            {
                if (textBox5.Text == "")
                {
                    textBox5.Text = "0";
                }
                if (textBox6.Text == "")
                {
                    textBox6.Text = "0";
                }



                int numero_Facture = Convert.ToInt16(textBox1.Text);

                string date_Facture = dateTimePicker1.Value.ToString("dd / MM / yyyy");

                double timbre_Facture = Convert.ToDouble(textBox5.Text);
                double remise_Facture = Convert.ToDouble(textBox6.Text);


                double montantHT_Facture  = Convert.ToDouble(textBox3.Text);
                double montantTTC_Facture = Convert.ToDouble(textBox4.Text);

                int Client_codeClient = Convert.ToInt16(textBox8.Text);

                string statut_Facture;
                if (radioButton1.Checked == true)
                {
                    statut_Facture = radioButton1.Text;
                }
                else
                {
                    statut_Facture = radioButton2.Text;
                }

                Facture F = new Facture(numero_Facture, date_Facture, timbre_Facture, remise_Facture, montantHT_Facture, montantTTC_Facture, statut_Facture, Client_codeClient);
                F.creerFacture();
                f.factureTableAdapter.Fill(f.gestioncommercialeDataSet1.facture);

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    //numero_ligneFacture : numero de la ligne_factue dans la base

                    string          MyConString = "SERVER=localhost;" + "DATABASE=gestioncommerciale;" + "UID=root;" + "PASSWORD=freedomity;";
                    MySqlConnection connection  = new MySqlConnection(MyConString);
                    MySqlCommand    cmd         = connection.CreateCommand();
                    cmd.CommandText = "select count(*) from lignefacture"; //where Facture_numeroFacture = " + Facture_numeroFacture;
                    connection.Open();
                    int num = Convert.ToInt32(cmd.ExecuteScalar());
                    connection.Close();
                    if (num != 0)
                    {
                        cmd.CommandText = "select max(numero_ligneFacture) from lignefacture;"; //where Facture_numeroFacture = " + Facture_numeroFacture;
                        connection.Open();
                        numero_ligneFacture = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
                        connection.Close();
                    }
                    else
                    {
                        numero_ligneFacture = 1;
                    }
                    dataGridView1.Rows[i].Cells[8].Value = numero_ligneFacture;
                    numero_ligneFacture   = Convert.ToInt16(dataGridView1.Rows[i].Cells[8].Value);
                    Produit_codeProduit   = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    quantite              = Convert.ToInt16(dataGridView1.Rows[i].Cells[6].Value);
                    montant_Produit       = Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value);
                    Facture_numeroFacture = numero_Facture;

                    LigneFacture L = new LigneFacture(numero_ligneFacture, Produit_codeProduit, quantite, montant_Produit, Facture_numeroFacture);
                    L.AjouterLigneFacture();
                }

                //this.lignefactureTableAdapter.Fill(this.gestioncommercialeDataSet1.lignefacture);

                Hide();
                ac.Enabled = true;
            }
        }
コード例 #5
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox8.Text == "")
            {
                MessageBox.Show("Vous devez remplir les champs vides!", "Champs vides", MessageBoxButtons.OK);
                label1.ForeColor = Color.Black;
                label2.ForeColor = Color.Black;
                label9.ForeColor = Color.Black;
                label4.ForeColor = Color.Black;
                label5.ForeColor = Color.Black;
                label6.ForeColor = Color.Black;
                label8.ForeColor = Color.Black;
                label9.ForeColor = Color.Black;
                if (textBox1.Text == "")
                {
                    label1.ForeColor = Color.Red;
                }
                if (textBox8.Text == "")
                {
                    label9.ForeColor = Color.Red;
                }

            }
            else
            {

                if (textBox5.Text == "")
                {
                    textBox5.Text = "0";
                }
                if (textBox6.Text == "")
                {
                    textBox6.Text = "0";
                }

                int numero_Facture = Convert.ToInt16(textBox1.Text);

                string date_Facture = dateTimePicker1.Value.ToString("dd / MM / yyyy");

                double timbre_Facture = Convert.ToDouble(textBox5.Text);
                double remise_Facture = Convert.ToDouble(textBox6.Text);

                double montantHT_Facture = Convert.ToDouble(textBox3.Text);
                double montantTTC_Facture = Convert.ToDouble(textBox4.Text);

                int Client_codeClient = Convert.ToInt16(textBox8.Text);

                string statut_Facture;
                if (radioButton1.Checked == true)
                    statut_Facture = radioButton1.Text;
                else
                { statut_Facture = radioButton2.Text; }

                Facture F = new Facture(numero_Facture, date_Facture, timbre_Facture, remise_Facture, montantHT_Facture, montantTTC_Facture, statut_Facture, Client_codeClient);
                F.creerFacture();
                f.factureTableAdapter.Fill(f.gestioncommercialeDataSet1.facture);

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    //numero_ligneFacture : numero de la ligne_factue dans la base

                    string MyConString = "SERVER=localhost;" + "DATABASE=gestioncommerciale;" + "UID=root;" + "PASSWORD=freedomity;";
                    MySqlConnection connection = new MySqlConnection(MyConString);
                    MySqlCommand cmd = connection.CreateCommand();
                    cmd.CommandText = "select count(*) from lignefacture"; //where Facture_numeroFacture = " + Facture_numeroFacture;
                    connection.Open();
                    int num = Convert.ToInt32(cmd.ExecuteScalar());
                    connection.Close();
                    if (num != 0)
                    {
                        cmd.CommandText = "select max(numero_ligneFacture) from lignefacture;"; //where Facture_numeroFacture = " + Facture_numeroFacture;
                        connection.Open();
                        numero_ligneFacture = Convert.ToInt32(cmd.ExecuteScalar()) + 1;
                        connection.Close();
                    }
                    else
                    {
                        numero_ligneFacture = 1;
                    }
                    dataGridView1.Rows[i].Cells[8].Value = numero_ligneFacture;
                    numero_ligneFacture = Convert.ToInt16(dataGridView1.Rows[i].Cells[8].Value);
                    Produit_codeProduit = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    quantite = Convert.ToInt16(dataGridView1.Rows[i].Cells[6].Value);
                    montant_Produit = Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value);
                    Facture_numeroFacture = numero_Facture;

                    LigneFacture L = new LigneFacture(numero_ligneFacture,Produit_codeProduit, quantite, montant_Produit, Facture_numeroFacture);
                    L.AjouterLigneFacture();
                }

                //this.lignefactureTableAdapter.Fill(this.gestioncommercialeDataSet1.lignefacture);

                Hide();
                ac.Enabled = true;
            }
        }
コード例 #6
0
ファイル: Factures.cs プロジェクト: judaHa/dotNETApplications
        private void supprimer()
        {
            if (dataGridView1.Rows.Count == 0)
                MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            else
            {
                DialogResult result = MessageBox.Show("Voulez-vous vraiment supprimer cette facture?", "Supprimer Facture", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    int numero_Facture = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value.ToString());
                    Facture F = new Facture(numero_Facture);
                    F.supprimerFacture();

                    this.factureTableAdapter.Fill(this.gestioncommercialeDataSet1.facture);
                }
            }
        }
コード例 #7
0
ファイル: Factures.cs プロジェクト: judaHa/dotNETApplications
 private void modifier()
 {
     if (dataGridView1.Rows.Count == 0)
         MessageBox.Show("Liste vide!", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
     else
     {
         int numero_Facture = Convert.ToInt16(dataGridView1.CurrentRow.Cells[0].Value);
         string date_Facture = dataGridView1.CurrentRow.Cells[1].Value.ToString();
         double timbre_Facture = Convert.ToDouble(dataGridView1.CurrentRow.Cells[2].Value);
         double remise_Facture = Convert.ToDouble(dataGridView1.CurrentRow.Cells[3].Value);
         double montantHT_Facture = Convert.ToDouble(dataGridView1.CurrentRow.Cells[4].Value);
         double montantTTC_Facture = Convert.ToDouble(dataGridView1.CurrentRow.Cells[5].Value);
         string statut_Facture = dataGridView1.CurrentRow.Cells[6].Value.ToString();
         int Client_codeClient = Convert.ToInt16(dataGridView1.CurrentRow.Cells[7].Value);
         Facture f = new Facture(numero_Facture, date_Facture, timbre_Facture, remise_Facture, montantHT_Facture, montantTTC_Facture, statut_Facture, Client_codeClient);
         ModifierFacture m = new ModifierFacture(this, f,ac);
         m.Show();
         ac.Enabled = false;
     }
 }