Example #1
0
        private void frmCaixa_Load(object sender, EventArgs e)
        {
            try
            {
                if (Properties.Settings.Default.CaixaAberto == true)
                {
                    Properties.Settings.Default.CaixaAberto = false;
                    DialogMessage.MessageFullComButtonOkIconeDeInformacao("O Caixa esta aberto, verifique o valor correto para evitar futuros problemas.", "Aviso");
                    Form frmAdd = new frmAdicionarCaixa(EnumTipoOperacaoCaixa.Fechar);
                    if (frmAdd.ShowDialog() == DialogResult.Yes)
                    {
                        CarregarValorDoCaixaAtualiza();
                        frmAdd.Close();
                    }
                    else
                    {
                        while (frmAdd.ShowDialog() != DialogResult.Yes)
                        {
                            if (frmAdd.ShowDialog() == DialogResult.Yes)
                            {
                                break;
                            }
                        }
                    }
                }

                InstanciaCaixaRepositorio();
                if (_caixaRepositorio.GetValor() == null)
                {
                    _caixaRepositorio.Cadastrar(new Caixa()
                    {
                        IDUsuario = Usuarios.IDStatic, Valor = 0
                    });
                }
                comandaLista = new List <Comanda>();
                EsconderGroupBoxOuMostrar(new List <GroupBox>()
                {
                    gpbValorPorPeso
                }, Esconder);
                CarregarValorDoCaixaAtualiza();
                EsconderGpb();
                AtribuirUsuarioAoRodape();
                CarregarTxtQuantidadeComUm();
                EsconderOuMostrarButtonVenda(Esconder);
                InstanciaTipoPagamentoRepositorio();
                _tipoPagamentoRepositorio.Listar(cbb: cbbTipoDePagamento);
                FocarNoTxt(txtCodigoDaComanda);
            }
            catch (CustomException erro)
            {
                DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso");
            }
            catch (Exception erro)
            {
                DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro");
            }
        }
Example #2
0
        private void frmCaixa_Load(object sender, EventArgs e)
        {
            try
            {
                EsconderButton(btn:btnDividirComanda);
                if (Properties.Settings.Default.CaixaAberto == true)
                {
                    Properties.Settings.Default.CaixaAberto = false;
                    DialogMessage.MessageFullComButtonOkIconeDeInformacao("O Caixa esta aberto, verifique o valor correto para evitar futuros problemas.", "Aviso");
                    Form frmAdd = new frmAdicionarCaixa(EnumTipoOperacaoCaixa.Fechar);
                    if (frmAdd.ShowDialog() == DialogResult.Yes)
                    {
                        CarregarValorDoCaixaAtualiza();
                        frmAdd.Close();
                    }
                    else
                    {

                        while (frmAdd.ShowDialog() != DialogResult.Yes)
                        {
                            if (frmAdd.ShowDialog() == DialogResult.Yes)
                            {
                                break;
                            }
                        }
                    }
                }

                InstanciaCaixaRepositorio();
                if (_caixaRepositorio.GetValor() == null)
                {
                    _caixaRepositorio.Cadastrar(new Caixa() { IDUsuario = Usuarios.IDStatic, Valor = 0 });
                }
                comandaLista = new List<Comanda>();
                EsconderGroupBoxOuMostrar(new List<GroupBox>() { gpbValorPorPeso }, Esconder);
                EsconderGroupBoxOuMostrar(new List<GroupBox>() { gpbCodigoDaComanda }, Esconder);
                CarregarValorDoCaixaAtualiza();
                EsconderGpb();
                AtribuirUsuarioAoRodape();
                CarregarTxtQuantidadeComUm();
                EsconderOuMostrarButtonVenda(Esconder);
                InstanciaTipoPagamentoRepositorio();
                _tipoPagamentoRepositorio.Listar(cbb: cbbTipoDePagamento);
                FocarNoTxt(txtCodigoDaComanda);

            }
            catch (CustomException erro)
            {
                DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso");
            }
            catch (Exception erro)
            {
                DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro");
            }
        }