@Override	
	public Boolean salvar(AgendaBean bean) {
		PreparedStatement ps = null;
		Long key = 0L;
		
		try {
			StatusServicoBean statusBean = getStatusServicoBy(bean.getSiglaStatusServico());
			bean.setIdStatusServico(statusBean.getIdStatusServico());
			
			Date date =  sdf.parse(bean.getDataServico());
			Timestamp timestamp = new Timestamp(date.getTime());
						
			conn.setAutoCommit(false);
			
			String SQL = "INSERT INTO Dig_Agenda (id_Cliente, id_Status_Servico, id_Usuario, id_Veiculo, data_Servico, deHorarioAgendamento, ateHorarioAgendamento, id_Empresa, obs)" +
			 		" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";

			 ps = conn.prepareStatement(SQL, Statement.RETURN_GENERATED_KEYS);	
			 
			 if(bean.getIdCliente() == null || bean.getIdCliente() == 0){
				 ps.setNull(1, java.sql.Types.BIGINT);
			 }else{
				 ps.setLong(1, bean.getIdCliente());				 
			 }			 
			 ps.setLong(2, bean.getIdStatusServico());
			 ps.setLong(3, bean.getIdUsuario());
			 ps.setLong(4, bean.getIdVeiculo());
			 ps.setTimestamp(5, timestamp);
			 ps.setString(6, bean.getDeHorarioAgendamento());
			 ps.setString(7, bean.getAteHorarioAgendamento());
			 ps.setLong(8, bean.getIdEmpresa());
			 ps.setString(9, bean.getObsAgendamento());
			 
			 ps.execute();
			 
			 ResultSet rs = ps.getGeneratedKeys();
			 
			 if (rs != null && rs.next()) {
				    key = rs.getLong(1);
				}	
			 
			 for(ServicosBean servicosBean : bean.getListServicosBean()){
				 
				 SQL = "INSERT INTO Dig_Agenda_Servicos VALUES (?, ?)";
				 
				 ps = conn.prepareStatement(SQL);
				 
				 ps.setLong(1, key);
				 ps.setLong(2, servicosBean.getIdServicos());
				 
				 ps.execute();
			 }
			 
			 conn.commit();
			
			 return true;
			 
		}catch(SQLException sql){
			sql.printStackTrace();
		}catch(Exception e){
			e.printStackTrace();

		}finally{
			try {
				ps.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
			fecharConexao();
		}		
		return false;
	}