Esempio n. 1
0
 private void button3_Click_1(object sender, EventArgs e)
 {
     if (bsVehicule.Current != null && MessageBox.Show("Etes vous sûres de supprimer ce véhicule?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         DVEHICULE vehicule = new DVEHICULE();
         vehicule.CODE_VEHICULE = (decimal)(bsVehicule.Current as DataRowView)["CODE_VEHICULE"];
         CHM_CLIENT_APP.CHMGC.RESULT_QUERY res = new CHM_CLIENT_APP.CHMGC.RESULT_QUERY();
         res = CLIENT_APP_PARAM.gcws.effaceVEHICULE(vehicule);
         if (res.OK)
         {
             try
             {
                 chargerVehicule();
             }
             catch (Exception er)
             {
                 MessageBox.Show(er.Message, this.Text);
             }
         }
         else
         {
             MessageBox.Show(res.MESSAGE, this.Text);
         }
     }
 }
Esempio n. 2
0
        private void btn_supp_clt_Click(object sender, EventArgs e)
        {
            DataRowView drv = (DataRowView)srcb.Current;
            //DataTable dt1 = CLIENT_APP_PARAM.GEST.P_CLIENT.select_b_liv_client(drv["CODE_CLIENT"].ToString());
            DataTable dt1 = CLIENT_APP_PARAM.gcws.select_b_liv_client(drv["CODE_CLIENT"].ToString());
            //DataTable dt2 = CLIENT_APP_PARAM.GEST.P_CLIENT.SELECT_COMMANDE_CLIENT(drv["CODE_CLIENT"].ToString());
            DataTable dt2 = CLIENT_APP_PARAM.gcws.SELECT_COMMANDE_CLIENT(drv["CODE_CLIENT"].ToString());
            //DataTable dt3 = CLIENT_APP_PARAM.GEST.P_CLIENT.select_facture(drv["CODE_CLIENT"].ToString());
            DataTable dt3 = CLIENT_APP_PARAM.gcws.select_facture(drv["CODE_CLIENT"].ToString());

            if (dt1.Rows.Count > 0 || dt2.Rows.Count > 0 || dt3.Rows.Count > 0)
            {
                MessageBox.Show("Vous ne pouvez pas supprimer ce client.");
            }
            else
            {
                //CHM_GESTION_COMERCIALE.RESULT_QUERY res = new CHM_GESTION_COMERCIALE.RESULT_QUERY();
                CHMGC.RESULT_QUERY res = new CHM_CLIENT_APP.CHMGC.RESULT_QUERY();
                if (srcb.Current != null)
                {
                    if (MessageBox.Show("Etes vous sûres de supprimer ce client?", "Cofirmation de suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes && compte == false)
                    {
                        try
                        {
                            //res = CLIENT_APP_PARAM.GEST.P_CLIENT.DELETE_CLIENT(drv["CODE_CLIENT"].ToString());
                            res = CLIENT_APP_PARAM.gcws.DELETE_CLIENT(drv["CODE_CLIENT"].ToString());
                            if (res.OK)
                            {
                                srcb.RemoveCurrent();
                                dt.AcceptChanges();
                            }
                            else
                            {
                                MessageBox.Show(res.MESSAGE, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        catch (Exception er)
                        {
                            MessageBox.Show(er.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (srcb.Current != null)
     {
         DataRowView drv = (DataRowView)srcb.Current;
         if ((bool)drv["COMPTE"] != true)
         {
             try
             {
                 //CHM_GESTION_COMERCIALE.RESULT_QUERY res = new CHM_GESTION_COMERCIALE.RESULT_QUERY();
                 CHMGC.RESULT_QUERY res = new CHM_CLIENT_APP.CHMGC.RESULT_QUERY();
                 //res = CLIENT_APP_PARAM.GEST.P_COMPTE_CLIENT.CREER_COMPTE_CLIENT(drv["CODE_CLIENT"].ToString());
                 res = CLIENT_APP_PARAM.gcws.CREER_COMPTE_CLIENT(drv["CODE_CLIENT"].ToString());
                 if (res.OK)
                 {
                     MessageBox.Show(res.MESSAGE, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     //CLIENT_APP_PARAM.GEST.P_CLIENT.UPDATE_ETAT_COMPTE(drv["CODE_CLIENT"].ToString());
                     CLIENT_APP_PARAM.gcws.UPDATE_ETAT_COMPTE(drv["CODE_CLIENT"].ToString());
                     CHM_COMPTE_CREDIT_CLIENT fenetre = new CHM_COMPTE_CREDIT_CLIENT(drv["CODE_CLIENT"].ToString());
                     fenetre.Show();
                 }
                 else
                 {
                     MessageBox.Show(res.MESSAGE, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             catch (Exception er)
             {
                 MessageBox.Show(er.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             CHM_COMPTE_CREDIT_CLIENT fenetre = new CHM_COMPTE_CREDIT_CLIENT(drv["CODE_CLIENT"].ToString());
             fenetre.Show();
         }
     }
 }
Esempio n. 4
0
        private void CHM_REGLEMENT_CLIENT_Shown(object sender, EventArgs e)
        {
            if (CODE_FACT != "-1")
            {
                try
                {
                    //dt_facture = CLIENT_APP_PARAM.GEST.P_FACTURE.LOAD_FACTURE_PAR_CODE(CODE_FACT);
                    dt_facture            = CLIENT_APP_PARAM.gcws.LOAD_FACTURE_PAR_CODE(CODE_FACT);
                    bs_facture.DataSource = dt_facture;


                    DataRowView drv_facture = (DataRowView)bs_facture.Current;
                    CODE_CLIENT       = drv_facture["CODE_CLIENT"].ToString();
                    NP.Value          = (decimal)drv_facture["CREDIT"];
                    CODE_FACTURE.Text = drv_facture["CODE_FACTURE"].ToString();
                    //dt_clt = CLIENT_APP_PARAM.GEST.P_FACTURE.LOAD_CLIENT_FACTURE(CODE_CLIENT);
                    dt_clt            = CLIENT_APP_PARAM.gcws.LOAD_CLIENT_FACTURE(CODE_CLIENT);
                    bs_clt.DataSource = dt_clt;


                    DataRowView drv_clt = (DataRowView)bs_clt.Current;
                    RS_CLIENT.Text = drv_clt["RS_CLIENT"].ToString();
                    if (bs_clt.Current != null)
                    {
                        if ((bool)drv_clt["COMPTE"] != true)
                        {
                            try
                            {
                                //CHM_GESTION_COMERCIALE.RESULT_QUERY res = new CHM_GESTION_COMERCIALE.RESULT_QUERY();
                                CHMGC.RESULT_QUERY res = new CHM_CLIENT_APP.CHMGC.RESULT_QUERY();
                                //res = CLIENT_APP_PARAM.GEST.P_COMPTE_CLIENT.CREER_COMPTE_CLIENT(drv_clt["CODE_CLIENT"].ToString());
                                res = CLIENT_APP_PARAM.gcws.CREER_COMPTE_CLIENT(drv_clt["CODE_CLIENT"].ToString());
                                if (res.OK)
                                {
                                    MessageBox.Show(res.MESSAGE, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    //CLIENT_APP_PARAM.GEST.P_CLIENT.UPDATE_ETAT_COMPTE(drv_clt["CODE_CLIENT"].ToString());
                                    CLIENT_APP_PARAM.gcws.UPDATE_ETAT_COMPTE(drv_clt["CODE_CLIENT"].ToString());
                                    CHM_COMPTE_CREDIT_CLIENT fenetre = new CHM_COMPTE_CREDIT_CLIENT(drv_clt["CODE_CLIENT"].ToString());
                                    fenetre.Show();
                                }
                                else
                                {
                                    MessageBox.Show(res.MESSAGE, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                            catch (Exception er)
                            {
                                MessageBox.Show(er.Message, "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                    //dt_compte = CLIENT_APP_PARAM.GEST.P_COMPTE_CLIENT.LOAD_COMPTE_CLIENT(drv_clt["CODE_CLIENT"].ToString());
                    dt_compte            = CLIENT_APP_PARAM.gcws.LOAD_COMPTE_CLIENT(drv_clt["CODE_CLIENT"].ToString());
                    bs_compte.DataSource = dt_compte;
                    DataRowView drv_compte = (DataRowView)bs_compte.Current;
                    NUM_COMPTE_CLIENT.Text = drv_compte["NUM_COMPTE_CLIENT"].ToString();
                }
                catch (Exception er)
                {
                    MessageBox.Show(er.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region Test
            errorProvider1.SetError(MODE_REG, "");
            if (MODE_REG.Text == "")
            {
                MODE_REG.Focus();
                errorProvider1.SetError(MODE_REG, "Vous devez choisir mode de règlement !");

                return;
            }
            errorProvider1.Clear();

            errorProvider1.SetError(NUM_PIECE, "");
            if ((MODE_REG.SelectedText == "Chèque Õß" || MODE_REG.SelectedText == "Carte bancaire ßÑÊ ÈäßíÉ") && NUM_PIECE.Text == "")
            {
                NUM_PIECE.Focus();
                errorProvider1.SetError(MODE_REG, "You should enter the paper or the card code number!");

                return;
            }
            errorProvider1.Clear();

            errorProvider1.SetError(BANQUE_CLIENT, "");
            if ((MODE_REG.SelectedText == "Chèque Õß" || MODE_REG.SelectedText == "Carte bancaire ßÑÊ ÈäßíÉ") && NUM_PIECE.Text == "")
            {
                BANQUE_CLIENT.Focus();
                errorProvider1.SetError(BANQUE_CLIENT, "Vous devez entrer la banque du client !");

                return;
            }
            errorProvider1.Clear();

            errorProvider1.SetError(MONTANT_PAYE, "");
            if (Convert.ToDecimal(MONTANT_PAYE.EditValue) == 0)
            {
                MONTANT_PAYE.Focus();
                errorProvider1.SetError(MONTANT_PAYE, "Vous devez entrer le montant payé !");

                return;
            }
            errorProvider1.Clear();

            errorProvider1.SetError(CODE_FACTURE, "");
            if (CODE_FACTURE.Text == "")
            {
                CODE_FACTURE.Focus();
                errorProvider1.SetError(CODE_FACTURE, "Vous devez entrer le montant payé !");

                return;
            }
            errorProvider1.Clear();

            errorProvider1.SetError(RS_CLIENT, "");
            if (RS_CLIENT.Text == "")
            {
                RS_CLIENT.Focus();
                errorProvider1.SetError(RS_CLIENT, "You should select the client !\n íÌÈ ÇÎÊíÇÑ ÇáÒÈæä");

                return;
            }
            errorProvider1.Clear();
            #endregion
            this.Cursor = Cursors.WaitCursor;
            try
            {
                //CHM_GESTION_COMERCIALE.RESULT_QUERY res1 = new CHM_GESTION_COMERCIALE.RESULT_QUERY();
                //CHMGC.RESULT_QUERY res1 = new CHM_CLIENT_APP.CHMGC.RESULT_QUERY();
                ////res1 = CLIENT_APP_PARAM.GEST.P_FACTURE.UPDATE_ETAT_FACTURE(CODE_FACTURE.Text, MONTANT_PAYE.Value.ToString());
                //res1 = CLIENT_APP_PARAM.gcws.UPDATE_ETAT_FACTURE(CODE_FACTURE.Text,Convert.ToDecimal( MONTANT_PAYE.EditValue));
                //if (res1.OK)
                //{
                //    MessageBox.Show(res1.MESSAGE, "Modification de facture.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //}
                //else
                //{
                //    MessageBox.Show(res1.MESSAGE, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //}
                //OBSERVATION.Text = res1.MESSAGE;
                //CHM_GESTION_COMERCIALE.RESULT_QUERY res = new CHM_GESTION_COMERCIALE.RESULT_QUERY();
                CHMGC.RESULT_QUERY res = new CHM_CLIENT_APP.CHMGC.RESULT_QUERY();
                //res = CLIENT_APP_PARAM.GEST.P_REGLEMENT.INSERT_REGLEMENT(CODE_FACTURE.Text, DATE.Value, MODE_REG.SelectedItem.ToString(), MONTANT_PAYE.Value.ToString(), NUM_PIECE.Text, BANQUE_CLIENT.Text, OBSERVATION.Text, CODE_CLIENT);
                res = CLIENT_APP_PARAM.gcws.INSERT_REGLEMENT(CODE_FACTURE.Text, DATE.Value, MODE_REG.SelectedItem.ToString(), Convert.ToDecimal(MONTANT_PAYE.EditValue), NUM_PIECE.Text, BANQUE_CLIENT.Text, OBSERVATION.Text, CODE_CLIENT, CODE_COMPTE);
                if (res.OK)
                {
                    MessageBox.Show(res.MESSAGE, "Reglement", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(res.MESSAGE, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                //CLIENT_APP_PARAM.GEST.P_COMPTE_CLIENT.UPDATE_COMPTE_CLIENT(CODE_COMPTE, MONTANT_PAYE.Value);
                //CLIENT_APP_PARAM.gcws.UPDATE_COMPTE_CLIENT(CODE_COMPTE, MONTANT_PAYE.Value);
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message, "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }