-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestes.c
More file actions
165 lines (112 loc) · 3.47 KB
/
Testes.c
File metadata and controls
165 lines (112 loc) · 3.47 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#include "constantes.h"
int verificarLogin(HWND usuario, HWND senha, HWND tela){
char string[30], string2[30];
GetWindowText(usuario, string, 30);
GetWindowText(senha, string2, 30);
if(strlen(string) == 0 || strlen(string2) == 0){
MessageBoxW(tela, L"Campo(s) nao preenchido(s)", L"Erro", MB_OK | MB_ICONINFORMATION);
return 0;
}
else{
if (strcmp(string, "admin") == 0 && strcmp(string2, "121314") == 0){
return 1;
}
else{
MessageBoxW(tela, L"Usuario ou Senha invalido(s)", L"Erro", MB_OK | MB_ICONINFORMATION);
return 0;
}
}
}
int verificarCadastro(HWND cpf, HWND nasc, HWND nome, HWND tela){
char string[30], string1[30], string2[30];
int index;
GetWindowText(cpf, string, 30);
GetWindowText(nasc, string1, 30);
GetWindowText(nome, string2, 30);
if(strlen(string) == 0 || strlen(string1) == 0 || strlen(string2) == 0){
MessageBoxW(tela, L"Campo(s) nao preenchido(s)", L"Erro", MB_OK | MB_ICONINFORMATION);
return 0;
}
else{
index = procurarHospede(atoll(string));
if(index == -1){
cadastrarHospede(retornaHospede(cpf, nome, nasc));
salvarHospedes(hospedes_cadastrados);
MessageBoxW(tela, L"Hospede Cadastrado", L"OK", MB_OK | MB_ICONINFORMATION);
return 1;
}
else{
MessageBoxW(tela, L"Hospede ja Cadastrado", L"ERRO", MB_OK | MB_ICONINFORMATION);
return 0;
}
}
}
int verificarEdicao(HWND cpf, HWND nasc, HWND nome, HWND tela){
char string[30], string1[30], string2[30];
int index;
GetWindowText(cpf, string, 30);
GetWindowText(nasc, string1, 30);
GetWindowText(nome, string2, 30);
if(strlen(string) == 0 || strlen(string1) == 0 || strlen(string2) == 0){
MessageBoxW(tela, L"Campo(s) nao preenchido(s)", L"Erro", MB_OK | MB_ICONINFORMATION);
return 0;
}
else{
index = procurarHospede(atoll(string));
if(index == -1){
atualizarInformacoesHospede(edit4, edit2, edit1, edit3);
MessageBoxW(tela, L"Hospede Editado", L"OK", MB_OK | MB_ICONINFORMATION);
return 1;
}
else{
MessageBoxW(tela, L"Hospede ja Cadastrado", L"ERRO", MB_OK | MB_ICONINFORMATION);
return 0;
}
}
}
int verificarPesquisa(HWND cpf, HWND tela){
char string[30], out[300];
int index, cpf1;
GetWindowText(cpf, string, 30);
if(strlen(string) == 0){
MessageBoxW(tela, L"Campo(s) nao preenchido(s)", L"Erro", MB_OK | MB_ICONINFORMATION);
return -1;
}
else{
index = procurarHospede(atoll(string));
if(index == -1){
MessageBoxW(tela, L"Nao Cadastrado", L"Erro", MB_OK | MB_ICONINFORMATION);
return -1;
}
else{
return index;
}
}
}
int verificaAbrirContrato(HWND dataInicial, HWND diasEstadias, HWND cartaoCredito){
char string[30], string2[30], string3[30];
GetWindowText(dataInicial, string, 30);
GetWindowText(diasEstadias, string2, 30);
GetWindowText(cartaoCredito, string3, 30);
if(strlen(string) == 0 || strlen(string2) == 0 || strlen(string3) == 0){
return -1;
}
else{
return 0;
}
}
int verificarExisteContratoAberto(HWND tela, HWND cpf){
char string[30];
GetWindowText(cpf, string, 30);
if(strlen(string) == 0){
MessageBoxW(tela, L"Campo nao preenchido", L"Erro", MB_OK | MB_ICONINFORMATION);
return -1;
}
if(retornaIndexContrato(cpf) == -1){
MessageBoxW(tela, L"Contrato nao Encontrado", L"Erro", MB_OK | MB_ICONINFORMATION);
return -1;
}
else{
return 0;
}
}