Exemple #1
0
        public ArrayList ProdutosEmFalta()

        {
            ProdutosDAL obj = new ProdutosDAL();

            return(obj.ProdutosEmFalta());
        }
Exemple #2
0
        public void Excluir(int codigo)

        {
            ProdutosDAL obj = new ProdutosDAL();

            obj.Excluir(codigo);
        }
Exemple #3
0
        public void Alterar(ProdutoInformation produto)

        {
            ProdutosDAL obj = new ProdutosDAL();

            obj.Alterar(produto);
        }
Exemple #4
0
        public void Alterar(ProdutoInformation produto)
        {
            // Nome do produto é obrigatório
            if (produto.Nome.Trim().Length == 0)
            {
                throw new Exception("O nome do produto é obrigatório.");
            }

            // O preço do produto não pode ser negativo
            if (produto.Preco < 0)
            {
                throw new Exception("Preço do produto não pode ser negativo.");
            }

            // O estoque do produto não pode ser negativo
            if (produto.Estoque < 0)
            {
                throw new Exception("Estoque do produto não pode ser negativo.");
            }

            //Se tudo estiver ok, chama a rotina de alteração
            ProdutosDAL obj = new ProdutosDAL();

            obj.Alterar(produto);
        }
Exemple #5
0
        public DataTable Listagem()

        {
            ProdutosDAL obj = new ProdutosDAL();

            return(obj.Listagem());
        }
Exemple #6
0
 public void inserir()
 {
     try
     {
         objDAL          = new ProdutosDAL();
         this.pro_codigo = objDAL.inserir(this.pro_nome, this.pro_quantidade, this.pro_precoCusto, this.pro_precoVenda, this.pro_precoAtacado, this.pro_categoria, this.pro_grupo, this.pro_subGrupo, this.pro_unidade, this.pro_estoqueMin, this.pro_estoqueMax, this.pro_dataCadastro, this.pro_codigoBarra, this.pro_marca, this.pro_fornecedor, this.pro_tamanho, this.pro_margem, this.pro_comissao, this.cfop, this.ncm, this.pro_aliquota, this.porcentagem_tributos, this.pro_csosn, this.pro_cst, this.cest);
         objDAL          = null;
     }catch (Exception) {
         throw;
     }
 }
Exemple #7
0
 public DataTable localizarEmTudo(String descricao)
 {
     try{
         DataTable tab;
         objDAL = new ProdutosDAL();
         tab    = objDAL.localizarEmTudo(descricao);
         objDAL = null;
         return(tab);
     }catch (Exception) {
         throw;
     }
 }
