private void dtgvDetalle_CellContentClick(object sender, DataGridViewCellEventArgs e) { int valorItemNumero = 0; DataRow MyFila = null; FormFacturaEditItem frmEdit = new FormFacturaEditItem(); int index = 0; try { var senderGrid = (DataGridView)sender; if (e.RowIndex >= 0) { //TODO - Button Clicked - Execute Code Here index = senderGrid.CurrentRow.Index; valorItemNumero = int.Parse(senderGrid["ItemNumero", index].Value.ToString()); if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn) { EliminarLineaDetalleTemp(); if (dtgvDetalle.RowCount - 1 >= index) { dtgvDetalle.CurrentCell = dtgvDetalle["clnEliminar", index]; } else if (dtgvDetalle.RowCount > 0) { index = dtgvDetalle.RowCount - 1; dtgvDetalle.CurrentCell = dtgvDetalle["clnEliminar", index]; } } else if (senderGrid.Columns[e.ColumnIndex] is DataGridViewLinkColumn) { MyFila = DTDetalle.Select("ItemNumero = " + valorItemNumero.ToString())[0]; frmEdit.MyFila = MyFila; frmEdit.ShowDialog(); if (frmEdit.lOK) { if (ActualizarDetalleFormRow(MyFila, "ItemNumero")) { TotalizarDetalle(); } else { MyFila.RejectChanges(); } } } } } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } }
void editarCantidadPrecio(int itemNumero = 0) { DataRow fila0 = null; int index = 0; string tipo = "P"; FormFacturaEditItem frmEdit = new FormFacturaEditItem(); try { if (itemNumero <= 0) { if (DataGridDetalle == null) { return; } if (DataGridDetalle.RowCount <= 0) { return; } index = DataGridDetalle.CurrentRow.Index; itemNumero = int.Parse(DataGridDetalle["ItemNumero", index].Value.ToString()); } fila0 = DTDetalle.Select("ItemNumero = " + itemNumero.ToString())[0]; tipo = objUtil.GetAsString("Tipo", fila0, "P"); if (tipo != "NC") { frmEdit.MyFila = fila0; frmEdit.ShowDialog(); if (frmEdit.lOK) { if (ActualizarDetalleFormRow(fila0, "ItemNumero")) { TotalizarDetalle(); } else { fila0.RejectChanges(); } } } } catch (Exception ex) { objUtil.MostrarMensajeError(ex.Message); } }