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
   | Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
        da = New SqlDataAdapter("select count(distinct nom_groupe) from groupes", con)
        da.Fill(ds, "count")
        Dim count As Integer = ds.Tables("count").Rows(0).Item(0)
 
 
 
        da2 = New SqlDataAdapter("select  * from conge  ", con)
        da2.Fill(ds2, "conge")
 
 
 
        Dim t As New DataTable
        GV1.ShowHeader = False
 
        For j = 0 To 24
            t.Columns.Add(j)
 
        Next
 
        For i = 1 To 31
            t.Rows.Add(i)
 
        Next
 
        Dim k = 0
        ds.Clear()
        da = New SqlDataAdapter("select  nom_groupe from groupes order by id_groupe asc  ", con)
        da.Fill(ds, "groupes")
 
 
 
        ''''''''''''''''''mois 1'''''''''''''''''
        ''''''''''''''''''''BJ
        For i = 1 To 31
 
            If k > count - 1 Then
                k = 0
            End If
 
            t.Rows(i - 1).Item(1) = ds.Tables("groupes").Rows(k).Item(0)
 
            GV1.DataSource = t
            GV1.DataBind()
 
            k = k + 1
            s = k
 
        Next
        For j = 0 To ds2.Tables("conge").Rows.Count - 1
            day_debut = ds2.Tables("conge").Rows(j).Item(3)
            day_fin = ds2.Tables("conge").Rows(j).Item(4)
            remplacant = ds2.Tables("conge").Rows(j).Item(2)
            bene = ds2.Tables("conge").Rows(j).Item(1)
            For i = 1 To 31
                If i = day_debut.Day And day_debut.Month = 1 And day_debut.Year = Date.Now.Year Then
 
                    If day_fin.Month <> day_debut.Month Then
 
                        For m = day_debut.Day To 31
                            If k > count - 1 Then
                                k = 0
                            End If
                            If bene = t.Rows(m - 1).Item(1).ToString Then
 
                                t.Rows(m - 1).Item(1) = remplacant
 
                                GV1.DataSource = t
                                GV1.DataBind()
                                k = k + 1
                                var1 = day_fin.Day
                                var2 = day_fin.Month
                            End If
                        Next
 
                    Else
                        For m = day_debut.Day To day_fin.Day
                            If k > count - 1 Then
                                k = 0
                            End If
                            If bene = t.Rows(m - 1).Item(1).ToString Then
                                t.Rows(m - 1).Item(1) = remplacant
                                GV1.DataSource = t
                                GV1.DataBind()
                                k = k + 1
                            End If
                        Next
                    End If
                End If
            Next
        Next | 
Partager