Colocar mensagem

Delphi

22/08/2003

BOA TARDE SENHORES, ESTOU NOVAMENTE EM SÉRIOS APUROS COM UM SISTEMA DE PONTO QUE ESTOU FAZENDO, GOSTARIA DE SABER COMO FAÇO PARA CADASTRAR UMA CAMPO QUE POSSUO EM UMA OUTRA TABELA NUMA TABELA DE CONTROLE QUE CRIEI.

EX.: TENHO UMA TABELA AONDE DEFINI ´BOM DIA´ ; ´BOM ALMOÇO´ E ASSIM POR DIANTE, GOSTARIA QUE QUANDO O USUÁRIO PASASSE O SEU CARTÃO EM HORÁRIOS ESTABELECIDOS, ESSAS MENSAGENS FOSSEM CADASTRADAS DENTRO DA TABELA CONTROLE, OU QUE EU PUDESSE VIZUALIZAR AS MESMAS PESQUISANDO PELO ´CPF´ DO USUÁRIO.

ATENCIOSAMENTE


Rscrj

Rscrj

Curtidas 0

Respostas

Bacalhau

Bacalhau

22/08/2003

Primeiro passo: detectas a hora e guardas numa variável do tipo TTime

var hora :: TTime;

<aqui é detectada a hora>

if ((hora >= strtotime(´09:00:00´)) and (hora <= strtotime(´10:30:00´))
then <mostra bom dia>;

if ((hora >= strtotime(´12:00:00´)) and (hora <= strtotime(´14:30:00´))
then <mostra bom almoço>

e por aí fora.

Como é óbvio, na tabela que contém as mensagens tem de haver uma forma de lhe aceder através da hora a que passou o cartão.

Por exemplo

if ((hora >= strtotime(´09:00:00´)) and (hora >= strtotime(´10:30:00´))
then
begin
table1.open;
table1.first;
table1.moveby(5)
showmessage(table1.fieldbyname(´Mensagem´).asstring);

// nesta caso se é de manhã (entre as 9 e 10:30), mostra a mensagem
// contida no 5º registo da tabela. Haverá muitos outros processos
end;

Abraço
bacalhau


GOSTEI 0
Rscrj

Rscrj

22/08/2003

A Ajuda veio em boa hora, o controle esta funcionando perfeitamente.

Obrigado.


GOSTEI 0
POSTAR