186 lines
6.9 KiB
VB.net
186 lines
6.9 KiB
VB.net
Public Class FrmAccueil
|
|
Public Boule As Boolean REM inscription ou édition
|
|
Public Horaire As String REM Sert a stoquer l'heurs pour les autres fenetres QUI ONT DDES TIMERS.
|
|
|
|
Structure PERS REM sert de "Tampon" entre les données entrées dans les feuilles et le fichier.
|
|
<VBFixedString(8)> Dim Nom As String
|
|
<VBFixedString(6)> Dim Prenom As String
|
|
<VBFixedString(10)> Dim Adresse As String
|
|
<VBFixedString(5)> Dim CP As Integer
|
|
<VBFixedString(15)> Dim Ville As String
|
|
<VBFixedString(5)> Dim Age As Integer REM Stocke la date de naissance en mois (plus facile pour convertir après)
|
|
<VBFixedString(1)> Dim Region As Integer REM Stocke l'index
|
|
<VBFixedArray(15)> Dim Ecrit() As String REM stoquer les index plutot que les nom ?
|
|
<VBFixedArray(15)> Dim Oral() As String REM IDEMPOTENCE
|
|
<VBFixedString(2)> Dim Fac As Integer REM Stocke l'index
|
|
End Structure
|
|
Structure Index REM Sert pour le bilan des supprimés, mais aussi a générer le menu déroulant pour édition.
|
|
Dim no As Integer
|
|
Dim nom As String
|
|
Dim prenom As String
|
|
Dim Suppr As Boolean
|
|
End Structure
|
|
Public cddts As PERS
|
|
Public nf As Integer
|
|
Public NbID As Integer = 1 REM Nombre de candidats
|
|
Public IDlu As Integer REM Sélection d'un candidat.
|
|
Public lgcddts As Integer REM Sert a obtenir la bonne longueur.
|
|
Public Tindex() As Index
|
|
|
|
|
|
|
|
Public Sub InscBdD()
|
|
REM Entrée depuis la feuille 1
|
|
cddts.Nom = FrmInput1.TxtNom.Text
|
|
cddts.Prenom = FrmInput1.TxtPrenom.Text
|
|
cddts.Adresse = FrmInput1.TxtAdrss.Text
|
|
cddts.CP = FrmInput1.TxtCP.Text
|
|
cddts.Ville = FrmInput1.TxtVille.Text
|
|
cddts.Age = FrmInput1.nais
|
|
Tindex(NbID - 2).no = NbID
|
|
Tindex(NbID - 2).nom = cddts.Nom
|
|
Tindex(NbID - 2).prenom = cddts.Prenom
|
|
|
|
REM Entrée depuis la feuille 2
|
|
cddts.Region = FrmInput2.CboRegion.SelectedIndex
|
|
Dim b As CheckBox
|
|
Dim j As Integer = 0
|
|
For Each b In FrmInput2.GBEcrit.Controls
|
|
If b.Checked Then
|
|
cddts.Ecrit(j) = b.Text
|
|
j += 1
|
|
End If
|
|
Next
|
|
j = 0
|
|
For Each b In FrmInput2.GBOral.Controls
|
|
If b.Checked Then
|
|
cddts.Oral(j) = b.Text
|
|
j += 1
|
|
End If
|
|
Next
|
|
If FrmInput2.RBYes.Checked Then cddts.Fac = FrmInput2.CboFac.SelectedIndex
|
|
|
|
REM Entrée depuis la feuille 3
|
|
Tindex(NbID).Suppr = False
|
|
|
|
REM Sauvegarde
|
|
FilePut(nf, cddts, NbID)
|
|
FilePut(nf, cddts.CP = NbID, 1)
|
|
NbID += 1
|
|
End Sub
|
|
|
|
Public Sub MaJBdD()
|
|
REM EST-IL NECESSAIRE DE FAIRE DES TESTS POUR VOIR DES CHANGEMENTS, OU MODIFIER TOUT DE MÊME ?
|
|
|
|
REM Entrée depuis la feuille 1
|
|
cddts.Nom = FrmInput1.TxtNom.Text
|
|
cddts.Prenom = FrmInput1.TxtPrenom.Text
|
|
cddts.Adresse = FrmInput1.TxtAdrss.Text
|
|
cddts.CP = FrmInput1.TxtCP.Text
|
|
cddts.Ville = FrmInput1.TxtVille.Text
|
|
cddts.Age = FrmInput1.nais
|
|
|
|
REM Entrée depuis la feuille 2
|
|
cddts.Region = FrmInput2.CboRegion.SelectedIndex
|
|
Dim b As CheckBox
|
|
Dim j As Integer = 0
|
|
For Each b In FrmInput2.GBEcrit.Controls
|
|
If b.Checked Then
|
|
cddts.Ecrit(j) = b.Text REM Plus logique que les version en dessous, ne marche pas quand même.
|
|
j += 1
|
|
End If
|
|
Next
|
|
j = 0
|
|
For Each b In FrmInput2.GBOral.Controls
|
|
If b.Checked Then
|
|
cddts.Oral(j) = b.Text REM Comme en Td mais je ne comprend pas l'interet de = true
|
|
j += 1
|
|
End If
|
|
Next
|
|
If FrmInput2.RBYes.Checked Then cddts.Fac = FrmInput2.CboFac.SelectedIndex
|
|
|
|
REM Sauvegarde
|
|
FilePut(nf, cddts, FrmEdit.SelectedID)
|
|
End Sub
|
|
|
|
Public Sub SupprBdD()
|
|
Idlu = FrmEdit.SelectedID
|
|
Tindex(IDlu).Suppr = True
|
|
FilePut(nf, cddts, FrmEdit.SelectedID)
|
|
End Sub
|
|
|
|
Public Sub LectBdD() REM destiné a évoluer
|
|
Dim i As Integer
|
|
For i = 0 To NbID - 2 REM UBound(Tindex), car le tableau est déjà alloué.
|
|
If Tindex(i).Suppr = False Then
|
|
FrmEdit.CBNP.Items.Add(Format(i + 2, "00") & " - " & Tindex(i).nom & " " & Tindex(i).prenom)
|
|
End If
|
|
Next i
|
|
End Sub
|
|
|
|
Public Sub ModifBdDIN1()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub FrmAcceuil_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|
ReDim cddts.Ecrit(3)
|
|
ReDim cddts.Oral(2)
|
|
ReDim Tindex(3)
|
|
cddts.CP = NbID REM NbID qui est initialisé a 1.
|
|
|
|
Boule = False
|
|
nf = FreeFile()
|
|
lgcddts = Len(cddts) REM REF au mail de DG : La longeur de cddts n'est pas la même une fois le tableau redimentionné, il faut donc recalculer ladire longueur.
|
|
FileOpen(nf, "Candidats.AFF", OpenMode.Random, OpenAccess.ReadWrite, OpenShare.Shared, lgcddts) REM FileOpen(...ared, Len(cddts)) ne pourrait-il pas marcher vue que les tableaux ont étés modifés avant ?
|
|
FilePut(nf, cddts, NbID)
|
|
NbID += 1 REM Il passe a 2 pour la prochaine clef dans le fichier.
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub CmdQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdQuit.Click
|
|
Dim quit As Integer
|
|
quit = MsgBox("Vous êtes sur le point de quitter Candide Pro 7. Voulez-vous continuer ?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Quitter Candide Pro 7")
|
|
If quit = vbYes Then
|
|
FileClose(nf)
|
|
End
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CmdNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdNew.Click
|
|
Me.Hide()
|
|
Boule = False REM boule change pour nouveau (ou ne change pas la première fois)
|
|
FrmNouv.Show()
|
|
End Sub
|
|
|
|
Private Sub CmdEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdEdit.Click
|
|
Me.Hide()
|
|
Boule = True REM bool change pour edition
|
|
FrmEdit.Show()
|
|
End Sub
|
|
|
|
Private Sub CmdBilan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdBilan.Click
|
|
Me.Hide()
|
|
FrmBilan.Show()
|
|
End Sub
|
|
|
|
Private Sub CmdAff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdAff.Click
|
|
FrmAff.Show()
|
|
Me.Hide()
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub AffHeure(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TmrHor.Tick
|
|
On Error Resume Next REM Saute les erreurs eventuels (MSGBOX par exemple)
|
|
Horaire = TimeOfDay()
|
|
If Not ((FrmInput1.Visible Or FrmInput2.Visible) And Boule = False) Then
|
|
ActiveForm.Text = ActiveForm.Tag & " | " & Me.Horaire REM Sert a mettre l'heure dans les autres fenetres (mais fait des messages d'erreur parfois)
|
|
End If
|
|
End Sub
|
|
|
|
|
|
End Class
|