Example #1
0
        /// <summary>
        /// Carga las mesas que estan en estado ocupado de la mesa que va a editar
        /// </summary>
        private void CargarMesasViejas()
        {
            foreach (int Elemento in MesasEditar)
            {
                string InformacionDelError = string.Empty;

                ClsMesas Mesas             = new ClsMesas();
                Mesa     CargarMesasViejas = Mesas.LeerPorNumero(Elemento, ClsMesas.ETipoDeListado.PorID, ref InformacionDelError);

                if (CargarMesasViejas != null)
                {
                    int NumeroDeFila = dgvCrearMesa.Rows.Add();

                    dgvCrearMesa.Rows[NumeroDeFila].Cells[(int)ENumColDGVMesa.ID_Mesa].Value     = CargarMesasViejas.ID_Mesa;
                    dgvCrearMesa.Rows[NumeroDeFila].Cells[(int)ENumColDGVMesa.Numero].Value      = CargarMesasViejas.Numero;
                    dgvCrearMesa.Rows[NumeroDeFila].Cells[(int)ENumColDGVMesa.Capacidad].Value   = CargarMesasViejas.Capacidad;
                    dgvCrearMesa.Rows[NumeroDeFila].Cells[(int)ENumColDGVMesa.Seleccionar].Value = true;

                    ClsColores.MarcarFilaDGV(dgvCrearMesa, NumeroDeFila, true);

                    lblResultadoCapacidadTotal.Text = Convert.ToString(Convert.ToInt32(lblResultadoCapacidadTotal.Text) + CargarMesasViejas.Capacidad);
                }
                else if (InformacionDelError == string.Empty)
                {
                    MessageBox.Show("Ocurrio un fallo al cargar el filtro de estados", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            dgvCrearMesa.Sort(dgvCrearMesa.Columns[(int)ENumColDGVMesa.Numero], ListSortDirection.Ascending);
        }
        private void dgvEstadoArticulo_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView DetectarTipoCasilla = (DataGridView)sender;

            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 (dgvEstadoArticulo.Rows[e.RowIndex].Cells[(int)ENumColDGVEstadoArticulo.Seleccionar].Value != null)
                {
                    if (!(bool)dgvEstadoArticulo.Rows[e.RowIndex].Cells[(int)ENumColDGVEstadoArticulo.Seleccionar].Value && e.RowIndex != UltimaFilaSeleccionada)
                    {
                        ClsColores.MarcarFilaDGV(dgvEstadoArticulo, e.RowIndex, true);
                    }
                    else
                    {
                        ClsColores.MarcarFilaDGV(dgvEstadoArticulo, e.RowIndex, false);
                    }
                }

                // invierto el estado del check seleccionado debido a que no se actualiza en el momento de marcarlo.
                if (dgvEstadoArticulo.Rows[e.RowIndex].Cells[(int)ENumColDGVEstadoArticulo.Seleccionar].Value != null)
                {
                    if (!(bool)dgvEstadoArticulo.Rows[e.RowIndex].Cells[(int)ENumColDGVEstadoArticulo.Seleccionar].Value && e.RowIndex != UltimaFilaSeleccionada)
                    {
                        ArticulosDeCartaMarcados.Add((int)dgvEstadoArticulo.Rows[e.RowIndex].Cells[(int)ENumColDGVEstadoArticulo.ID_Articulo].Value);
                    }
                    else
                    {
                        ArticulosDeCartaMarcados.RemoveAll(I => I == (int)dgvEstadoArticulo.Rows[e.RowIndex].Cells[(int)ENumColDGVEstadoArticulo.ID_Articulo].Value);
                    }
                }

                UltimaFilaSeleccionada = e.RowIndex;
            }
        }
Example #3
0
        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;
            }
        }
