private void gridView1_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e) { RESULT_QUERY res = new RESULT_QUERY(); GridView grid = sender as GridView; if (grid.IsNewItemRow(e.RowHandle)) { DTVA tva = new DTVA(); tva.TVA_LIBELLE = (e.Row as DataRowView)["TVA_LIBELLE"].ToString(); res = CLIENT_APP_PARAM.gcws.ajouteTVA(tva); if (res.OK) { (e.Row as DataRowView)["CODE_TVA"] = res.CODE; } else { MessageBox.Show(res.MESSAGE, this.Text); } } else { DTVA tva = new DTVA(); tva.TVA_LIBELLE = (e.Row as DataRowView)["TVA_LIBELLE"].ToString(); tva.CODE_TVA = (decimal)((e.Row as DataRowView)["CODE_TVA"]); res = CLIENT_APP_PARAM.gcws.modifieTVA(tva); if (res.OK) { } else { MessageBox.Show(res.MESSAGE, this.Text); } } }
private void gridView1_RowDeleting(object sender, DevExpress.Data.RowDeletingEventArgs e) { RESULT_QUERY res = new RESULT_QUERY(); DTVA tva = new DTVA(); tva.CODE_TVA = Convert.ToDecimal((e.Row as DataRowView)["CODE_TVA"]); try { res = CLIENT_APP_PARAM.gcws.effaceTVA(tva); if (res.OK) { } else { e.Cancel = true; MessageBox.Show(res.MESSAGE, "Erreur los de la suppression", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erreur los de la suppression", MessageBoxButtons.OK, MessageBoxIcon.Error); } }