private void DgvDelivery_CellContentClick(object sender, DataGridViewCellEventArgs e) { DataGridView DetectarTipoCasilla = (DataGridView)sender; if (DetectarTipoCasilla.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { string InformacionDelError = string.Empty; ClsPedidos Pedidos = new ClsPedidos(); Pedido InformacionDelPedido = new Pedido(); InformacionDelPedido = Pedidos.LeerPorNumero((int)dgvDelivery.Rows[e.RowIndex].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value, ref InformacionDelError); if (InformacionDelPedido != null) { using (FrmPedidosPorMesa FormPedidosPorMesa = new FrmPedidosPorMesa((int)dgvDelivery.Rows[e.RowIndex].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value, InformacionDelPedido.ID_Chef, new FrmCrearEditarDelivery())) { if (InformacionDelPedido.Delivery.ID_EstadoDelivery != (int)ClsEstadosDeliveries.EEstadosDeliveries.EnCocina) { FormPedidosPorMesa.BloquearPorDeliveryEntregado(); } FormPedidosPorMesa.ShowDialog(); } } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Ocurrio un fallo al buscar el delivery"); MessageBox.Show($"Ocurrio un fallo al buscar el chef", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Ocurrio un fallo al buscar el delivery"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } if (DetectarTipoCasilla.Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn && e.RowIndex >= 0) { // invierto el estado del check seleccionado debido a que no se actualiza en el momento de marcarlo. if (dgvDelivery.Rows[e.RowIndex].Cells[(int)ENumColDGVDelivery.Seleccionar].Value != null) { if (!(bool)dgvDelivery.Rows[e.RowIndex].Cells[(int)ENumColDGVDelivery.Seleccionar].Value && e.RowIndex != UltimaFilaSeleccionada) { ClsColores.MarcarFilaDGV(dgvDelivery, e.RowIndex, true); } else { ClsColores.MarcarFilaDGV(dgvDelivery, e.RowIndex, false); } } UltimaFilaSeleccionada = e.RowIndex; } }
private void BtnVerEditarPedido_Click(object sender, EventArgs e) { using (FrmPedidosPorMesa FormPedidosPorMesa = new FrmPedidosPorMesa(ID_Pedido, ID_Chef, this)) { if (ID_Pedido == -1) { ID_Articulos.Clear(); CantidadPorArticulo.Clear(); } FormPedidosPorMesa.ShowDialog(); } }