-
Notifications
You must be signed in to change notification settings - Fork 2
/
Form_Partidos.frm
347 lines (327 loc) · 11.4 KB
/
Form_Partidos.frm
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frm_partidos
BorderStyle = 3 'Fixed Dialog
Caption = "Cadastro de Partidos"
ClientHeight = 4740
ClientLeft = 45
ClientTop = 435
ClientWidth = 6705
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4740
ScaleWidth = 6705
ShowInTaskbar = 0 'False
Begin MSFlexGridLib.MSFlexGrid msflex
Height = 2415
Left = 120
TabIndex = 10
Top = 1440
Width = 6495
_ExtentX = 11456
_ExtentY = 4260
_Version = 393216
Cols = 3
FormatString = ""
End
Begin VB.Frame Frame1
Caption = "Auxiliares e Navegação"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 120
TabIndex = 5
Top = 3840
Width = 6495
Begin VB.CommandButton cmd_alterar
Caption = "Alterar"
Height = 495
Left = 4440
TabIndex = 9
Top = 240
Width = 1335
End
Begin VB.CommandButton cmd_excluir
Caption = "Excluir"
Height = 495
Left = 3000
TabIndex = 8
Top = 240
Width = 1335
End
Begin VB.CommandButton cmd_incluir
Caption = "Incluir"
Height = 495
Left = 1560
TabIndex = 7
Top = 240
Width = 1335
End
Begin VB.CommandButton cmd_novo
Caption = "Novo"
Height = 495
Left = 120
TabIndex = 6
Top = 240
Width = 1335
End
End
Begin VB.Frame Frame3
Caption = "Partidos"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1215
Left = 120
TabIndex = 0
Top = 120
Width = 6495
Begin VB.TextBox txt_sigla
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 12
Top = 720
Width = 1095
End
Begin VB.TextBox txt_nome
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 2
Top = 240
Width = 3015
End
Begin VB.TextBox txt_legenda
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 1
Top = 240
Width = 735
End
Begin VB.Label Label1
Caption = "Sigla"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 11
Top = 720
Width = 975
End
Begin VB.Label Label6
Caption = "Nome"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2040
TabIndex = 4
Top = 360
Width = 615
End
Begin VB.Label Label5
Caption = "Legenda"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 3
Top = 360
Width = 975
End
End
End
Attribute VB_Name = "frm_partidos"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim L_Colunas, L_Linha As Long
Dim L_Buscar As Integer
Dim L_CodColi As Integer
Dim l_coli As Integer
Dim L_par As Integer
Private Sub alterar()
tab_par.Update
tab_par!legenda = txt_legenda
tab_par!sigla = txt_sigla
tab_par!Partido = txt_nome
tab_par.Update
End Sub
Private Sub cmd_alterar_Click()
On Error GoTo penis2:
status = " alteradas"
Call Fechar
tab_par.Open "Select * From Partidos where Partido = '" & txt_nome & "'"
If tab_par.RecordCount <> 0 Then
tab_pcd.Open "select * from Presidentes where legenda = " & txt_legenda
If tab_pcd.RecordCount = 0 Then
tab_gcd.Open "select * from Governadores where legenda = " & txt_legenda
If tab_gcd.RecordCount = 0 Then
Call alterar
Call box_1
Call carrega_lista
Exit Sub
End If
End If
End If
penis2:
MsgBox "Favor excluir ou alterar os candidatos deste partido antes de excluir o mesmo.", vbExclamation, "Allia"
End Sub
Private Sub cmd_excluir_Click()
On Error GoTo penis3
status = " Excluídas"
Call Fechar
If MsgBox("Deseja realmente excluir estas informações?", vbYesNo + vbDefaultButton2 + vbQuestion) = vbYes Then
tab_par.Open "Select * From Partidos where Partido = '" & txt_nome & "'"
If tab_par.RecordCount <> 0 Then
tab_pcd.Open "select * from Presidentes where legenda = " & txt_legenda
If tab_pcd.RecordCount = 0 Then
tab_gcd.Open "select * from Governadores where legenda = " & txt_legenda
If tab_gcd.RecordCount = 0 Then
bdvb.Execute "Delete From Partidos where Partido = '" & txt_nome & "'"
Call box_1
Call carrega_lista
Call Novo
Exit Sub
End If
End If
End If
End If
penis3:
MsgBox "Favor excluir ou alterar os candidatos deste partido antes de excluir o mesmo.", vbExclamation, "Allia"
End Sub
Private Sub Fechar()
If tab_par.State = adStateOpen Then tab_par.Close
If tab_pcd.State = adStateOpen Then tab_pcd.Close
If tab_gcd.State = adStateOpen Then tab_gcd.Close
End Sub
Private Sub cmd_incluir_Click()
Call Partido
Call carrega_lista
End Sub
Private Sub cmd_novo_Click()
Call Novo
End Sub
Private Sub carrega_lista()
If tab_par.State = adStateOpen Then tab_par.Close
tab_par.Open "Partidos", bdvb, adOpenKeyset, adLockOptimistic
If tab_par.BOF = False Or tab_par.EOF = False Then
tab_par.MoveFirst
msflex.Rows = 2
msflex.Clear
msflex.FormatString = "LEGENDA | SIGLA | PARTIDO "
Do Until tab_par.EOF
msflex.TextMatrix(msflex.Rows - 1, 0) = tab_par!legenda
msflex.TextMatrix(msflex.Rows - 1, 1) = tab_par!sigla
msflex.TextMatrix(msflex.Rows - 1, 2) = tab_par!Partido
msflex.Rows = msflex.Rows + 1
tab_par.MoveNext
Loop
msflex.Rows = msflex.Rows - 1
Else
msflex.Rows = 2
msflex.Clear
msflex.FormatString = "LEGENDA | SIGLA | PARTIDO "
End If
End Sub
Private Sub Form_Load()
Call OpenBD
Call OpenUrna
Call carrega_lista
End Sub
Private Sub Partido()
If tab_par.State = adStateOpen Then tab_par.Close
tab_par.Open "select * from Partidos where legenda = " & txt_legenda
If tab_par.RecordCount = 0 Then
tab_par.AddNew
tab_par!Partido = txt_nome.Text
tab_par!legenda = txt_legenda.Text
tab_par!sigla = txt_sigla.Text
tab_par.Update
Call Novo
Exit Sub
End If
MsgBox "Partido já cadastrado.", vbExclamation, "Allia"
End Sub
Private Sub Novo()
txt_nome.Text = Clear
txt_legenda.Text = Clear
txt_sigla.Text = Clear
txt_nome.SetFocus
End Sub
Private Sub msflex_Click()
On Error GoTo Penis
L_Linha = msflex.Row
l_CodCli = msflex.TextMatrix(L_Linha, 0)
If tab_par.State = adStateOpen Then tab_par.Close
tab_par.Open "Select * From Partidos Where legenda = " & l_CodCli
Call Mostrar
Penis:
End Sub
Private Sub Mostrar()
txt_nome.Text = tab_par!Partido
txt_legenda.Text = tab_par!legenda
txt_sigla.Text = tab_par!sigla
End Sub