CODE SOURCE
CODE SOURCE
Imports System.Data.SqlClienT
Module MODULE_GESPA
Public Cn As New SqlConnection("server=EURO-PC\LINKS; initial catalog=GESPALMA; integrated
security=true")
Public cmd As SqlCommand
Public bs As BindingSource
Public dr As SqlDataReader
Public ds As DataSet
Public adap As SqlDataAdapter
Public dtable As DataTable
End Module
AUTHENTIFICATION
82
End If
End Sub
ProgressBar1.Value = ProgressBar1.Value + 1
Label4.Text = "chargement " & ProgressBar1.Value & "%"
End If
End Sub
End Sub
End Class
MENU PRINCIPAL
End Sub
End Sub
83
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
Dim TR As Integer
TR = MessageBox.Show("voulez vous vraiment quitter??", "Attention",
MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation)
If TR = Windows.Forms.DialogResult.OK Then
End
Else
End If
End Sub
Private Sub SAISIEToolStripMenuItem_Click_1(sender As Object, e As EventArgs) Handles
SAISIEToolStripMenuItem.Click
SAISIE.Show()
Me.Hide()
End Sub
End Sub
PALMARES
Imports System.Data.SqlClient
Public Class PALMARES
Private Sub chargcmbecole()
Try
Cn.Open()
adap = New SqlDataAdapter
adap.SelectCommand = New SqlCommand("select Denom from T_ECOLE", Cn)
ds = New DataSet
adap.Fill(ds)
dtable = ds.Tables(0)
cmbcodeeco.Items.Clear()
For Each drow As DataRow In dtable.Rows
cmbcodeeco.Items.Add(drow(0).ToString())
Next
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub chargcmbniveco()
Try
Cn.Open()
adap = New SqlDataAdapter
adap.SelectCommand = New SqlCommand("select LibNiv from T_NIVEAU", Cn)
84
ds = New DataSet
adap.Fill(ds)
dtable = ds.Tables(0)
cmbniveco.Items.Clear()
For Each drow As DataRow In dtable.Rows
cmbniveco.Items.Add(drow(0).ToString())
Next
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub chargcmbsect()
Try
Cn.Open()
adap = New SqlDataAdapter
adap.SelectCommand = New SqlCommand("select LibSection from T_SECTION", Cn)
ds = New DataSet
adap.Fill(ds)
dtable = ds.Tables(0)
cmbsecteco.Items.Clear()
For Each drow As DataRow In dtable.Rows
cmbsecteco.Items.Add(drow(0).ToString())
Next
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub chargcmbpalma()
Try
Cn.Open()
adap = New SqlDataAdapter
adap.SelectCommand = New SqlCommand("select AnnPalm from T_PALMARES", Cn)
ds = New DataSet
adap.Fill(ds)
dtable = ds.Tables(0)
cmbAnnpalm.Items.Clear()
For Each drow As DataRow In dtable.Rows
cmbAnnpalm.Items.Add(drow(0).ToString())
Next
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub chargcmbclass()
Try
Cn.Open()
adap = New SqlDataAdapter
adap.SelectCommand = New SqlCommand("select LibClasse from T_CLASSE", Cn)
ds = New DataSet
adap.Fill(ds)
dtable = ds.Tables(0)
cmbclasseco.Items.Clear()
For Each drow As DataRow In dtable.Rows
cmbclasseco.Items.Add(drow(0).ToString())
Next
85
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Cn.Open()
If cmbAnnpalm.SelectedIndex <> -1 Then
cmbAnnpalm.Focus()
End If
If dr.Read() Then
txtCodpalm.Text = dr.GetValue(0)
End If
If Cn.State = ConnectionState.Open Then
End If
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Cn.Open()
If cmbcodeeco.SelectedIndex <> -1 Then
cmbcodeeco.Focus()
End If
86
If dr.Read() Then
txtcode.Text = dr.GetValue(0)
End If
If Cn.State = ConnectionState.Open Then
End If
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Cn.Open()
If cmbniveco.SelectedIndex <> -1 Then
cmbniveco.Focus()
End If
If dr.Read() Then
txtniv.Text = dr.GetValue(0)
End If
If Cn.State = ConnectionState.Open Then
End If
Cn.Close()
87
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Cn.Open()
If cmbclasseco.SelectedIndex <> -1 Then
cmbclasseco.Focus()
End If
If dr.Read() Then
txtclass.Text = dr.GetValue(0)
End If
If Cn.State = ConnectionState.Open Then
End If
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Cn.Open()
If cmbsecteco.SelectedIndex <> -1 Then
cmbsecteco.Focus()
End If
If dr.Read() Then
txtsect.Text = dr.GetValue(0)
End If
If Cn.State = ConnectionState.Open Then
End If
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
88
End Try
End Sub
Try
Cn.Open()
Dim sql As String = "SELECT NomElev, PstNomElev, Myenn, LibObserv FROM
vue_gridjoint WHERE Denom= @d1 AND LibNiv= @d2 AND LibClasse= @d3 AND LibSection= @d4 AND Myenn
>= 5"
cmd = New SqlCommand(sql, Cn)
cmd.Parameters.AddWithValue("@d1", cmbcodeeco.Text)
cmd.Parameters.AddWithValue("@d2", cmbniveco.Text)
cmd.Parameters.AddWithValue("@d3", cmbclasseco.Text)
cmd.Parameters.AddWithValue("@d4", cmbsecteco.Text)
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Gridpourcentg.Rows.Clear()
While (dr.Read() = True)
Gridpourcentg.Rows.Add(dr(0), dr(1), dr(2), dr(3))
End While
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Try
Cn.Open()
Dim sql As String = "SELECT COUNT(PstNomElev) AS nombreElev FROM
dbo.VUE_GRIDPOURCENTAGE WHERE (LibObserv = 'PASSER')"
cmd = New SqlCommand(sql, Cn)
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
gridTOTsom.Rows.Clear()
While (dr.Read() = True)
gridTOTsom.Rows.Add(dr(0))
End While
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Cn.Open()
Dim sql As String = "select * from VUE_GRIDPOURCENTAGE where Myenn < 5"
cmd = New SqlCommand(sql, Cn)
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Gridpourcentg.Rows.Clear()
While (dr.Read() = True)
Gridpourcentg.Rows.Add(dr(0), dr(1), dr(2), dr(3), dr(4))
End While
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
89
End Try
Try
Cn.Open()
Dim sql As String = "SELECT COUNT(PstNomElev) AS nombreElev FROM
dbo.VUE_GRIDPOURCENTAGE WHERE (LibObserv = 'ECHOUER')"
cmd = New SqlCommand(sql, Cn)
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
gridTOTsom.Rows.Clear()
While (dr.Read() = True)
gridTOTsom.Rows.Add(dr(0))
End While
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Cn.Open()
Dim sql As String = "select * from VUE_GRIDPOURCENTAGE where Myenn = 0"
cmd = New SqlCommand(sql, Cn)
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Gridpourcentg.Rows.Clear()
While (dr.Read() = True)
Gridpourcentg.Rows.Add(dr(0), dr(1), dr(2), dr(3), dr(4))
End While
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Cn.Open()
Dim sql As String = "select * from VUE_GRIDPOURCENTAGE where Myenn = 0"
cmd = New SqlCommand(sql, Cn)
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Gridpourcentg.Rows.Clear()
While (dr.Read() = True)
Gridpourcentg.Rows.Add(dr(0), dr(1), dr(2), dr(3), dr(4))
End While
Cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
90
txtindex.BackColor = Color.Green
End Sub
End
Else
End If
End Sub
End Sub
End Class
91