Exemple #1
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;
            }
        }