protected void grillaEntregas_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { ASPxGridView grillaEntregas = sender as ASPxGridView; int codigoEntrega = Convert.ToInt32(e.Keys[0]); int codigoTanda = Convert.ToInt32(grillaEntregas.GetMasterRowKeyValue()); if (ControladorGeneral.ValidarEntregaAEliminar(codigoTanda, codigoEntrega)) { ControladorGeneral.EliminarEntrega(codigoTanda, codigoEntrega); grillaEntregas.JSProperties["cpBorrar"] = "Se borró la entrega correctamente"; e.Cancel = true; CargarGrillaEntregas(grillaEntregas, Convert.ToInt32(grillaEntregas.GetMasterRowKeyValue())); } else { grillaEntregas.JSProperties["cpBorrar"] = "No se puede borrar una entrega cerrada"; e.Cancel = true; } }
protected void btnAceptarEliminarRemito_Click(object sender, EventArgs e) { if (gvEntregas.FocusedRowIndex != -1) { int codigoEntrega = Convert.ToInt32(gvEntregas.GetRowValues(gvEntregas.FocusedRowIndex, "codigoEntrega")); string mensaje = ControladorGeneral.EliminarEntrega(codigoEntrega); pcError.ShowOnPageLoad = true; if (mensaje == "ok") { lblMensaje.Text = "Se ha eliminado correctamente."; pcError.ShowOnPageLoad = true; } else { lblMensaje.Text = "No se permite elimnar el remito ya que está asociado a una factura"; pcError.ShowOnPageLoad = true; } pcConfirmarEliminarRemito.ShowOnPageLoad = false; } }