private void ActualizarNota() { if (ID_Pedido != -1) { string InformacionDelError = string.Empty; ClsPedidos Pedidos = new ClsPedidos(); Pedido ActualizarNota = new Pedido(); ActualizarNota = Pedidos.LeerPorNumero(ID_Pedido, ref InformacionDelError); if (ActualizarNota != null) { ActualizarNota.Nota = txtNotaPedido.Text; if (Pedidos.Actualizar(ActualizarNota, ref InformacionDelError) != 0) { } else if (InformacionDelError != string.Empty) { MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (InformacionDelError == string.Empty) { MessageBox.Show($"Error al leer el pedido", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { FormCrearEditarDelivery.S_NotaPedido = txtNotaPedido.Text; } }
private void BtnPedidoTerminado_Click(object sender, EventArgs e) { tmrActualizaPedidos.Stop(); int TotalDeFilas = dgvListaPedidos.Rows.Count; string InformacionDelError = string.Empty; ClsDetalles Detalles = new ClsDetalles(); ClsPedidos Pedidos = new ClsPedidos(); Pedido ActualizarPedido = new ClsPedidos(); ClsDeliveries Delivery = new ClsDeliveries(); Delivery ActualizarDelivery = new Delivery(); for (int Indice = 0; Indice < TotalDeFilas; Indice++) { //Pregunto si la celda es diferente a null if (dgvListaPedidos.Rows[Indice].Cells[(int)ENumColDGVListaPedidos.Seleccionar].Value != null) { //Casteo el check del objeto a booleano y pregunto si es true if ((bool)dgvListaPedidos.Rows[Indice].Cells[(int)ENumColDGVListaPedidos.Seleccionar].Value) { InformacionDelError = string.Empty; List <Detalle> ActualizarDetalle = Detalles.LeerListado((int)dgvListaPedidos.Rows[Indice].Cells[(int)ENumColDGVListaPedidos.ID_Pedido].Value, ClsDetalles.ETipoDeListado.ParaCocina, ref InformacionDelError); ActualizarPedido = Pedidos.LeerPorNumero((int)dgvListaPedidos.Rows[Indice].Cells[(int)ENumColDGVListaPedidos.ID_Pedido].Value, ref InformacionDelError); if (ActualizarDetalle != null && ActualizarPedido != null) { if (ActualizarPedido.ID_EstadoPedido == (int)ClsEstadosPedidos.EEstadosPedidos.EnProceso) { foreach (Detalle Elemento in ActualizarDetalle) { if (Elemento.ID_EstadoDetalle == (int)ClsEstadoDetalle.EEstadoDetalle.CantidadAumentada) { Elemento.Cantidad += Elemento.CantidadAgregada; Elemento.CantidadAgregada = 0; } Elemento.ID_EstadoDetalle = (int)ClsEstadoDetalle.EEstadoDetalle.YaCocinado; if (Detalles.Actualizar(Elemento, ref InformacionDelError) != 0) { dgvPlatosPorMesa.Rows.Clear(); lblDetallesDelPedido.Text = string.Empty; } else if (InformacionDelError != string.Empty) { MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } if (ActualizarPedido.ID_Delivery == null) { ActualizarPedido.TiempoEspera = null; } if (ActualizarPedido.ID_Delivery == null) { ActualizarPedido.ID_EstadoPedido = (int)ClsEstadosPedidos.EEstadosPedidos.ParaEntrega; } else { ActualizarPedido.ID_EstadoPedido = (int)ClsEstadosPedidos.EEstadosPedidos.Entregado; ActualizarDelivery = Delivery.LeerPorNumero(ActualizarPedido.ID_Delivery, ref InformacionDelError); if (ActualizarDelivery != null) { ActualizarDelivery.ID_EstadoDelivery = (int)ClsEstadosDeliveries.EEstadosDeliveries.ParaEntrega; if (Delivery.Actualizar(ActualizarDelivery, ref InformacionDelError) != 0) { FrmPrincipal.ObtenerInstancia().S_tslResultadoOperacion = "Delivery actualizado con exito"; } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al actualizar el delivery"); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al actualizar el delivery"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al actualizar el delivery"); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al actualizar el delivery"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } if (Pedidos.Actualizar(ActualizarPedido, ref InformacionDelError) != 0) { if (ActualizarPedido.ID_Delivery != null && ckbImprimirTicketDelivery.Checked) { ID_PedidoImprimir = ActualizarPedido.ID_Pedido; PtdImprimirTicket = new PrintDocument(); if (ClsComprobarEstadoImpresora.ComprobarEstadoImpresora(PtdImprimirTicket.PrinterSettings.PrinterName)) { PtdImprimirTicket.PrintPage += PrintPageEventHandler; PtdImprimirTicket.Print(); } ID_PedidoImprimir = -1; } PedidosSeleccionados.RemoveAll(I => I == (int)dgvListaPedidos.Rows[Indice].Cells[(int)ENumColDGVListaPedidos.ID_Pedido].Value); lblMostrarNumeroPedido.Text = string.Empty; dgvPlatosPorMesa.Rows.Clear(); dgvListaPedidos.Rows.Remove(dgvListaPedidos.Rows[Indice]); Indice -= 1; TotalDeFilas -= 1; FrmPrincipal.ObtenerInstancia().S_tslResultadoOperacion = "Pedido actualizado"; } else if (InformacionDelError != string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al actualizar el pedido"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { using (FrmInformacion FormInformacion = new FrmInformacion($"El pedido numero {ActualizarPedido.ID_Pedido}, no se indico como cocinado debido a " + $"que fue retirado de la lista desde otra computadora y no llego a quitarse de esta al momento de indicarlo como terminado. " + $"El pedido sera retirado de la lista al cerrar este mensaje (no se indicara como cocinado).", ClsColores.Blanco, 200, 400)) { FormInformacion.ShowDialog(); } lblMostrarNumeroPedido.Text = string.Empty; dgvPlatosPorMesa.Rows.Clear(); dgvListaPedidos.Rows.Remove(dgvListaPedidos.Rows[Indice]); Indice -= 1; TotalDeFilas -= 1; } } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al actualizar el pedido"); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al actualizar el pedido"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } dgvListaPedidos.ClearSelection(); tmrActualizaPedidos.Start(); }
private void BtnGuardarCambios_Click(object sender, EventArgs e) { // Validar los datos. bool DatosValidos = true; string RegistroDeErrores = string.Empty; int AnchoFormInformacion = 100; if (ID_Cliente == -1) { DatosValidos = false; RegistroDeErrores += "Debe ingresar un cliente.\r\n\r\n"; AnchoFormInformacion += 50; } if (!ckbRetiraEnElLocal.Checked && txtDireccion.Text.Length < 6) { DatosValidos = false; RegistroDeErrores += "Debe ingresar un minimo de 6 caracteres en la direccion.\r\n\r\n"; AnchoFormInformacion += 50; } if (cmbNombreChef.SelectedItem != null) { ID_Chef = ((Usuario)cmbNombreChef.SelectedItem).ID_Usuario; } else { DatosValidos = false; RegistroDeErrores += "Debe ingresar un chef a cargo del pedido.\r\n\r\n"; AnchoFormInformacion += 50; } if (DatosValidos) { txtDireccion.Text = txtDireccion.Text.Substring(0, 1).ToUpper() + txtDireccion.Text.Remove(0, 1).ToLower(); string InformacionDelError = string.Empty; ClsDeliveries Deliveries = new ClsDeliveries(); Delivery GuardarCambiosDelivery = new Delivery(); ClsPedidos Pedidos = new ClsPedidos(); Pedido GuardarCambioPedido = new Pedido(); GuardarCambioPedido = Pedidos.LeerPorNumero(ID_Pedido, ref InformacionDelError); if (GuardarCambioPedido != null && GuardarCambioPedido.ID_Delivery != null) { GuardarCambiosDelivery = Deliveries.LeerPorNumero(GuardarCambioPedido.ID_Delivery, ref InformacionDelError); if (GuardarCambiosDelivery != null) { GuardarCambioPedido.ID_Cliente = ID_Cliente; GuardarCambioPedido.ID_Chef = ID_Chef; Pedidos.Actualizar(GuardarCambioPedido, ref InformacionDelError); if (txtTelefonoCadete.Text == string.Empty) { GuardarCambiosDelivery.Telefono = null; } else { GuardarCambiosDelivery.Telefono = Convert.ToInt64(txtTelefonoCadete.Text); } if (ckbRetiraEnElLocal.Checked) { GuardarCambiosDelivery.Destino = null; } else { GuardarCambiosDelivery.Destino = txtDireccion.Text; } Deliveries.Actualizar(GuardarCambiosDelivery, ref InformacionDelError); Close(); } else if (InformacionDelError == string.Empty) { MessageBox.Show("Ocurrio un fallo al buscar el delivery", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (InformacionDelError == string.Empty) { MessageBox.Show("Ocurrio un fallo al buscar el pedido", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { using (FrmInformacion FormInformacion = new FrmInformacion(RegistroDeErrores, ClsColores.Blanco, AnchoFormInformacion, 300)) { FormInformacion.ShowDialog(); } } }
private void BtnDeliveryEntregado_Click(object sender, EventArgs e) { using (FrmValidarUsuario FormValidarUsuario = new FrmValidarUsuario(FrmValidarUsuario.EFiltroUsuariosAutorizados.Todos)) { FormValidarUsuario.ShowDialog(); if (FormValidarUsuario.DialogResult == DialogResult.OK) { int TotalDeFilas = dgvDelivery.Rows.Count; for (int Indice = 0; Indice < TotalDeFilas; Indice++) { //Pregunto si la celda es diferente a null if (dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.Seleccionar].Value != null) { //Casteo el check del objeto a booleano y pregunto si es true if ((bool)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.Seleccionar].Value) { string InformacionDelError = string.Empty; ClsPedidos Pedidos = new ClsPedidos(); Pedido VerDelivery = Pedidos.LeerPorNumero((int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Delivery].Value, ref InformacionDelError); ClsDetalles Detalles = new ClsDetalles(); if (VerDelivery != null) { if (VerDelivery.Delivery.ID_EstadoDelivery == (int)ClsEstadosDeliveries.EEstadosDeliveries.ParaEntrega) { using (FrmResumenPedido FormResumenDePedido = new FrmResumenPedido((int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value, FormValidarUsuario.G_ID_UsuarioQueValido)) { FormResumenDePedido.ShowDialog(); if (FormResumenDePedido.DialogResult == DialogResult.OK) { int TotalDelPedido = 0; List <Detalle> CalcularTotal = Detalles.LeerListado((int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value, ClsDetalles.ETipoDeListado.PorIDPedido, ref InformacionDelError); if (CalcularTotal != null) { foreach (Detalle Elemento in CalcularTotal) { TotalDelPedido += Convert.ToInt32(Elemento.Cantidad * Elemento.Articulo.Precio); } VerDelivery.TotalPedido = TotalDelPedido; } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Error al intentar calcular el total del pedido"); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Error al intentar calcular el total del pedido"); MessageBox.Show($"Error al intentar calcular el total del pedido {(int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value}: {InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } VerDelivery.ID_EstadoPedido = (int)ClsEstadosPedidos.EEstadosPedidos.Finalizado; VerDelivery.TiempoEspera = null; if (Pedidos.Actualizar(VerDelivery, ref InformacionDelError) != 0) { FrmPrincipal.ObtenerInstancia().S_tslResultadoOperacion = "Pedido y delivery finalizado"; ClsDeliveries Deliveries = new ClsDeliveries(); Delivery ActualizarDelivery = new Delivery(); ActualizarDelivery = Deliveries.LeerPorNumero(VerDelivery.Delivery.ID_Delivery, ref InformacionDelError); ActualizarDelivery.ID_EstadoDelivery = (int)ClsEstadosDeliveries.EEstadosDeliveries.Entregado; Deliveries.Actualizar(ActualizarDelivery, ref InformacionDelError); dgvDelivery.Rows.Remove(dgvDelivery.Rows[Indice]); Indice -= 1; TotalDeFilas -= 1; } else if (InformacionDelError != string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al finalizar el delivery"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } else { using (FrmInformacion FormInformacion = new FrmInformacion($"No puede editar o eliminar el delivery de {VerDelivery.Cliente.Nombre} {VerDelivery.Cliente.Apellido} " + $"porque ya fue confirmado su estado (eliminado, entregado, etc) o este todavia se encuentra en cocina.", ClsColores.Blanco, 250, 300)) { FormInformacion.ShowDialog(); } } } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al buscar platos sin cocinar"); MessageBox.Show("Ocurrio un fallo al buscar platos sin cocinar", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al buscar platos sin cocinar"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } } } }
private void BtnDeliveryNoRecibido_Click(object sender, EventArgs e) { FrmRespuesta FormRespuesta = new FrmRespuesta($"¿Esta seguro que quiere marcar el pedido del delivery como 'Fallido'? Si selecciona 'si', " + $"se creara un registro del mismo como perdida en caja", FrmRespuesta.ETamaño.Mediano, FrmRespuesta.ETipo.Si_No); if (FormRespuesta.DialogResult == DialogResult.Yes) { int TotalDeFilas = dgvDelivery.Rows.Count; ClsPedidos Pedidos = new ClsPedidos(); Pedido VerDelivery = new Pedido(); ClsDeliveries Deliveries = new ClsDeliveries(); Delivery ActualizarDelivery = null; ClsCajas Cajas = new ClsCajas(); Caja CrearRegistro = null; ClsDetalles Detalle = new ClsDetalles(); List <Detalle> CalcularPerdida = new List <Detalle>(); using (FrmValidarUsuario FormValidarUsuario = new FrmValidarUsuario(FrmValidarUsuario.EFiltroUsuariosAutorizados.Todos)) { FormValidarUsuario.ShowDialog(); if (FormValidarUsuario.DialogResult == DialogResult.OK) { for (int Indice = 0; Indice < TotalDeFilas; Indice++) { //Pregunto si la celda es diferente a null if (dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.Seleccionar].Value != null) { //Casteo el check del objeto a booleano y pregunto si es true if ((bool)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.Seleccionar].Value) { string InformacionDelError = string.Empty; ClsDetalles Detalles = new ClsDetalles(); List <Detalle> BuscarArticuloSinCocinar = Detalles.LeerListado((int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value, (int)ClsDetalles.ETipoDeListado.PorIDPedido, ref InformacionDelError); bool FaltanCocinar = false; if (BuscarArticuloSinCocinar != null) { foreach (Detalle Elemento in BuscarArticuloSinCocinar) { if (Elemento.ID_EstadoDetalle == (int)ClsEstadoDetalle.EEstadoDetalle.NoCocinado) { FaltanCocinar = true; break; } } VerDelivery = Pedidos.LeerPorNumero((int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value, ref InformacionDelError); if (VerDelivery != null) { if (!FaltanCocinar) { double TotalPerdido = 0; CalcularPerdida = Detalle.LeerListado((int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value, ClsDetalles.ETipoDeListado.PorIDPedido, ref InformacionDelError); foreach (Detalle Elemento in CalcularPerdida) { if (Elemento.Articulo.PrecioDelivery != null) { TotalPerdido += Elemento.Cantidad * (double)Elemento.Articulo.PrecioDelivery; } } if (VerDelivery.Delivery.ID_EstadoDelivery == (int)ClsEstadosDeliveries.EEstadosDeliveries.ParaEntrega) { ActualizarDelivery = Deliveries.LeerPorNumero(VerDelivery.Delivery.ID_Delivery, ref InformacionDelError); ActualizarDelivery.ID_EstadoDelivery = (int)ClsEstadosDeliveries.EEstadosDeliveries.NoEntregado; Deliveries.Actualizar(ActualizarDelivery, ref InformacionDelError); VerDelivery.ID_EstadoPedido = (int)ClsEstadosPedidos.EEstadosPedidos.Finalizado; VerDelivery.TiempoEspera = null; int TotalDelPedido = 0; List <Detalle> CalcularTotal = Detalles.LeerListado((int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value, ClsDetalles.ETipoDeListado.PorIDPedido, ref InformacionDelError); if (CalcularTotal != null) { foreach (Detalle Elemento in CalcularTotal) { TotalDelPedido += Convert.ToInt32(Elemento.Cantidad * Elemento.Articulo.Precio); } VerDelivery.TotalPedido = TotalDelPedido; } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Error al intentar calcular el total del pedido"); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Error al intentar calcular el total del pedido"); MessageBox.Show($"Error al intentar calcular el total del pedido {(int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value}: {InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (Pedidos.Actualizar(VerDelivery, ref InformacionDelError) != 0) { FrmPrincipal.ObtenerInstancia().S_tslResultadoOperacion = "Pedido y delivery actualizado"; CrearRegistro = new Caja(); CrearRegistro.ID_Usuario = FormValidarUsuario.G_ID_UsuarioQueValido; CrearRegistro.Fecha = DateTime.Today.Date; CrearRegistro.Hora = TimeSpan.Parse(DateTime.Now.ToString(@"HH\:mm\:ss")); CrearRegistro.Monto = TotalPerdido; CrearRegistro.Detalle = "Perdida por delivery no entregado"; CrearRegistro.ID_Pedido = VerDelivery.ID_Pedido; CrearRegistro.ID_TipoDeMonto = (int)ClsTiposDeMontos.ETiposDeMontos.EgresoDelivery; CrearRegistro.ID_EstadoCaja = (int)ClsEstadosCajas.EEstadosCajas.Activo; if (Cajas.Crear(CrearRegistro, ref InformacionDelError) != 0) { dgvDelivery.Rows.Remove(dgvDelivery.Rows[Indice]); Indice -= 1; TotalDeFilas -= 1; } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al crear el registro de perdida en caja"); MessageBox.Show($"Fallo al crear el registro de perdida en caja", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al crear el registro de perdida en caja"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (InformacionDelError != string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al marcar el delivery como no recibido"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { using (FrmInformacion FormInformacion = new FrmInformacion($"No puede editar o eliminar el delivery de {VerDelivery.Cliente.Nombre} {VerDelivery.Cliente.Apellido} " + $"porque ya fue confirmado su estado o fue eliminado.", ClsColores.Blanco, 250, 300)) { FormInformacion.ShowDialog(); } } } else { using (FrmInformacion FormInformacion = new FrmInformacion($"No puede marcar como 'No entregado' el delivery de {VerDelivery.Cliente.Nombre} {VerDelivery.Cliente.Apellido} porque falta que " + $"cocina marque los platos del pedido como finalizados (solo se puede marcar esta opcion si " + $"ya fueron cocinados los platos y nadie pago el delivery).", ClsColores.Blanco, 250, 300)) { FormInformacion.ShowDialog(); } } } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al marcar el delivery como no recibido"); MessageBox.Show("Ocurrio un fallo al marcar el delivery como no recibido", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al marcar el delivery como no recibido"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } } } } } }
private void BtnEliminarElementos_Click(object sender, EventArgs e) { int TotalDeFilas = dgvDelivery.Rows.Count; for (int Indice = 0; Indice < TotalDeFilas; Indice++) { //Pregunto si la celda es diferente a null if (dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.Seleccionar].Value != null) { //Casteo el check del objeto a booleano y pregunto si es true if ((bool)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.Seleccionar].Value) { string InformacionDelError = string.Empty; ClsPedidos Pedidos = new ClsPedidos(); Pedido VerDelivery = new Pedido(); VerDelivery = Pedidos.LeerPorNumero((int)dgvDelivery.Rows[Indice].Cells[(int)ENumColDGVDelivery.ID_Pedido].Value, ref InformacionDelError); if (VerDelivery != null) { if (VerDelivery.Delivery.ID_EstadoDelivery == (int)ClsEstadosDeliveries.EEstadosDeliveries.EnCocina) { ClsDeliveries Delivery = new ClsDeliveries(); Delivery ActualizarDelivery = Delivery.LeerPorNumero(VerDelivery.ID_Delivery, ref InformacionDelError); ActualizarDelivery.ID_EstadoDelivery = (int)ClsEstadosDeliveries.EEstadosDeliveries.Eliminado; VerDelivery.ID_EstadoPedido = (int)ClsEstadosPedidos.EEstadosPedidos.Eliminado; VerDelivery.TiempoEspera = null; if (Pedidos.Actualizar(VerDelivery, ref InformacionDelError) != 0) { if (Delivery.Actualizar(ActualizarDelivery, ref InformacionDelError) != 0) { FrmPrincipal.ObtenerInstancia().S_tslResultadoOperacion = "Pedido y delivery eliminado"; dgvDelivery.Rows.Remove(dgvDelivery.Rows[Indice]); Indice -= 1; TotalDeFilas -= 1; } } else if (InformacionDelError != string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al eliminar el delivery"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { using (FrmInformacion FormInformacion = new FrmInformacion($"No puede editar o eliminar el delivery " + $"porque ya fue confirmado su estado o fue eliminado.", ClsColores.Blanco, 250, 300)) { FormInformacion.ShowDialog(); } } } else if (InformacionDelError == string.Empty) { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al eliminar el delivery"); MessageBox.Show("Ocurrio un fallo al eliminar el delivery", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al eliminar el delivery"); MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } }