コード例 #1
0
        private void Eventos()
        {
            KeyDown   += KeyDowns;
            KeyPreview = true;
            Masks.SetToUpper(this);

            ToolHelp.Show("Título para identificar a Mesa.", pictureBox1, ToolHelp.ToolTipIcon.Info, "Ajuda!");
            ToolHelp.Show("A quantidade de pessoas que cabem na mesa.", pictureBox5, ToolHelp.ToolTipIcon.Info,
                          "Ajuda!");

            Shown += (s, e) =>
            {
                mesa.Focus();

                if (IdMesa > 0)
                {
                    _mMesas = _mMesas.FindById(IdMesa).WhereFalse("excluir").FirstOrDefault <Model.Mesas>();
                    if (_mMesas == null)
                    {
                        return;
                    }

                    label11.Text   = @"Editar mesa";
                    mesa.Text      = _mMesas.Mesa;
                    nrPessoas.Text = _mMesas.NrPessoas.ToString();
                }
                else
                {
                    IdMesa = 0;
                }
            };

            btnSalvar.Click += (s, e) => Save();

            btnDelete.Click += (s, e) =>
            {
                if (IdMesa <= 0)
                {
                    return;
                }

                if (_mMesas.Remove(IdMesa))
                {
                    Alert.Message("Pronto", "Mesa removida com sucesso.", Alert.AlertType.success);

                    DialogResult = DialogResult.OK;
                    Close();
                    return;
                }

                Alert.Message("Opps", "Erro ao remover mesa.", Alert.AlertType.error);
            };

            FormClosing += (s, e) => { DialogResult = DialogResult.OK; };
        }
コード例 #2
0
        private void Save()
        {
            var check = new Model.Mesas().FindAll().Where("id", "!=", IdMesa).WhereFalse("excluir")
                        .Where("mesa", mesa.Text).FirstOrDefault <Model.Mesas>();

            if (check != null)
            {
                Alert.Message("Opps", "Já existe uma mesa com esse identificador.", Alert.AlertType.error);
                return;
            }

            if (string.IsNullOrEmpty(mesa.Text))
            {
                Alert.Message("Opps", "O identificador da mesa não pode ficar vazio", Alert.AlertType.error);
                return;
            }

            _mMesas.Mesa      = mesa.Text;
            _mMesas.NrPessoas = Validation.ConvertToInt32(nrPessoas.Text);
            if (_mMesas.Save(_mMesas))
            {
                mesa.Text      = "";
                nrPessoas.Text = "";

                Alert.Message("Pronto", "Mesa adicionada com sucesso.", Alert.AlertType.success);

                if (IdMesa > 0)
                {
                    Close();
                }

                mesa.Focus();
                return;
            }

            Alert.Message("Opps", "Erro ao adicionar mesa.", Alert.AlertType.error);
        }
コード例 #3
0
        private void LoadMesas(string searchText = "")
        {
            flowLayout.Controls.Clear();

            var txtSearch = $"%{searchText}%";
            if (IniFile.Read("MesasPreCadastrada", "Comercial") == "True")
            {
                var mesas = new Model.Mesas().FindAll().WhereFalse("excluir").Where("mesa", "like", txtSearch)
                    .Get<Model.Mesas>();
                if (mesas.Any())
                    foreach (var mesa in mesas)
                    {
                        var idMesa = mesa.Mesa;

                        var pedidoItem = new PedidoItem().FindAll().WhereFalse("excluir").Where("pedido", 0)
                            .Where("mesa", idMesa).FirstOrDefault<PedidoItem>();

                        var panel1 = new VisualPanel
                        {
                            Anchor = AnchorStyles.Top | AnchorStyles.Left
                                                      | AnchorStyles.Right,
                            BackColor = Color.Transparent,
                            BackColorState
                                = {Disabled = Color.FromArgb(224, 224, 224), Enabled = Color.FromArgb(249, 249, 249)},
                            BackgroundImageLayout = ImageLayout.Zoom,
                            Border =
                            {
                                Color = Color.FromArgb(224, 224, 224),
                                HoverColor = Color.FromArgb(224, 224, 224),
                                HoverVisible = true,
                                Rounding = 6,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            ForeColor = Color.FromArgb(0, 0, 0),
                            Location = new Point(3, 3),
                            MouseState = MouseStates.Normal,
                            Name = $"{idMesa}mesa",
                            Cursor = Cursors.Hand,
                            Padding = new Padding(5),
                            Size = new Size(229, 140),
                            TabIndex = 40060,
                            Text = @"visualPanel2",
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };

                        #region panel2

                        var panel2 = new VisualPanel
                        {
                            BackColor = Color.Gray,
                            BackColorState = {Disabled = Color.FromArgb(224, 224, 224), Enabled = Color.Gray},
                            Border =
                            {
                                Color = Color.Gray,
                                HoverColor = Color.Gray,
                                HoverVisible = true,
                                Rounding = 6,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            ForeColor = Color.FromArgb(0, 0, 0),
                            Location = new Point(0, 0),
                            MouseState = MouseStates.Normal,
                            Name = "visualPanel1",
                            Padding = new Padding(5),
                            Size = new Size(229, 41),
                            TabIndex = 11,
                            Text = @"visualPanel1",
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };

                        var txtNrMesa = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.Gray,
                            Font = new Font("Segoe UI", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.White,
                            Location = new Point(33, 8),
                            Name = $"{idMesa}",
                            Size = new Size(34, 25),
                            TabIndex = 6,
                            Text = mesa.Mesa
                        };
                        txtNrMesa.Click += ActionMesa;

                        var check = new VisualCheckBox
                        {
                            BackColor = Color.Gray,
                            Border =
                            {
                                Color = Color.White,
                                HoverColor = Color.White,
                                HoverVisible = true,
                                Rounding = 3,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            Box = new Size(14, 14),
                            BoxColorState =
                            {
                                Disabled = Color.FromArgb(224, 224, 224),
                                Enabled = Color.White,
                                Hover = Color.White,
                                Pressed = Color.White
                            },
                            BoxSpacing = 2,
                            CheckStyle =
                            {
                                AutoSize = true,
                                Bounds = new Rectangle(0, 0, 125, 23),
                                Character = '✔',
                                CheckColor = Color.Gray,
                                Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point,
                                    0),
                                ShapeRounding = 3,
                                ShapeType = ShapeTypes.Rounded,
                                Style = CheckStyle.CheckType.Checkmark,
                                Thickness = 2F
                            },
                            Cursor = Cursors.Hand,
                            ForeColor = Color.FromArgb(0, 0, 0),
                            IsBoxLarger = false,
                            Location = new Point(9, 9),
                            MouseState = MouseStates.Normal,
                            Name = $"{idMesa}check",
                            Size = new Size(18, 23),
                            TabIndex = 9,
                            TextSize = new Size(0, 0),
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            },
                            Checked = false
                        };
                        check.Click += ActionCheck;

                        if (pedidoItem == null)
                            check.Visible = false;

                        panel2.Controls.Add(check);
                        panel2.Controls.Add(txtNrMesa);

                        #endregion

                        var subTotal = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 112),
                            Name = "label13",
                            Size = new Size(54, 15),
                            TabIndex = 15,
                            Text = @"Subtotal:"
                        };

                        var txtSubTotal = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 112),
                            Name = "label12",
                            Size = new Size(56, 15),
                            TabIndex = 16,
                            Text = pedidoItem != null
                                ? $"R$ {Validation.FormatPrice(GetSubTotal(idMesa))}"
                                : "R$ 00,00"
                        };


                        var hra = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 91),
                            Name = "label3",
                            Size = new Size(46, 15),
                            TabIndex = 7,
                            Text = @"Tempo:"
                        };

                        var txtHra = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 91),
                            Name = "label11",
                            Size = new Size(56, 15),
                            TabIndex = 14
                        };

                        if (pedidoItem != null)
                        {
                            var date = DateTime.Now;
                            var hourMesa = date.AddHours(-GetData(idMesa).Criado.Hour);
                            var minMesa = date.AddMinutes(-GetData(idMesa).Criado.Minute);

                            txtHra.Text = $@"{hourMesa.Hour}h {minMesa.Minute}m";
                        }
                        else
                        {
                            txtHra.Text = @"00h 00m";
                        }

                        var status = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 70),
                            Name = "label7",
                            Size = new Size(42, 15),
                            TabIndex = 10,
                            Text = @"Status:"
                        };

                        var txtStatus = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            Location = new Point(72, 70),
                            Name = "label10",
                            Size = new Size(56, 15),
                            ForeColor = pedidoItem != null ? Color.Red : Color.Green,
                            Text = pedidoItem != null ? "Ocupado" : "Livre"
                        };


                        var atendente = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 49),
                            Name = "label4",
                            Size = new Size(65, 15),
                            TabIndex = 8,
                            Text = @"Atendente:"
                        };

                        var txtAtendente = new Label
                        {
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 49),
                            Name = "label9",
                            Size = new Size(151, 15),
                            TabIndex = 12
                        };

                        if (txtStatus.Text == @"Ocupado")
                        {
                            var userName = GetUsuario(idMesa) == null ? "" : GetUsuario(idMesa).Nome;
                            txtAtendente.Text = $@"{Validation.FirstCharToUpper(userName)}";
                        }
                        else
                        {
                            txtAtendente.Text = "";
                        }

                        panel1.Controls.Add(txtSubTotal);
                        panel1.Controls.Add(subTotal);
                        panel1.Controls.Add(txtHra);
                        panel1.Controls.Add(txtStatus);
                        panel1.Controls.Add(txtAtendente);
                        panel1.Controls.Add(panel2);
                        panel1.Controls.Add(status);
                        panel1.Controls.Add(atendente);
                        panel1.Controls.Add(hra);

                        flowLayout.Controls.Add(panel1);
                    }
            }
            else
            {
                var mesas = _mPedidoItem.FindAll(new[] {"mesa"}).Where("pedido", 0).Where("mesa", "like", txtSearch)
                    .GroupBy("mesa").Get();
                if (mesas != null)
                    foreach (var mesa in mesas)
                    {
                        string idMesa = mesa.MESA.ToString();

                        var panel1 = new VisualPanel
                        {
                            Anchor = AnchorStyles.Top | AnchorStyles.Left
                                                      | AnchorStyles.Right,
                            BackColor = Color.Transparent,
                            BackColorState =
                                {Disabled = Color.FromArgb(224, 224, 224), Enabled = Color.FromArgb(249, 249, 249)},
                            BackgroundImageLayout = ImageLayout.Zoom,
                            Border =
                            {
                                Color = Color.FromArgb(224, 224, 224),
                                HoverColor = Color.FromArgb(224, 224, 224),
                                HoverVisible = true,
                                Rounding = 6,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            ForeColor = Color.FromArgb(0, 0, 0),
                            Location = new Point(3, 3),
                            MouseState = MouseStates.Normal,
                            Name = $"{idMesa}mesa",
                            Cursor = Cursors.Hand,
                            Padding = new Padding(5),
                            Size = new Size(229, 140),
                            TabIndex = 40060,
                            Text = @"visualPanel2",
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };

                        #region panel2

                        var panel2 = new VisualPanel
                        {
                            BackColor = Color.Gray,
                            BackColorState = {Disabled = Color.FromArgb(224, 224, 224), Enabled = Color.Gray},
                            Border =
                            {
                                Color = Color.Gray,
                                HoverColor = Color.Gray,
                                HoverVisible = true,
                                Rounding = 6,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            ForeColor = Color.FromArgb(0, 0, 0),
                            Location = new Point(0, 0),
                            MouseState = MouseStates.Normal,
                            Name = "visualPanel1",
                            Padding = new Padding(5),
                            Size = new Size(229, 41),
                            TabIndex = 11,
                            Text = @"visualPanel1",
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };

                        var txtNrMesa = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.Gray,
                            Font = new Font("Segoe UI", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.White,
                            Location = new Point(33, 8),
                            Name = $"{idMesa}",
                            Size = new Size(34, 25),
                            TabIndex = 6,
                            Text = mesa.MESA.ToString()
                        };
                        txtNrMesa.Click += ActionMesa;

                        var check = new VisualCheckBox
                        {
                            Checked = false,
                            BackColor = Color.Gray,
                            Border =
                            {
                                Color = Color.White,
                                HoverColor = Color.White,
                                HoverVisible = true,
                                Rounding = 3,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            Box = new Size(14, 14),
                            BoxColorState =
                            {
                                Disabled = Color.FromArgb(224, 224, 224),
                                Enabled = Color.White,
                                Hover = Color.White,
                                Pressed = Color.White
                            },
                            BoxSpacing = 2,
                            CheckStyle =
                            {
                                AutoSize = true,
                                Bounds = new Rectangle(0, 0, 125, 23),
                                Character = '✔',
                                CheckColor = Color.Gray,
                                Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point,
                                    0),
                                ShapeRounding = 3,
                                ShapeType = ShapeTypes.Rounded,
                                Style = CheckStyle.CheckType.Checkmark,
                                Thickness = 2F
                            },
                            Cursor = Cursors.Hand,
                            ForeColor = Color.FromArgb(0, 0, 0),
                            IsBoxLarger = false,
                            Location = new Point(9, 9),
                            MouseState = MouseStates.Normal,
                            Name = $"{idMesa}check",
                            Size = new Size(18, 23),
                            TabIndex = 9,
                            TextSize = new Size(0, 0),
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };
                        check.Click += ActionCheck;

                        panel2.Controls.Add(check);
                        panel2.Controls.Add(txtNrMesa);

                        #endregion

                        var subTotal = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 112),
                            Name = "label13",
                            Size = new Size(54, 15),
                            TabIndex = 15,
                            Text = @"Subtotal:"
                        };

                        var txtSubTotal = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 112),
                            Name = "label12",
                            Size = new Size(56, 15),
                            TabIndex = 16,
                            Text = $@"R$ {Validation.FormatPrice(GetSubTotal(idMesa))}"
                        };

                        var hra = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 91),
                            Name = "label3",
                            Size = new Size(46, 15),
                            TabIndex = 7,
                            Text = @"Tempo:"
                        };

                        var txtHra = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 91),
                            Name = "label11",
                            Size = new Size(56, 15),
                            TabIndex = 14
                        };

                        var date = DateTime.Now;
                        var hourMesa = date.AddHours(-GetData(idMesa).Criado.Hour);
                        var minMesa = date.AddMinutes(-GetData(idMesa).Criado.Minute);

                        txtHra.Text = $@"{hourMesa.Hour}h {minMesa.Minute}m";

                        var status = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 70),
                            Name = "label7",
                            Size = new Size(42, 15),
                            TabIndex = 10,
                            Text = @"Status:"
                        };

                        var txtStatus = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Red,
                            Location = new Point(72, 70),
                            Name = "label10",
                            Size = new Size(56, 15),
                            TabIndex = 13,
                            Text = @"Ocupado"
                        };

                        var atendente = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 49),
                            Name = "label4",
                            Size = new Size(65, 15),
                            TabIndex = 8,
                            Text = @"Atendente:"
                        };

                        var txtAtendente = new Label
                        {
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 49),
                            Name = "label9",
                            Size = new Size(151, 15),
                            TabIndex = 12
                        };

                        var userName = GetUsuario(idMesa) == null ? "" : GetUsuario(idMesa).Nome;
                        txtAtendente.Text = $@"{userName}";

                        panel1.Controls.Add(txtSubTotal);
                        panel1.Controls.Add(subTotal);
                        panel1.Controls.Add(txtHra);
                        panel1.Controls.Add(txtStatus);
                        panel1.Controls.Add(txtAtendente);
                        panel1.Controls.Add(panel2);
                        panel1.Controls.Add(status);
                        panel1.Controls.Add(atendente);
                        panel1.Controls.Add(hra);

                        flowLayout.Controls.Add(panel1);
                    }
            }
        }
コード例 #4
0
        private void Eventos()
        {
            KeyDown   += KeyDowns;
            KeyPreview = true;
            Masks.SetToUpper(this);

            Load += (s, e) =>
            {
                Categorias.DataSource    = new Categoria().GetAll("Produtos");
                Categorias.DisplayMember = "Nome";
                Categorias.ValueMember   = "Id";
            };

            Shown += (s, e) =>
            {
                // Autocomplete de produtos
                collection = _mItem.AutoComplete("Produtos");
                BuscarProduto.AutoCompleteCustomSource = collection;

                SetHeadersTable(GridLista);
                SetHeadersTableProdutos(GridProdutos);

                if (IniFile.Read("MesasPreCadastrada", "Comercial") == "True")
                {
                    nrMesa.Visible = false;
                    Mesas.Visible  = true;

                    var listMesas = new ArrayList {
                        new { Id = "0", Nome = "SELECIONE" }
                    };
                    var getMesas = new Model.Mesas().FindAll().WhereFalse("excluir").Get <Model.Mesas>();
                    if (getMesas.Any())
                    {
                        foreach (var mesas in getMesas)
                        {
                            listMesas.Add(new { Id = $"{mesas.Id}", Nome = $"{mesas.Mesa}" });
                        }
                    }

                    Mesas.DataSource    = listMesas;
                    Mesas.DisplayMember = "Nome";
                    Mesas.ValueMember   = "Id";
                }
            };

            BuscarProduto.KeyDown += (s, e) =>
            {
                if (e.KeyCode != Keys.Enter)
                {
                    return;
                }

                var item = _mItem.FindById(collection.Lookup(BuscarProduto.Text)).FirstOrDefault <Item>();
                if (item == null)
                {
                    return;
                }

                if (!string.IsNullOrEmpty(item.Combos))
                {
                    var comboExits = false;
                    var idsCombo   = item.Combos.Split(',');
                    foreach (var id in idsCombo)
                    {
                        var checkCombo = new Model.ItemCombo().FindById(Validation.ConvertToInt32(id)).WhereFalse("excluir").FirstOrDefault <ItemCombo>();
                        if (checkCombo != null)
                        {
                            comboExits = true;
                        }
                    }

                    if (comboExits)
                    {
                        AddCombo.IdProduto = item.Id;
                        AddCombo.IdPedido  = 0;
                        var form = new AddCombo {
                            TopMost = true
                        };
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            foreach (PedidoItem data in AddCombo.listProdutosIncluir)
                            {
                                GridLista.Rows.Add(
                                    false,
                                    data.Item,
                                    data.xProd,
                                    Validation.FormatPrice(Validation.ConvertToDouble(data.ValorVenda)),
                                    "",
                                    data.Adicional,
                                    Validation.ConvertToDouble(data.ValorVenda),
                                    Resources.menu20x
                                    );
                            }

                            txtValorTotal.Text = $@"Valor Total: {Validation.FormatPrice(SumTotalGrid(), true)}";
                            BuscarProduto.Text = "";
                            BuscarProduto.Select();
                            return;
                        }
                    }
                }

                GridLista.Rows.Add(
                    false,
                    item.Id,
                    item.Nome,
                    Validation.FormatPrice(Validation.ConvertToDouble(item.ValorVenda)),
                    "",
                    "",
                    Validation.ConvertToDouble(item.ValorVenda),
                    Resources.menu20x
                    );

                txtValorTotal.Text = $@"Valor Total: {Validation.FormatPrice(SumTotalGrid(), true)}";
                BuscarProduto.Text = "";
                BuscarProduto.Select();
            };

            btnFiltrar.Click += (s, e) => LoadProdutos();
            btnEnviar.Click  += (s, e) => ActionEnviar();

            GridProdutos.CellClick += (s, e) =>
            {
                if (GridProdutos.Columns[e.ColumnIndex].Name == "Adicionar")
                {
                    var idItem = Validation.ConvertToInt32(GridProdutos.SelectedRows[0].Cells["ID"].Value);
                    var item   = _mItem.FindById(idItem).FirstOrDefault <Item>();
                    if (item == null)
                    {
                        return;
                    }

                    if (!string.IsNullOrEmpty(item.Combos))
                    {
                        var comboExits = false;
                        var idsCombo   = item.Combos.Split(',');
                        foreach (var id in idsCombo)
                        {
                            var checkCombo = new Model.ItemCombo().FindById(Validation.ConvertToInt32(id)).WhereFalse("excluir").FirstOrDefault <ItemCombo>();
                            if (checkCombo != null)
                            {
                                comboExits = true;
                            }
                        }

                        if (comboExits)
                        {
                            AddCombo.IdProduto = item.Id;
                            AddCombo.IdPedido  = 0;
                            var form = new AddCombo {
                                TopMost = true
                            };
                            if (form.ShowDialog() == DialogResult.OK)
                            {
                                foreach (PedidoItem data in AddCombo.listProdutosIncluir)
                                {
                                    GridLista.Rows.Add(
                                        false,
                                        data.Item,
                                        data.xProd,
                                        Validation.FormatPrice(Validation.ConvertToDouble(data.ValorVenda)),
                                        "",
                                        data.Adicional,
                                        Validation.ConvertToDouble(data.ValorVenda),
                                        Resources.menu20x
                                        );
                                }

                                BuscarProduto.Text = "";
                                BuscarProduto.Select();
                                Alert.Message("Pronto", "Item adicionado.", Alert.AlertType.success);
                                return;
                            }
                        }
                    }

                    GridLista.Rows.Add(
                        false,
                        GridProdutos.SelectedRows[0].Cells["ID"].Value,
                        GridProdutos.SelectedRows[0].Cells["Item"].Value,
                        GridProdutos.SelectedRows[0].Cells["Valor"].Value,
                        "",
                        "",
                        GridProdutos.SelectedRows[0].Cells["Valor"].Value,
                        Resources.menu20x
                        );

                    txtValorTotal.Text = $@"Valor Total: {Validation.FormatPrice(SumTotalGrid(), true)}";
                    Alert.Message("Pronto", "Item adicionado.", Alert.AlertType.success);
                }
            };

            GridProdutos.CellMouseEnter += (s, e) =>
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }

                var dataGridView = s as DataGridView;
                if (GridProdutos.Columns[e.ColumnIndex].Name == "Adicionar")
                {
                    dataGridView.Cursor = Cursors.Hand;
                }
            };

            GridProdutos.CellMouseLeave += (s, e) =>
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }

                var dataGridView = s as DataGridView;
                if (GridProdutos.Columns[e.ColumnIndex].Name == "Adicionar")
                {
                    dataGridView.Cursor = Cursors.Default;
                }
            };

            btnRemover.Click += (s, e) =>
            {
                var toBeDeleted = new List <DataGridViewRow>();
                toBeDeleted.Clear();

                var result = AlertOptions.Message("Atenção!",
                                                  "Você está prestes a deletar os PRODUTOS selecionados, continuar?", AlertBig.AlertType.warning,
                                                  AlertBig.AlertBtn.YesNo);
                if (result)
                {
                    foreach (DataGridViewRow item in GridLista.Rows)
                    {
                        Console.WriteLine(item.Cells["Selecione"].Value);
                        if ((bool)item.Cells["Selecione"].Value)
                        {
                            toBeDeleted.Add(item);
                        }
                    }

                    toBeDeleted.ForEach(d => GridLista.Rows.Remove(d));
                }

                txtValorTotal.Text = $@"Valor Total: {Validation.FormatPrice(SumTotalGrid(), true)}";
                btnRemover.Visible = false;
            };

            GridLista.CellClick += (s, e) =>
            {
                if (GridLista.Columns[e.ColumnIndex].Name == "Selecione")
                {
                    if ((bool)GridLista.SelectedRows[0].Cells["Selecione"].Value == false)
                    {
                        GridLista.SelectedRows[0].Cells["Selecione"].Value = true;
                        btnRemover.Visible = true;
                    }
                    else
                    {
                        GridLista.SelectedRows[0].Cells["Selecione"].Value = false;

                        var hideBtns = false;
                        foreach (DataGridViewRow item in GridLista.Rows)
                        {
                            if ((bool)item.Cells["Selecione"].Value)
                            {
                                hideBtns = true;
                            }
                        }

                        btnRemover.Visible = hideBtns;
                    }
                }

                if (GridLista.Columns[e.ColumnIndex].Name == "Adicional")
                {
                    AdicionaisDispon.ValorAddon    = 0;
                    AdicionaisDispon.AddonSelected = GridLista.SelectedRows[0].Cells["AddonSelected"].Value != null
                        ? GridLista.SelectedRows[0].Cells["AddonSelected"].Value.ToString()
                        : "";
                    AdicionaisDispon.IdPedidoItem = 0;
                    AdicionaisDispon.IdItem       = Validation.ConvertToInt32(GridLista.SelectedRows[0].Cells["ID"].Value);
                    var form = new AdicionaisDispon();
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        var getValor = Validation.ConvertToDouble(GridLista.SelectedRows[0].Cells["Unitario"].Value
                                                                  .ToString().Replace("R$ ", ""));
                        GridLista.SelectedRows[0].Cells["Valor"].Value         = Validation.FormatPrice(getValor + AdicionaisDispon.ValorAddon);
                        GridLista.SelectedRows[0].Cells["AddonSelected"].Value = AdicionaisDispon.AddonSelected;
                    }
                }
            };

            GridLista.CellMouseEnter += (s, e) =>
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }

                var dataGridView = s as DataGridView;
                if (GridLista.Columns[e.ColumnIndex].Name == "Selecione" ||
                    GridLista.Columns[e.ColumnIndex].Name == "Adicional")
                {
                    dataGridView.Cursor = Cursors.Hand;
                }
            };

            GridLista.CellMouseLeave += (s, e) =>
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }

                var dataGridView = s as DataGridView;
                if (GridLista.Columns[e.ColumnIndex].Name == "Selecione" ||
                    GridLista.Columns[e.ColumnIndex].Name == "Adicional")
                {
                    dataGridView.Cursor = Cursors.Default;
                }
            };
        }