Ejemplo n.º 1
0
 private void txtID_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         e.Handled = true;
         if (txtID.Text == "")
         {
             wp_Incluir         = true;
             btnExcluir.Enabled = false;
             gpoDados.Enabled   = true;
             txtDescricao.Focus();
         }
         else
         {
             if (gpo.Consulta(int.Parse(txtID.Text)))
             {
                 BuscaDadosClasse();
                 gpoDados.Enabled   = true;
                 btnExcluir.Enabled = true;
                 txtDescricao.Focus();
             }
             else
             {
                 MessageBox.Show("ID deste <grupo> não encontrado !");
                 txtID.Focus();
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void BuscarDadosClasse()
        {
            txtDescricao.Text     = Pro.Descricao.ToString();
            txtCodeBar.Text       = Pro.Codebar.ToString();
            cmbUnidades.Text      = Pro.Unidade.ToString();
            txtLocalEstoque.Text  = Pro.Local_Estoque.ToString();
            txtPrecoVenda.Text    = Pro.Preco_Venda.ToString("N").ToString();
            txtDescontoMax.Text   = Pro.Desconto_Vista.ToString("N");
            txtCustoAtual.Text    = Pro.Custo_Atual.ToString("N");
            txtCustoMedio.Text    = Pro.Custo_Medio.ToString("N");
            txtCustoAnterior.Text = Pro.Custo_Anterior.ToString("N");
            txtEstoqueAtual.Text  = Pro.Estoque_Atual.ToString("N");
            txtEstoqueMinimo.Text = Pro.Estoque_Minimo.ToString("N");
            txtEstoqueMaximo.Text = Pro.Estoque_Maximo.ToString("N");
            txtGrupo.Text         = Pro.Grupo.ToString();
            if (String.IsNullOrEmpty(txtGrupo.Text))
            {
                txtGrupo.Text = "0";
            }
            if (Gru.Consulta(int.Parse(txtGrupo.Text)))
            {
                lblGrupo.Text = Gru.Descricao.ToString();
            }
            else
            {
                lblGrupo.Text = "Grupo não encontrado";
            }

            txtMarca.Text = Pro.Marca.ToString();
            if (string.IsNullOrEmpty(txtMarca.Text))
            {
                txtMarca.Text = "0";
            }
            if (Mar.Consulta(int.Parse(txtMarca.Text)))
            {
                lblMarca.Text = Mar.Descricao.ToString();
            }

            txtUltimoCliente.Text = Pro.Ultimo_Cliente.ToString();
            txtUltimaVenda.Text   = Pro.Ultima_Venda.ToString("dd/MM/yyyy hh:mm");
            if (!string.IsNullOrEmpty(Pro.Cest))
            {
                txtCest.Text = Pro.Cest.ToString();
                if (string.IsNullOrEmpty(txtCest.Text))
                {
                    txtCest.Text = "0";
                }
                if (Pro.Consulta_Cest(txtCest.Text))
                {
                    lblCest.Text = Pro.Cest_Descricao.ToString();
                }
            }

            if (!string.IsNullOrEmpty(Pro.Ncm))
            {
                txtNcm.Text = Pro.Ncm.ToString();
                if (string.IsNullOrEmpty(txtNcm.Text))
                {
                    txtNcm.Text = "0";
                }
                if (Pro.Consulta_Ncm(txtNcm.Text))
                {
                    lblNcm.Text = Pro.Ncm_Descricao.ToString();
                }
            }

            if (Pro.Imagem != null)
            {
                Image ImagemdoBanco = ByteToImage(Pro.Imagem);
                picImagem.Image = ImagemdoBanco;
            }
        }