public override bool Atualizar()
        {
            if (cBCliente.Text == "")
            {
                MessageBox.Show("Selecione um Cliente para atualizar!");
                return false;
            }
            else
            {
                var result = MessageBox.Show("Deseja realmente atualizar esse agendamento?", "Atualização de Dados", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {

                    VisitasDTO dto = new VisitasDTO();
                    dto.CLI_CPF = cBCliente.SelectedValue.ToString();
                    dto.VEND_ID = int.Parse(cBVendedor.SelectedValue.ToString());
                    dto.VIS_DATA = DateTime.Parse(dTPData.Text);
                    dto.VIS_HORA = TimeSpan.Parse(dTPHora.Text);
                    dto.VIS_DESCRICAO = txtDescrição.Text;

                    bll.Atualizar(dto);
                    CarregaGrid();
                    LimpaControles();
                    return true;
                }

                return false;
            }
        }
        public void Atualizar(VisitasDTO visi)
        {
            try
            {
                con = new ConexaoDAL();
                con.Conectar();

                SqlCommand commando = new SqlCommand();
                commando.Connection = con.Conexao;

                commando.CommandText = "UPDATE VISITAS SET CLI_CPF = @CLI_CPF, VEND_ID = @VEND_ID,VIS_DATA = @VIS_DATA,VIS_HORA = @VIS_HORA,VIS_DESCRICAO = @VIS_DESCRICAO WHERE VEND_ID = @VEND_ID ";

                commando.Parameters.Add("@CLI_CPF", SqlDbType.VarChar, 15);
                commando.Parameters["@CLI_CPF"].Value = visi.CLI_CPF;

                commando.Parameters.Add("@VEND_ID", SqlDbType.Int);
                commando.Parameters["@VEND_ID"].Value = visi.VEND_ID;

                commando.Parameters.Add("@VIS_DATA", SqlDbType.Date);
                commando.Parameters["@VIS_DATA"].Value = visi.VIS_DATA;

                commando.Parameters.Add("@VIS_HORA", SqlDbType.Time);
                commando.Parameters["@VIS_HORA"].Value = visi.VIS_HORA;

                commando.Parameters.Add("@VIS_DESCRICAO", SqlDbType.VarChar, 200);
                commando.Parameters["@VIS_DESCRICAO"].Value = visi.VIS_DESCRICAO;

                commando.ExecuteNonQuery();

                con.Desconectar();

            }
            catch (Exception erro)
            {
                MessageBox.Show(erro.Message);

            }
        }
        public void Excluir(VisitasDTO visi)
        {
            try
            {
                con = new ConexaoDAL();
                con.Conectar();

                SqlCommand commando = new SqlCommand();
                commando.Connection = con.Conexao;

                commando.CommandText = "DELETE FROM VISITAS WHERE CLI_CPF = @CLI_CPF ";
                commando.Parameters.Add("@CLI_CPF", SqlDbType.VarChar);
                commando.Parameters["@CLI_CPF"].Value = visi.CLI_CPF;

                commando.ExecuteNonQuery();

                con.Desconectar();

            }
            catch (Exception erro)
            {
                MessageBox.Show(erro.Message);

            }
        }
        public void Salvar(VisitasDTO visi)
        {
            try
            {
                con = new ConexaoDAL();
                con.Conectar();

                SqlCommand commando = new SqlCommand();
                commando.Connection = con.Conexao;

                commando.CommandText = "INSERT INTO VISITAS(CLI_CPF,VEND_ID,VIS_DATA,VIS_HORA,VIS_DESCRICAO)VALUES (@CLI_CPF,@VEND_ID,@VIS_DATA,@VIS_HORA,@VIS_DESCRICAO)";
                commando.Parameters.Add("@CLI_CPF", SqlDbType.VarChar, 15);
                commando.Parameters["@CLI_CPF"].Value = visi.CLI_CPF;

                commando.Parameters.Add("@VEND_ID", SqlDbType.Int);
                commando.Parameters["@VEND_ID"].Value = visi.VEND_ID;

                commando.Parameters.Add("@VIS_DATA", SqlDbType.Date);
                commando.Parameters["@VIS_DATA"].Value = visi.VIS_DATA;

                commando.Parameters.Add("@VIS_HORA", SqlDbType.Time);
                commando.Parameters["@VIS_HORA"].Value = visi.VIS_HORA;

                commando.Parameters.Add("@VIS_DESCRICAO", SqlDbType.VarChar,200);
                commando.Parameters["@VIS_DESCRICAO"].Value = visi.VIS_DESCRICAO;

                commando.ExecuteNonQuery();

                con.Desconectar();

            }
            catch (Exception erro)
            {
                MessageBox.Show(erro.Message);

            }
        }
        public override bool Excluir()
        {
            if (cBCliente.SelectedText == "")
            {
                MessageBox.Show("Escolha um cliente para deletar!");
                return false;
            }
            else
            {
                var result = MessageBox.Show("Deseja realmente deletar esse agendamento?", "Exclusão de Login", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    VisitasDTO dto = new VisitasDTO();
                    dto.CLI_CPF = cBCliente.SelectedValue.ToString();

                    bll.Excluir(dto);
                    CarregaGrid();
                    return true;
                }
            }

            return false;
        }
        public override bool Salvar()
        {
            if (cBCliente.SelectedText == "" && cBVendedor.SelectedText == "" && dTPData.Text == "" && dTPHora.Text == "" && txtDescrição.Text == "")
            {

                MessageBox.Show("Preencha todos os campos!");

            }
            else
            {
                try
                {
                    VisitasDTO dto = new VisitasDTO();
                    dto.CLI_CPF = cBCliente.SelectedValue.ToString();
                    dto.VEND_ID = int.Parse(cBVendedor.SelectedValue.ToString());
                    dto.VIS_DATA = DateTime.Parse(dTPData.Text);
                    dto.VIS_HORA = TimeSpan.Parse(dTPHora.Text);
                    dto.VIS_DESCRICAO = txtDescrição.Text;

                    bll.Salvar(dto);
                    CarregaGrid();

                    btnDeletar.Enabled = true;
                    btnAtualizar.Enabled = true;

                }catch(Exception)
                {

                }

            }
            return true;
        }