public static List <Fornecedor> SelectAll()
        {
            Fornecedor        c;
            List <Fornecedor> cs = new List <Fornecedor>();

            try
            {
                using (conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    string        s   = "SELECT * FROM Fornecedor";
                    SqlCommand    cmd = new SqlCommand(s, conn);
                    SqlDataReader d;
                    using (d = cmd.ExecuteReader())
                    {
                        if (d.HasRows)
                        {
                            while (d.Read())
                            {
                                int      i    = Convert.ToInt32(d["id"]);
                                string   n    = d["Nome"].ToString();
                                string   cpf  = (d["CPF"] != null) ? d["CPF"].ToString() : "";
                                string   cnpj = (d["CNPJ"] != null) ? d["CNPJ"].ToString() : "";
                                string   e    = d["Email"].ToString();
                                Endereco end  = DALEndereco.SelectFromFornecedor(i);
                                Telefone t    = DALTelefone.SelectFromFornecedor(i);
                                c = new Fornecedor(i, n, e, end, t);
                                if (cpf != "")
                                {
                                    c.setCPF(cpf);
                                }
                                else
                                {
                                    c.setCNPJ(cnpj);
                                }
                                cs.Add(c);
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(cs);
        }
        public static Fornecedor Select(int i)
        {
            Fornecedor c = new Fornecedor();

            try
            {
                using (conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    string     s   = "SELECT * FROM Fornecedor WHERE id = @id ";
                    SqlCommand cmd = new SqlCommand(s, conn);
                    cmd.Parameters.Add("@id", SqlDbType.Int).Value = i;
                    SqlDataReader d;
                    using (d = cmd.ExecuteReader())
                    {
                        if (d.HasRows)
                        {
                            while (d.Read())
                            {
                                string   n    = d["Nome"].ToString();
                                string   cpf  = (d["CPF"] != null) ? d["CPF"].ToString() : "";
                                string   cnpj = (d["CNPJ"] != null) ? d["CNPJ"].ToString() : "";
                                string   e    = d["Email"].ToString();
                                Endereco end  = DALEndereco.SelectFromFornecedor(i);
                                Telefone t    = DALTelefone.SelectFromFornecedor(i);
                                c = new Fornecedor(i, n, e, end, t);
                                if (cpf != "")
                                {
                                    c.setCPF(cpf);
                                }
                                else
                                {
                                    c.setCNPJ(cnpj);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(c);
        }