Exemple #8
0
        public void CarregarAlertas()
        {
            ProdutosDAL objDal = new ProdutosDAL();

            try
            {
                DataTable tab   = null;
                DataTable tabcp = null;
                DataTable tabcr = null;
                tabcr = LocalizarContasAReceber();
                tabcp = LocalizarContasAPagar();
                tab   = objDal.localizarProdutoEstoque();

                if (tabcr.Rows.Count > 0)
                {
                    dgContasAReceber.Visible    = true;
                    dgContasAReceber.DataSource = tabcr;
                    lblContasAReber.Visible     = true;
                }
                else
                {
                    dgContasAReceber.Visible = false;
                    lblContasAReber.Visible  = false;
                }


                if (tabcp.Rows.Count > 0)
                {
                    dgContasAPgAlerta.Visible    = true;
                    dgContasAPgAlerta.DataSource = tabcp;
                    lblcpAlerta.Visible          = true;
                }
                else
                {
                    dgContasAPgAlerta.Visible = false;
                    lblcpAlerta.Visible       = false;
                }
                if (tab.Rows.Count > 0)
                {
                    txtAlerta.Visible = true;
                    txtAlerta.Text    = "Atenção existe produtos com estoque zerado ou estoque mínimo na sua capacidade";
                }
                else
                {
                    txtAlerta.Visible = false;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #9
0
 public DataTable localizarComRetorno(String descricao, String atributo)
 {
     try{
         DataTable tab;
         objDAL = new ProdutosDAL();
         tab    = objDAL.localizar(descricao, atributo);
         objDAL = null;
         return(tab);
     }
     catch (Exception) {
         throw;
     }
 }
Exemple #10
0
 public void localizar()
 {
     try
     {
         objDAL          = new ProdutosDAL();
         this.pro_codigo = objDAL.localizar(this.pro_codigo);
         objDAL          = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #11
0
 public void excluir()
 {
     try
     {
         objDAL = new ProdutosDAL();
         objDAL.excluir(this.pro_codigo);
         objDAL = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #12
0
 public void alterarQuantidade()
 {
     try
     {
         objDAL = new ProdutosDAL();
         objDAL.alterarQuantidade(this.pro_codigo, this.pro_quantidade);
         objDAL = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #13
0
 public DataTable localizarEmTudoLITE(String descricao, Boolean ver_tudo)
 {
     try
     {
         DataTable tab;
         objDAL = new ProdutosDAL();
         tab    = objDAL.localizarEmTudo_LITE(descricao, ver_tudo);
         objDAL = null;
         return(tab);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #14
0
 public void localizarPrimeiroUltimo(String descricao)
 {
     try{
         DataTable tab    = null;
         int       codigo = 0;
         objDAL = new ProdutosDAL();
         tab    = objDAL.localizarPrimeiroUltimo(descricao);
         if (tab.Rows.Count > 0)
         {
             int.TryParse(tab.Rows[0][0].ToString(), out codigo);
         }
         this.pro_codigo = codigo;
         objDAL          = null;
     }
     catch (Exception) {
         throw;
     }
 }
Exemple #15
0
 public void localizarProxAnterior(String descricao, int codigo)
 {
     try
     {
         DataTable tab = null;
         objDAL = new ProdutosDAL();
         tab    = objDAL.localizarProxAnterior(descricao, codigo);
         if (tab.Rows.Count > 0)
         {
             this.pro_codigo = int.Parse(tab.Rows[0][0].ToString());
         }
         objDAL = null;
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #16
0
        public void VerificaProduto(Produtos prod)
        {
            Contexto    contexto = new Contexto();
            ProdutosDAL dal      = new ProdutosDAL();

            Produtos produto = contexto.Produto.FirstOrDefault(x => x.codigo == prod.codigo);

            if (produto == null)
            {
                dal.Insert(prod);
            }
            else
            {
                prod.id          = produto.id;
                prod.quantidade += produto.quantidade;

                dal.Update(prod);
            }
        }
Exemple #17
0
        public void localizar(String descricao, String atributo)
        {
            try
            {
                DataTable tab;
                objDAL = new ProdutosDAL();

                tab = objDAL.localizar(atributo, descricao);
                if (tab.Rows.Count > 0)
                {
                    this.pro_codigo     = int.Parse(tab.Rows[0]["pro_codigo"].ToString());
                    this.pro_nome       = tab.Rows[0]["pro_nome"].ToString();
                    this.pro_quantidade = int.Parse(tab.Rows[0]["pro_quantidade"].ToString());
                    this.pro_precoCusto = Decimal.Parse(tab.Rows[0]["pro_precoCusto"].ToString());
                    this.pro_precoVenda = Decimal.Parse(tab.Rows[0]["pro_precoVenda"].ToString());
                    this.pro_categoria  = int.Parse(tab.Rows[0]["pro_categoria"].ToString());
                    if (tab.Rows[0]["pro_grupo"] != DBNull.Value)
                    {
                        this.pro_grupo = int.Parse(tab.Rows[0]["pro_grupo"].ToString());
                    }
                    else
                    {
                        this.pro_grupo = 0;
                    }
                    if (tab.Rows[0]["pro_subGrupo"] != DBNull.Value)
                    {
                        this.pro_subGrupo = int.Parse(tab.Rows[0]["pro_subGrupo"].ToString());
                    }
                    else
                    {
                        this.pro_subGrupo = 0;
                    }
                    if (tab.Rows[0]["pro_unidade"] != DBNull.Value)
                    {
                        this.pro_unidade = int.Parse(tab.Rows[0]["pro_unidade"].ToString());
                    }
                    else
                    {
                        this.pro_unidade = 0;
                    }
                    //this.pro_estoqueMin = int.Parse(tab.Rows[0]["   "].ToString());
                    //this.pro_estoqueMax = int.Parse(tab.Rows[0]["pro_estoqueMax"].ToString());
                    this.pro_dataCadastro = DateTime.Parse(tab.Rows[0]["pro_dataCadastro"].ToString());
                    if (tab.Rows[0]["pro_codigoBarra"] != DBNull.Value)
                    {
                        this.pro_codigoBarra = tab.Rows[0]["pro_codigoBarra"].ToString();
                    }
                    else
                    {
                        this.pro_codigoBarra = null;
                    }

                    try { this.pro_marca = int.Parse(tab.Rows[0]["pro_marca"].ToString()); }
                    catch { }
                    this.pro_fornecedor = int.Parse(tab.Rows[0]["pro_fornecedor"].ToString());

                    if (tab.Rows[0]["pro_tamanho"] != DBNull.Value)
                    {
                        this.pro_tamanho = int.Parse(tab.Rows[0]["pro_tamanho"].ToString());
                    }
                    else
                    {
                        this.pro_tamanho = 0;
                    }

                    if (tab.Rows[0]["pro_margem"] != DBNull.Value)
                    {
                        this.pro_margem = Decimal.Parse(tab.Rows[0]["pro_margem"].ToString());
                    }
                    else
                    {
                        this.pro_margem = 0;
                    }
                    //
                    //if (tab.Rows[0]["pro_comissao"] != DBNull.Value)
                    //    this.pro_comissao = Decimal.Parse(tab.Rows[0]["pro_comissao"].ToString());
                    //else
                    //    this.pro_comissao = 0;
                }
                objDAL = null;
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #18
0
        public void localizarLeave(String descricao, String atributo)
        {
            try{
                DataTable tab;
                objDAL = new ProdutosDAL();
                tab    = objDAL.localizarLeave(descricao, atributo);

                if (tab.Rows.Count > 0)
                {
                    this.pro_codigo       = int.Parse(tab.Rows[0]["pro_codigo"].ToString());
                    this.pro_nome         = tab.Rows[0]["pro_nome"].ToString();
                    this.pro_quantidade   = int.Parse(tab.Rows[0]["pro_quantidade"].ToString());
                    this.pro_precoCusto   = Decimal.Parse(tab.Rows[0]["pro_precoCusto"].ToString());
                    this.pro_precoVenda   = Decimal.Parse(tab.Rows[0]["pro_precoVenda"].ToString());
                    this.pro_precoAtacado = Decimal.Parse(tab.Rows[0]["precoAtacado"].ToString());
                    this.pro_categoria    = int.Parse(tab.Rows[0]["pro_categoria"].ToString());
                    if (tab.Rows[0]["pro_grupo"] != DBNull.Value)
                    {
                        this.pro_grupo = int.Parse(tab.Rows[0]["pro_grupo"].ToString());
                    }
                    else
                    {
                        this.pro_grupo = 0;
                    }
                    if (tab.Rows[0]["pro_subGrupo"] != DBNull.Value)
                    {
                        this.pro_subGrupo = int.Parse(tab.Rows[0]["pro_subGrupo"].ToString());
                    }
                    else
                    {
                        this.pro_subGrupo = 0;
                    }
                    if (tab.Rows[0]["pro_unidade"] != DBNull.Value)
                    {
                        this.pro_unidade = int.Parse(tab.Rows[0]["pro_unidade"].ToString());
                    }
                    else
                    {
                        this.pro_unidade = 0;
                    }
                    this.pro_estoqueMin   = int.Parse(tab.Rows[0]["pro_estoqueMin"].ToString());
                    this.pro_estoqueMax   = int.Parse(tab.Rows[0]["pro_estoqueMax"].ToString());
                    this.pro_dataCadastro = DateTime.Parse(tab.Rows[0]["pro_dataCadastro"].ToString());
                    if (tab.Rows[0]["pro_codigoBarra"] != DBNull.Value)
                    {
                        this.pro_codigoBarra = tab.Rows[0]["pro_codigoBarra"].ToString();
                    }
                    else
                    {
                        this.pro_codigoBarra = null;
                    }
                    try {
                        this.pro_marca = int.Parse(tab.Rows[0]["pro_marca"].ToString());
                    }
                    catch { }
                    this.pro_fornecedor = int.Parse(tab.Rows[0]["pro_fornecedor"].ToString());
                    if (tab.Rows[0]["pro_tamanho"] != DBNull.Value)
                    {
                        this.pro_tamanho = int.Parse(tab.Rows[0]["pro_tamanho"].ToString());
                    }
                    else
                    {
                        this.pro_tamanho = 0;
                    }
                    if (tab.Rows[0]["pro_margem"] != DBNull.Value)
                    {
                        this.pro_margem = Decimal.Parse(tab.Rows[0]["pro_margem"].ToString());
                    }
                    else
                    {
                        this.pro_margem = 0;
                    }
                    if (tab.Rows[0]["pro_comissao"] != DBNull.Value)
                    {
                        this.pro_comissao = Decimal.Parse(tab.Rows[0]["pro_comissao"].ToString());
                    }
                    else
                    {
                        this.pro_comissao = 0;
                    }

                    if (tab.Rows[0]["pro_cfop"] != DBNull.Value)
                    {
                        this.cfop = Int32.Parse(tab.Rows[0]["pro_cfop"].ToString());
                    }
                    else
                    {
                        this.cfop = 0;
                    }

                    this.ncm = tab.Rows[0]["pro_ncm"].ToString().Trim();

                    try { this.pro_imagem = (byte[])tab.Rows[0]["Imagem"]; }catch { }
                    try { this.pro_aliquota = decimal.Parse(tab.Rows[0]["aliquota"].ToString().Trim()); }catch { }
                    try { this.porcentagem_tributos = decimal.Parse(tab.Rows[0]["porcentagem_tributos"].ToString().Trim()); }catch { }
                    try { this.pro_csosn = tab.Rows[0]["csosn"].ToString().Trim(); }catch { }
                    try { this.pro_cst = tab.Rows[0]["cst"].ToString().Trim(); }catch { }
                    try { this.cest = tab.Rows[0]["cest"].ToString().Trim(); }catch { }
                }
                objDAL = null;
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #19
0
        public void Delete(Produtos produto)
        {
            ProdutosDAL dal = new ProdutosDAL();

            dal.Delete(produto);
        }
Exemple #20
0
        public DataTable Listagem(string filtro)
        {
            ProdutosDAL obj = new ProdutosDAL();

            return(obj.Listagem(filtro));
        }