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
|
Public Class FormOrganisation
Private Sub Table_OrganisateurBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Table_OrganisateurBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.Table_OrganisateurBindingSource.EndEdit()
'Me.TableAdapterManager.UpdateAll(Me.BoobooBDDataSet)
Me.Table_OrganisateurTableAdapter.Update(Me.BoobooBDDataSet.Table_Organisateur)
Catch ex As Exception
MsgBox(ex.Message)
End Try
'Me.TableAdapterManager.UpdateAll(Me.BoobooBDDataSet)
End Sub
Private Sub FormOrganisation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Table_ProvinceTableAdapter.Fill(Me.BoobooBDDataSet.Table_Province)
'TODO: This line of code loads data into the 'BoobooBDDataSet.Table_Pays' table. You can move, or remove it, as needed.
Me.Table_PaysTableAdapter.Fill(Me.BoobooBDDataSet.Table_Pays)
'TODO: This line of code loads data into the 'BoobooBDDataSet.Table_Mois' table. You can move, or remove it, as needed.
Me.Table_MoisTableAdapter.Fill(Me.BoobooBDDataSet.Table_Mois)
'TODO: This line of code loads data into the 'BoobooBDDataSet.Table_Organisateur' table. You can move, or remove it, as needed.
Me.Table_OrganisateurTableAdapter.Fill(Me.BoobooBDDataSet.Table_Organisateur)
' update liste de styles
changeStyles()
' update liste des groupes
changeGroupes()
'update combo pays
changePays()
changeProvinces()
End Sub
'Mise à jour du pays dans la combo
Private Sub changePays()
Dim groupRow() As Data.DataRow
Dim currentID As Integer
Dim currentRowView As Data.DataRowView
currentRowView = Me.Table_OrganisateurBindingSource.Current
currentID = currentRowView.Row.Item("ID")
If currentID > 0 Then
groupRow = Me.BoobooBDDataSet.Table_Organisateur.Select("ID =" + currentID.ToString())
If Not IsDBNull(groupRow(0)("Pays")) Then
PaysComboBox.SelectedValue = groupRow(0)("Pays")
End If
Else
PaysComboBox.SelectedIndex = -1
End If
End Sub
Public Sub changeStyles()
Dim currentRowView As Data.DataRowView
currentRowView = Me.Table_OrganisateurBindingSource.Current
' First show the index and check state of all selected items.
StyleTextBox.Text = ""
Dim first As Boolean = True
Dim items As String()
Dim paramRow() As Data.DataRow
items = currentRowView.Row.Item("Style").ToString().Split(";")
For Each item As String In items
If Not (first) Then
StyleTextBox.Text += ";"
End If
If Not (item = Nothing) Then
paramRow = Me.BoobooBDDataSet.Table_Info_Style.Select("ID = " + item)
If paramRow.Length() > 0 Then
StyleTextBox.Text += paramRow(0)("Style").ToString()
End If
Else
Return
End If
first = False
Next
End Sub
Public Sub changeGroupes()
Dim currentRowView As Data.DataRowView
currentRowView = Me.Table_OrganisateurBindingSource.Current
' First show the index and check state of all selected items.
Groupe_PréféréTextBox.Text = ""
Dim first As Boolean = True
Dim items As String()
Dim paramRow() As Data.DataRow
items = currentRowView.Row.Item("Groupe Préféré").ToString().Split(";")
For Each item As String In items
If Not (first) Then
Groupe_PréféréTextBox.Text += ";"
End If
If Not (item = Nothing) Then
paramRow = Me.BoobooBDDataSet.Table_Groupe.Select("ID = " + item)
If paramRow.Length() > 0 Then
Groupe_PréféréTextBox.Text += paramRow(0)("Nom").ToString()
End If
Else
Return
End If
first = False
Next
End Sub
Public Sub changeProvinces()
'If Me.Table_OrganisateurBindingSource.Current.Row.Item("ID") < 0 Then
' ProvinceComboBox.Items.Clear()
' Exit Sub
'End If
ProvinceComboBox.Items.Clear()
' fill up province/dep
If (Me.Table_OrganisateurBindingSource.Current IsNot Nothing) And (PaysComboBox.SelectedItem() IsNot Nothing) Then
'Me.Table_OrganisateurBindingSource.Current.Row.Item("Pays") = PaysComboBox.SelectedValue()
Dim index As Integer
Dim paramRow() As Data.DataRow
Try
paramRow = Me.BoobooBDDataSet.Table_Province.Select("ID_Pays ='" + PaysComboBox.SelectedValue().ToString() + "'")
For Each element In paramRow
Dim item As ComboItem = New ComboItem(element.Item("ID"), element.Item("Nom"))
index = ProvinceComboBox.Items.Add(item)
If Not IsDBNull(Table_OrganisateurBindingSource.Current.Row.Item("Province")) Then
If element.Item("ID") = Table_OrganisateurBindingSource.Current.Row.Item("Province") Then
ProvinceComboBox.SelectedIndex = index
End If
End If
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
Private Sub Mois_ActivitéComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mois_ActiviteComboBox.SelectedIndexChanged
If (Me.Table_OrganisateurBindingSource.Current IsNot Nothing) And (Mois_ActiviteComboBox.SelectedValue() IsNot Nothing) Then
Me.Table_OrganisateurBindingSource.Current.Row.Item("Mois Activité") = Mois_ActiviteComboBox.SelectedValue()
Dim mois_activ As Integer = Mois_ActiviteComboBox.SelectedValue()
Dim debut As Integer
debut = ((mois_activ - My.Settings.MoisAvantProg) + 12) Mod 12
If debut = 0 Then
debut = 12
End If
If (Debut_ProgrammationComboBox.Items.Count > 0) Then
Debut_ProgrammationComboBox.SelectedValue = debut
End If
End If
End Sub
Private Sub Début_ProgrammationComboBox_SelectedValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Debut_ProgrammationComboBox.SelectedValueChanged
If (Me.Table_OrganisateurBindingSource.Current IsNot Nothing) And (Debut_ProgrammationComboBox.SelectedValue() IsNot Nothing) Then
Me.Table_OrganisateurBindingSource.Current.Row.Item("Début Programmation") = Debut_ProgrammationComboBox.SelectedValue()
End If
End Sub
Private Sub PaysComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PaysComboBox.SelectedIndexChanged
If PaysComboBox.SelectedItem() IsNot Nothing Then
Me.Table_OrganisateurBindingSource.Current.Row.Item("Pays") = PaysComboBox.SelectedValue()
changeProvinces()
End If
End Sub
Private Sub ProvinceComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProvinceComboBox.SelectedIndexChanged
If ProvinceComboBox.SelectedItem() IsNot Nothing Then
Dim item As ComboItem = ProvinceComboBox.SelectedItem
Me.Table_OrganisateurBindingSource.Current.Row.Item("Province") = item.Value()
End If
End Sub
Private Sub Table_OrganisateurBindingSource_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Table_OrganisateurBindingSource.CurrentChanged
' Filtrer le data GridView
Dim currentRowView As Data.DataRowView
Dim currentID As Integer
If (Me.Table_OrganisateurBindingSource.Current IsNot Nothing) Then
currentRowView = Me.Table_OrganisateurBindingSource.Current
currentID = currentRowView.Row.Item("ID")
'Select Case TabControlInfos.SelectedTab.Name
' Case TabPageContacts.Name
' 'applique le filtre
' Me.Table_Organisateur_ContactBindingSource.Filter = " ID = '" + currentID.ToString + "' "
' 'charge les paramètres pour les colonnes
' Utilities.loadColumnSettings(Table_Organisateur_ContactDataGridView, My.Settings.DGVOrganisateurContact)
' 'Case TabPageAlbum.Projet
' ' 'applique le filtre
' ' Requete =>>Me.Table_Organisateur_AlbumBindingSource.Filter = " ID = '" + currentID.ToString + "' "
' ' 'charge les paramètres pour les colonnes
' ' loadColumnSettings(DataGridViewProjet, My.Settings.DGVOrganisateurProjet)
' Case TabPageLink.Name
' 'applique le filtre
' Me.Table_Organisateur_LinkBindingSource.Filter = " ID = '" + currentID.ToString + "' "
' 'charge les paramètres pour les colonnes
' Utilities.loadColumnSettings(Table_Organisateur_LinkDataGridView, My.Settings.DGVOrganisateurLink)
' Case TabPageData.Name
' 'applique le filtre
' Me.Table_Organisateur_DataBindingSource.Filter = " ID = '" + currentID.ToString + "' "
' 'charge les paramètres pour les colonnes
' Utilities.loadColumnSettings(Table_Organisateur_DataDataGridView, My.Settings.DGVOrganisateurData)
'End Select
'changer l'image
'updateImageGroupe(currentID)
' Changer les styles
changeStyles()
' Changer les groupes
changeGroupes()
' couleur des lignes
'updateColorLines(Table_Groupe_ContactDataGridView)
' changer pays
changePays()
changeProvinces()
End If
End Sub
End Class |
Partager