private void btnConsultar_Click(object sender, EventArgs e)
        {
            if (txtMercadoria.Mercadoria == null)
            {
                MessageBox.Show(this,
                    "A mercadoria digitada não encontra-se cadastrada.",
                    "Mercadoria não cadastrada",
                    MessageBoxButtons.OK);

                return;
            }

            configuração.Valor = cmbTabela.Seleção.Código;

            UseWaitCursor = true;

            AguardeDB.Mostrar();

            try
            {
                try
                {
                    double teste = txtMercadoria.Mercadoria.Coeficiente;

                    if (teste <= 0)
                        MessageBox.Show(
                            this,
                            "O coeficiente desta mercadoria nesta tabela é nulo ou negativo.",
                            Text,
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (NullReferenceException)
                {
                    AguardeDB.Suspensão(true);

                    MessageBox.Show(
                        this,
                        "Não existe preço para esta mercadoria nesta tabela.",
                        Text,
                        MessageBoxButtons.OK, MessageBoxIcon.Information);

                    AguardeDB.Suspensão(false);

                    return;
                }

                if (cmbTabela.Text == "Atacado")
                {
                    JanelaInformaçõesMercadoriaResumo janelaInformações
                        = new JanelaInformaçõesMercadoriaResumo(txtMercadoria.Mercadoria, txtCotação.Cotação);

                    Hide();

                    janelaInformações.Fechando += new EventHandler(janelaInformações_Fechando);
                    janelaInformações.Show();
                    janelaInformações.Focus();
                }
                else
                {
                    JanelaInformaçõesMercadoria janelaInformações
                        = new JanelaInformaçõesMercadoria(txtMercadoria.Mercadoria, txtCotação.Cotação);

                    Hide();

                    janelaInformações.Fechando += new EventHandler(janelaInformações_Fechando);
                    janelaInformações.Show();
                    janelaInformações.Focus();
                }
            }
            finally
            {
                UseWaitCursor = false;
                AguardeDB.Fechar();
            }
        }
Beispiel #2
0
        private void visualizarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Seleção == null)
                return;

            Entidades.Mercadoria.Mercadoria m =
                Entidades.Mercadoria.Mercadoria.ObterMercadoria(Seleção.ReferênciaFormatada, Entidades.Tabela.TabelaPadrão);

            JanelaInformaçõesMercadoriaResumo janela = new JanelaInformaçõesMercadoriaResumo(m,
                Entidades.Financeiro.Cotação.ObterCotaçãoVigente(Moeda.ObterMoeda(MoedaSistema.Ouro)));

            janela.Show();
        }