public static void ExcluirConveniado(ConveniadoVO conveniado)
        {
            SqlParameter spId = new SqlParameter("@id", SqlDbType.Int)
            {
                Value = conveniado.Id
            };

            using (BancoDados bd = new BancoDados())
            {
                bd.NonQuery("SP_EXCLUIR_CONVENIADO", CommandType.StoredProcedure, spId);
            }
        }
        public static void ExcluirCorretora(CorretoraVO corretora)
        {
            SqlParameter spId = new SqlParameter("@id", SqlDbType.Int)
            {
                Value = corretora.Id
            };

            using (BancoDados bd = new BancoDados())
            {
                bd.NonQuery("SP_EXCLUIR_CORRETORA", CommandType.StoredProcedure, spId);
            }
        }
        public static void InserirCorretora(CorretoraVO corretora)
        {
            SqlParameter spNome = new SqlParameter("@nome", SqlDbType.VarChar, 100)
            {
                Value = corretora.Nome
            };
            SqlParameter spPercentual = new SqlParameter("@perc", SqlDbType.Float)
            {
                Value = corretora.Percentual
            };

            using (BancoDados bd = new BancoDados())
            {
                bd.NonQuery("SP_INCLUSAO_CORRETORA", CommandType.StoredProcedure, spNome, spPercentual);
            }
        }
        public static void AlterarConveniado(ConveniadoVO conveniado)
        {
            SqlParameter spId = new SqlParameter("@idCorretora", SqlDbType.Int)
            {
                Value = conveniado.IdCorretora
            };
            SqlParameter spNome = new SqlParameter("@nome", SqlDbType.VarChar, 100)
            {
                Value = conveniado.Nome
            };
            SqlParameter spPercentual = new SqlParameter("@nascimento", SqlDbType.DateTime)
            {
                Value = conveniado.Nascimento
            };

            using (BancoDados bd = new BancoDados())
            {
                bd.NonQuery("SP_ALTERAR_CONVENIADO", CommandType.StoredProcedure, spId, spNome, spPercentual);
            }
        }
        public static void InserirConveniado(ConveniadoVO conveniado)
        {
            SqlParameter spNome = new SqlParameter("@nome", SqlDbType.VarChar, 100)
            {
                Value = conveniado.Nome
            };
            SqlParameter spNascimento = new SqlParameter("@nascimento", SqlDbType.DateTime)
            {
                Value = conveniado.Nascimento
            };
            SqlParameter spIdCorretora = new SqlParameter("@Idcorretora", SqlDbType.Int, 100)
            {
                Value = conveniado.IdCorretora
            };

            using (BancoDados bd = new BancoDados())
            {
                bd.NonQuery("SP_INCLUSAO_CONVENIADO", CommandType.StoredProcedure, spNome, spNascimento, spIdCorretora);
            }
        }
        public static IList <CorretoraVO> ListarCorretora()
        {
            List <CorretoraVO> listaCorretoras = new List <CorretoraVO>();

            using (BancoDados bd = new BancoDados())
            {
                using (SqlDataReader reader = bd.Reader("SP_LISTAR_CORRETORAS", CommandType.StoredProcedure))
                {
                    while (reader.Read())
                    {
                        listaCorretoras.Add(new CorretoraVO()
                        {
                            Id         = Convert.ToInt32(reader.GetValue(0)),
                            Nome       = reader.VarCharParaString("nome"),
                            Percentual = reader.DoubleParaFloat("percentual")
                        });
                    }
                }
            }
            return(listaCorretoras);
        }
        public static IList <ConveniadoVO> ListarConveniado()
        {
            List <ConveniadoVO> listaConveniado = new List <ConveniadoVO>();

            using (BancoDados bd = new BancoDados())
            {
                using (SqlDataReader reader = bd.Reader("SP_LISTAR_CONVENIADO", CommandType.StoredProcedure))
                {
                    while (reader.Read())
                    {
                        listaConveniado.Add(new ConveniadoVO()
                        {
                            Id          = Convert.ToInt32(reader.GetValue(0)),
                            Nome        = Convert.ToString(reader.GetValue(1)),
                            IdCorretora = Convert.ToInt32(reader.GetValue(3)),
                            Nascimento  = Convert.ToDateTime(reader.GetValue(2))
                        });
                    }
                }
            }
            return(listaConveniado);
        }