Example #4
0
        private void DesmarcarClientes()
        {
            int TotalDeFilas = dgvListarClientes.Rows.Count;

            ClientesDelPedido.Clear();

            // IndiceArray me mantiene el indice real de asignacion
            for (int Indice = 0; Indice < TotalDeFilas; Indice++)
            {
                dgvListarClientes.Rows[Indice].Cells[(int)ENumColDGVCliente.Seleccionar].Value = false;
                ClsColores.MarcarFilaDGV(dgvListarClientes, Indice, false);
            }

            lblResultadoTotalClientes.Text = "0";
        }
        /// <summary>Carga las categorias activas.</summary>
        private void CargarDGVCategorias(ClsCategoriasArticulos.ETipoListado _TipoDeEstado)
        {
            dgvEstadoCategoria.Rows.Clear();

            string InformacionDelError = string.Empty;

            ClsCategoriasArticulos Categorias = new ClsCategoriasArticulos();

            List <CategoriaArticulo> ListarCategorias = Categorias.LeerListado(_TipoDeEstado, ref InformacionDelError);

            if (ListarCategorias != null)
            {
                foreach (CategoriaArticulo Elemento in ListarCategorias)
                {
                    int NumeroDeFila = dgvEstadoCategoria.Rows.Add();

                    dgvEstadoCategoria.Rows[NumeroDeFila].Cells[(int)ENumColDGVCategorias.ID_Categoria].Value = Elemento.ID_CategoriaArticulo;
                    dgvEstadoCategoria.Rows[NumeroDeFila].Cells[(int)ENumColDGVCategorias.Categoria].Value    = Elemento.Nombre;

                    if (Elemento.ParaCocina == (int)ClsCategoriasArticulos.EParaCocina.Si)
                    {
                        dgvEstadoCategoria.Rows[NumeroDeFila].Cells[(int)ENumColDGVCategorias.SeEnvianCocina].Value = "SI";
                    }
                    else
                    {
                        dgvEstadoCategoria.Rows[NumeroDeFila].Cells[(int)ENumColDGVCategorias.SeEnvianCocina].Value = "NO";
                    }

                    ClsColores.MarcarFilaDGV(dgvEstadoCategoria, NumeroDeFila, false);

                    dgvEstadoCategoria.Rows[NumeroDeFila].Cells[(int)ENumColDGVCategorias.Seleccionar].Value = false;
                }

                FormularioCargado = false;
                CargarCMBCategorias();
                FormularioCargado = true;
            }
            else if (InformacionDelError == string.Empty)
            {
                MessageBox.Show("Fallo al cargar las categorias", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #6
0
        private void DgvListarClientes_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView DetectarTipoCasilla = (DataGridView)sender;

            if (DetectarTipoCasilla.Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn && e.RowIndex >= 0)
            {
                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 (dgvListarClientes.Rows[e.RowIndex].Cells[(int)ENumColDGVCliente.Seleccionar].Value != null)
                    {
                        if (!(bool)dgvListarClientes.Rows[e.RowIndex].Cells[(int)ENumColDGVCliente.Seleccionar].Value && e.RowIndex != UltimaFilaSeleccionada)
                        {
                            ClsColores.MarcarFilaDGV(dgvListarClientes, e.RowIndex, true);
                        }
                        else
                        {
                            ClsColores.MarcarFilaDGV(dgvListarClientes, e.RowIndex, false);
                        }
                    }

                    UltimaFilaSeleccionada = e.RowIndex;
                }

                if (dgvListarClientes.EndEdit())
                {
                    int TotalDeFilas = dgvListarClientes.Rows.Count;

                    // invierto el estado del check seleccionado debido a que no se actualiza en el momento de marcarlo.
                    if (dgvListarClientes.Rows[e.RowIndex].Cells[(int)ENumColDGVCliente.Seleccionar].Value != null)
                    {
                        if ((bool)dgvListarClientes.Rows[e.RowIndex].Cells[(int)ENumColDGVCliente.Seleccionar].Value)
                        {
                            ClientesDelPedido.RemoveAll(I => I == (int)dgvListarClientes.Rows[e.RowIndex].Cells[(int)ENumColDGVCliente.ID_Cliente].Value);
                            ClientesDelPedido.Add((int)dgvListarClientes.Rows[e.RowIndex].Cells[(int)ENumColDGVCliente.ID_Cliente].Value);
                        }
                        else
                        {
                            ClientesDelPedido.RemoveAll(I => I == (int)dgvListarClientes.Rows[e.RowIndex].Cells[(int)ENumColDGVCliente.ID_Cliente].Value);
                        }
                    }

                    lblResultadoTotalClientes.Text = Convert.ToString(ClientesDelPedido.Count);
                }
            }
        }
        private void DgvSeleccionarMesaReserva_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView DetectarCheck = (DataGridView)sender;

            if (DetectarCheck.Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn && e.RowIndex >= 0)
            {
                int TotalDeFilas   = dgvSeleccionarMesaReserva.Rows.Count;
                int CapacidadTotal = 0;

                // invierto el estado del check seleccionado debido a que no se actualiza en el momento de marcarlo.
                if (dgvSeleccionarMesaReserva.Rows[e.RowIndex].Cells[(int)ENumColDGVMesa.Seleccionar].Value != null)
                {
                    if (!(bool)dgvSeleccionarMesaReserva.Rows[e.RowIndex].Cells[(int)ENumColDGVMesa.Seleccionar].Value && e.RowIndex != UltimaFilaSeleccionada)
                    {
                        ClsColores.MarcarFilaDGV(dgvSeleccionarMesaReserva, e.RowIndex, true);
                    }
                    else
                    {
                        ClsColores.MarcarFilaDGV(dgvSeleccionarMesaReserva, e.RowIndex, false);
                    }
                }

                dgvSeleccionarMesaReserva.ClearSelection();
                UltimaFilaSeleccionada = e.RowIndex;

                if (dgvSeleccionarMesaReserva.EndEdit())
                {
                    for (int Indice = 0; Indice < TotalDeFilas; Indice++)
                    {
                        //Pregunto si la celda es diferente a null
                        if (dgvSeleccionarMesaReserva.Rows[Indice].Cells[(int)ENumColDGVMesa.Seleccionar].Value != null)
                        {
                            //Casteo el check del objeto a booleano y pregunto si es true
                            if ((bool)dgvSeleccionarMesaReserva.Rows[Indice].Cells[(int)ENumColDGVMesa.Seleccionar].Value)
                            {
                                CapacidadTotal += (int)dgvSeleccionarMesaReserva.Rows[Indice].Cells[(int)ENumColDGVMesa.Capacidad].Value;
                            }
                        }
                    }

                    lblResultadoCapacidadTotal.Text = Convert.ToString(CapacidadTotal);
                }
            }
        }
        /// <summary>Marca o desmarca los checks en la columna seleccion.</summary>
        /// <param name="_EstadoDelCheck">Si se quiere marcar o desmarcar.</param>
        private void CambiarCheckboxSeleccion(bool _EstadoDelCheck)
        {
            for (int Indice = 0; Indice < dgvCarta.Rows.Count; Indice++)
            {
                dgvCarta.Rows[Indice].Cells[(int)ENumColDGVCarta.Seleccionar].Value = _EstadoDelCheck;

                if (dgvCarta.Rows[Indice].Cells[(int)ENumColDGVCarta.Seleccionar].Value != null)
                {
                    if ((bool)dgvCarta.Rows[Indice].Cells[(int)ENumColDGVCarta.Seleccionar].Value)
                    {
                        ArticulosDeCartaMarcados.Add((int)dgvCarta.Rows[Indice].Cells[(int)ENumColDGVCarta.ID_Articulo].Value);
                        ClsColores.MarcarFilaDGV(dgvCarta, Indice, true);
                    }
                    else
                    {
                        ArticulosDeCartaMarcados.RemoveAll(I => I == (int)dgvCarta.Rows[Indice].Cells[(int)ENumColDGVCarta.ID_Articulo].Value);
                        ClsColores.MarcarFilaDGV(dgvCarta, Indice, false);
                    }
                }
            }
        }
        private void dgvDatosUsuarios_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView DetectarTipoCasilla = (DataGridView)sender;

            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 (dgvDatosUsuarios.Rows[e.RowIndex].Cells[(int)ENumColDGVUsuarios.Seleccionar].Value != null)
                {
                    if (!(bool)dgvDatosUsuarios.Rows[e.RowIndex].Cells[(int)ENumColDGVUsuarios.Seleccionar].Value && e.RowIndex != UltimaFilaSeleccionada)
                    {
                        ClsColores.MarcarFilaDGV(dgvDatosUsuarios, e.RowIndex, true);
                    }
                    else
                    {
                        ClsColores.MarcarFilaDGV(dgvDatosUsuarios, e.RowIndex, false);
                    }
                }

                UltimaFilaSeleccionada = e.RowIndex;
            }
        }
        /// <summary>Carga los articulos activos/inactivos.</summary>
        private void CargarDGVArticulos(ClsArticulos.ETipoListado _TipoDeEstado)
        {
            if (FormularioCargado)
            {
                dgvEstadoArticulo.Rows.Clear();

                string NombreArticulo = string.Empty;

                int ID_CategoriaFiltro = 0;

                if (cmbCategoria.SelectedValue != null)
                {
                    CategoriaArticulo CategoriaSeleccionada = (CategoriaArticulo)cmbCategoria.SelectedItem;
                    ID_CategoriaFiltro = CategoriaSeleccionada.ID_CategoriaArticulo;
                }

                if (txtBuscarPorNombre.Text != TEXTO_VISUAL_COMBOBOX)
                {
                    NombreArticulo = txtBuscarPorNombre.Text;
                }

                string InformacionDelError = string.Empty;

                ClsArticulos Articulos = new ClsArticulos();

                List <Articulo> ListarArticulosActivos = Articulos.LeerListado(ClsArticulos.ETipoListado.Filtro, ref InformacionDelError, _TipoDeEstado, NombreArticulo, ID_CategoriaFiltro);

                if (ListarArticulosActivos != null)
                {
                    foreach (Articulo Elemento in ListarArticulosActivos)
                    {
                        int NumeroDeFila = dgvEstadoArticulo.Rows.Add();

                        dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.ID_Articulo].Value = Elemento.ID_Articulo;
                        dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.Nombre].Value      = Elemento.Nombre;
                        dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.Descripcion].Value = Elemento.Descripcion;
                        dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.Categoria].Value   = Elemento.CategoriaArticulo.Nombre;

                        if (Elemento.Precio == null)
                        {
                            dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.PrecioCarta].Value = "NO TIENE";
                        }
                        else
                        {
                            dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.PrecioCarta].Value = Elemento.Precio;
                        }

                        if (Elemento.PrecioDelivery == null)
                        {
                            dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.PrecioDelivery].Value = "NO TIENE";
                        }
                        else
                        {
                            dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.PrecioDelivery].Value = Elemento.PrecioDelivery;
                        }

                        if (ArticulosDeCartaMarcados.Count > 0)
                        {
                            foreach (int ElementoSecundario in ArticulosDeCartaMarcados)
                            {
                                if (ElementoSecundario == Elemento.ID_Articulo)
                                {
                                    dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.Seleccionar].Value = true;
                                    ClsColores.MarcarFilaDGV(dgvEstadoArticulo, NumeroDeFila, true);
                                    break;
                                }
                                else
                                {
                                    dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.Seleccionar].Value = false;
                                    ClsColores.MarcarFilaDGV(dgvEstadoArticulo, NumeroDeFila, false);
                                }
                            }
                        }
                        else
                        {
                            dgvEstadoArticulo.Rows[NumeroDeFila].Cells[(int)ENumColDGVEstadoArticulo.Seleccionar].Value = false;
                            ClsColores.MarcarFilaDGV(dgvEstadoArticulo, NumeroDeFila, false);
                        }
                    }

                    UltimaFilaSeleccionada = -1;

                    dgvEstadoArticulo.Sort(dgvEstadoArticulo.Columns[(int)ENumColDGVEstadoArticulo.Categoria], ListSortDirection.Ascending);

                    dgvEstadoCategoria.ClearSelection();
                }
                else if (InformacionDelError == string.Empty)
                {
                    MessageBox.Show("Fallo al cargar los articulos", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
        /// <summary>Carga la carta con todos los articulos activos (incluyendo a los que su categoria fue eliminada)</summary>
        private void CargarDGVCarta(ClsArticulos.ETipoListado _TipoDeListado)
        {
            if (FormularioCargado)
            {
                string NombreArticulo = string.Empty;

                int ID_CategoriaFiltro = 0;

                if (cmbCategoria.SelectedValue != null)
                {
                    CategoriaArticulo CategoriaSeleccionada = (CategoriaArticulo)cmbCategoria.SelectedItem;
                    ID_CategoriaFiltro = CategoriaSeleccionada.ID_CategoriaArticulo;
                }

                if (txtBuscarPorNombre.Text != TEXTO_VISUAL_BUSCAR)
                {
                    NombreArticulo = txtBuscarPorNombre.Text;
                }

                dgvCarta.Rows.Clear();

                string InformacionDelError = string.Empty;

                ClsArticulos Articulos = new ClsArticulos();

                List <Articulo> ListarArticulosActivos = Articulos.LeerListado(_TipoDeListado, ref InformacionDelError, ClsArticulos.ETipoListado.ArticulosActivos, NombreArticulo, ID_CategoriaFiltro);

                if (ListarArticulosActivos != null)
                {
                    foreach (Articulo Elemento in ListarArticulosActivos)
                    {
                        int NumeroDeFila = dgvCarta.Rows.Add();

                        dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.ID_Articulo].Value = Elemento.ID_Articulo;
                        dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.Nombre].Value      = Elemento.Nombre;
                        dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.Descripcion].Value = Elemento.Descripcion;
                        dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.Categoria].Value   = Elemento.CategoriaArticulo.Nombre;

                        if (Elemento.Precio == null)
                        {
                            dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.PrecioCarta].Value = "NO TIENE";
                        }
                        else
                        {
                            dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.PrecioCarta].Value = Elemento.Precio;
                        }

                        if (Elemento.PrecioDelivery == null)
                        {
                            dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.PrecioDelivery].Value = "NO TIENE";
                        }
                        else
                        {
                            dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.PrecioDelivery].Value = Elemento.PrecioDelivery;
                        }

                        if (ArticulosDeCartaMarcados.Count > 0)
                        {
                            foreach (int ElementoSecundario in ArticulosDeCartaMarcados)
                            {
                                if (ElementoSecundario == Elemento.ID_Articulo)
                                {
                                    dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.Seleccionar].Value = true;
                                    ClsColores.MarcarFilaDGV(dgvCarta, NumeroDeFila, true);
                                    break;
                                }
                                else
                                {
                                    dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.Seleccionar].Value = false;
                                    ClsColores.MarcarFilaDGV(dgvCarta, NumeroDeFila, false);
                                }
                            }
                        }
                        else
                        {
                            dgvCarta.Rows[NumeroDeFila].Cells[(int)ENumColDGVCarta.Seleccionar].Value = false;
                            ClsColores.MarcarFilaDGV(dgvCarta, NumeroDeFila, false);
                        }
                    }
                }
                else if (InformacionDelError == string.Empty)
                {
                    FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al cargar los articulos");
                    MessageBox.Show($"Ocurrio un fallo al intentar cargar los articulos de la carta",
                                    "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al cargar los articulos");
                    MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            dgvCarta.ClearSelection();
        }
        private void CargarDGVMesasDisponibles(ClsMesasXReservas.EMesasDisponibles _TipoDeFiltro)
        {
            dgvSeleccionarMesaReserva.Rows.Clear();

            lblResultadoCapacidadTotal.Text = "0";

            string InformacionDelError = string.Empty;

            ClsMesasXReservas   MesasXReservas       = new ClsMesasXReservas();
            List <MesaXReserva> ListaMesasReservadas = MesasXReservas.LeerListado(_TipoDeFiltro, ref InformacionDelError, FechaParaReservar.Date);

            ClsMesas    Mesas            = new ClsMesas();
            List <Mesa> MesasDisponibles = null;

            // Trae la lista por planta
            if (_TipoDeFiltro == ClsMesasXReservas.EMesasDisponibles.MesasDisponiblesPB)
            {
                MesasDisponibles = Mesas.LeerListado(ClsMesas.ETipoDeListado.MesasActivasPB, ref InformacionDelError);
            }
            else
            {
                MesasDisponibles = Mesas.LeerListado(ClsMesas.ETipoDeListado.MesasActivasPA, ref InformacionDelError);
            }

            if (MesasDisponibles != null && ListaMesasReservadas != null)
            {
                // Recorro todas las mesas activas
                foreach (Mesa Elemento in MesasDisponibles)
                {
                    bool MesaNoReservada = true;

                    // Elimino de la lista las mesas que encuentre en la lista de las reservadas
                    foreach (MesaXReserva ElementoSecundario in ListaMesasReservadas)
                    {
                        if (Elemento.ID_Mesa == ElementoSecundario.ID_Mesa && ElementoSecundario.ID_Reserva != ID_Reserva)
                        {
                            MesaNoReservada = false;
                        }
                    }

                    if (MesaNoReservada)
                    {
                        bool MarcarMesaReservada = false;
                        int  NumeroDeFila        = dgvSeleccionarMesaReserva.Rows.Add();

                        dgvSeleccionarMesaReserva.Rows[NumeroDeFila].Cells[(int)ENumColDGVMesa.ID_Mesa].Value   = Elemento.ID_Mesa;
                        dgvSeleccionarMesaReserva.Rows[NumeroDeFila].Cells[(int)ENumColDGVMesa.Numero].Value    = Elemento.Numero;
                        dgvSeleccionarMesaReserva.Rows[NumeroDeFila].Cells[(int)ENumColDGVMesa.Capacidad].Value = Elemento.Capacidad;

                        // Marca las mesas ya reservadas al editar una reserva
                        foreach (MesaXReserva ElementoSecundario in ListaMesasReservadas)
                        {
                            if (Elemento.ID_Mesa == ElementoSecundario.ID_Mesa)
                            {
                                MarcarMesaReservada             = true;
                                lblResultadoCapacidadTotal.Text = Convert.ToString(Convert.ToInt32(lblResultadoCapacidadTotal.Text) + Elemento.Capacidad);
                            }
                        }

                        dgvSeleccionarMesaReserva.Rows[NumeroDeFila].Cells[(int)ENumColDGVMesa.Seleccionar].Value = MarcarMesaReservada;

                        if (MarcarMesaReservada)
                        {
                            ClsColores.MarcarFilaDGV(dgvSeleccionarMesaReserva, NumeroDeFila, true);
                        }
                        else
                        {
                            ClsColores.MarcarFilaDGV(dgvSeleccionarMesaReserva, NumeroDeFila, false);
                        }
                    }
                }

                UltimaFilaSeleccionada = -1;

                dgvSeleccionarMesaReserva.Sort(dgvSeleccionarMesaReserva.Columns[(int)ENumColDGVMesa.Numero], ListSortDirection.Ascending);
            }
            else if (InformacionDelError == string.Empty)
            {
                MessageBox.Show($"Ocurrio un fallo al cargar las mesas reservadas", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #13
0
        private void CargarDGVClientes(ClsClientes.EClienteBuscar _TipoDeListado)
        {
            if (FormularioCargado)
            {
                string NombreCliente   = string.Empty;
                string ApellidoCliente = string.Empty;
                string TelefonoCliente = string.Empty;

                if (txtBuscarPorNombre.Text != TEXTO_VISUAL_BUSCAR)
                {
                    NombreCliente = txtBuscarPorNombre.Text;
                }
                if (TxtBuscarPorApellido.Text != TEXTO_VISUAL_APELLIDO)
                {
                    ApellidoCliente = TxtBuscarPorApellido.Text;
                }
                if (TxtBuscarPorTelefono.Text != TEXTO_VISUAL_TELEFONO)
                {
                    TelefonoCliente = TxtBuscarPorTelefono.Text;
                }

                dgvListarClientes.Rows.Clear();

                string InformacionDelError = string.Empty;

                ClsClientes Clientes = new ClsClientes();

                List <Cliente> ListarClientes = Clientes.LeerListado(_TipoDeListado, ref InformacionDelError, NombreCliente, ApellidoCliente, TelefonoCliente);

                ClsClientesXPedidos   ClienteXPedidos             = new ClsClientesXPedidos();
                List <ClienteXPedido> CantidadAsistenciasVigentes = null;

                if (ListarClientes != null)
                {
                    foreach (Cliente Elemento in ListarClientes)
                    {
                        int NumeroDeFila = dgvListarClientes.Rows.Add();

                        dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.ID_Cliente].Value = Elemento.ID_Cliente;
                        dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.Nombre].Value     = Elemento.Nombre;
                        dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.Apellido].Value   = Elemento.Apellido;
                        dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.Telefono].Value   = Elemento.Telefono;

                        CantidadAsistenciasVigentes = ClienteXPedidos.LeerListado(ClsClientesXPedidos.ETipoListado.CantidadAsistencias, ref InformacionDelError, Elemento.ID_Cliente);

                        if (CantidadAsistenciasVigentes != null)
                        {
                            dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.AsistenciasAcumuladas].Value = CantidadAsistenciasVigentes.Count;
                        }
                        else
                        {
                            dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.AsistenciasAcumuladas].Value = 0;
                        }

                        dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.EnviarCliente].Value = "Enviar";
                        dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.Seleccionar].Value   = false;

                        foreach (int ElementoSecundario in ClientesDelPedido)
                        {
                            if (Elemento.ID_Cliente == ElementoSecundario)
                            {
                                dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.Seleccionar].Value = true;
                                ClsColores.MarcarFilaDGV(dgvListarClientes, NumeroDeFila, true);
                                break;
                            }
                        }

                        if ((bool)dgvListarClientes.Rows[NumeroDeFila].Cells[(int)ENumColDGVCliente.Seleccionar].Value == false && MostrarClientesSeleccionados)
                        {
                            dgvListarClientes.Rows.Remove(dgvListarClientes.Rows[NumeroDeFila]);
                        }
                    }

                    UltimaFilaSeleccionada = -1;

                    if (MostrarClientesSeleccionados && dgvListarClientes.Rows.Count == 0)
                    {
                        MostrarClientesSeleccionados = false;

                        CargarDGVClientes(ClsClientes.EClienteBuscar.Todos);

                        using (FrmInformacion FormInformacion = new FrmInformacion($"No se encontro ningun cliente seleccionado, lista " +
                                                                                   $"cargada nuevamente.", ClsColores.Blanco, 200, 300))
                        {
                            FormInformacion.ShowDialog();
                        }
                    }

                    lblResultadoTotalClientes.Text = Convert.ToString(ClientesDelPedido.Count);
                }
                else if (InformacionDelError == string.Empty)
                {
                    FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al listar los clientes");
                    MessageBox.Show("Fallo al listar los clientes", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    FrmPrincipal.ObtenerInstancia().MensajeAdvertencia("Fallo al listar los clientes");
                    MessageBox.Show($"{InformacionDelError}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            dgvListarClientes.ClearSelection();
        }