public CHM_REGLEMENT_CLIENT(string CODE_FACTURE) { InitializeComponent(); this.RightToLeft = RightToLeft.No; this.CODE_FACT = CODE_FACTURE; NUM_PIECE.Enabled = false; BANQUE_CLIENT.Enabled = false; RS_CLIENT.Focus(); entete_Formulaire_21.btn_refresh.Visible = false; }
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; } }