-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHospede.c
More file actions
85 lines (52 loc) · 1.66 KB
/
Hospede.c
File metadata and controls
85 lines (52 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "constantes.h"
int contHospedes = 0;
Hospede retornaHospede(HWND cpf, HWND nome, HWND dataNasc){
Hospede aux;
char string[30];
GetWindowText(nome, aux.nome, 30);
GetWindowText(dataNasc, aux.dataNascimento, 30);
GetWindowText(cpf, string, 30);
aux.cpf = atoll(string);
return aux;
}
void cadastrarHospede(Hospede hospede){
hospedes_cadastrados[contHospedes] = hospede;
contHospedes++;
}
int procurarHospede(long long int cpf){
int i;
for(i = 0; i < contHospedes; i++){
if (hospedes_cadastrados[i].cpf == cpf){
return i;
}
}
return -1;
}
Hospede objetoHospede(HWND cpf){
int i;
char string[30];
GetWindowText(cpf, string, 30);
for(i = 0; i < contHospedes; i++){
if (hospedes_cadastrados[i].cpf == atoll(string)){
return hospedes_cadastrados[i];
}
}
}
void atualizarInformacoesHospede(HWND antigoCpf, HWND cpf, HWND nome, HWND dataNasc){
char string[30];
int contrato = retornaIndexContrato(antigoCpf);
int contrato2 = retornaIndexContratoFechado(antigoCpf);
GetWindowText(antigoCpf, string, 30);
int posHospede = procurarHospede(atoll(string));
GetWindowText(nome, hospedes_cadastrados[posHospede].nome, 30);
GetWindowText(dataNasc, hospedes_cadastrados[posHospede].dataNascimento, 30);
GetWindowText(cpf, string, 30);
hospedes_cadastrados[posHospede].cpf = atoll(string);
if(contrato != -1){
contratos_abertos[contrato].hospede = hospedes_cadastrados[posHospede];
}
if(contrato2 != -1){
contrato_fechados[contrato2].hospede = hospedes_cadastrados[posHospede];
}
salvarHospedes(hospedes_cadastrados);
}