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
|
Partial Class Composant_Speed_Circuit
Inherits System.Web.UI.UserControl
Private up As New UpdatePanel
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
'code d'initialisation de la liste des circuits
With up
.ID = "upWindow"
.UpdateMode = UpdatePanelUpdateMode.Conditional
.RenderMode = UpdatePanelRenderMode.Inline
.ChildrenAsTriggers = True
End With
Dim lblTitre As New Label
With lblTitre
.Text = "Accès aux circuits"
End With
With up.ContentTemplateContainer.Controls
.Clear()
.Add(lblTitre)
.Add(New LiteralControl("<br />"))
End With
AffichePositionActuelle()
AfficheEtape()
AfficheDestinationPossible()
Controls.Add(up)
up.Update()
End Sub
Sub RemiseAJour()
up.ContentTemplateContainer.Controls.Remove(up.ContentTemplateContainer.FindControl("lblPositionActuelle"))
up.ContentTemplateContainer.Controls.Remove(up.ContentTemplateContainer.FindControl("tblDestination"))
up.ContentTemplateContainer.Controls.Remove(up.ContentTemplateContainer.FindControl("tblEtape"))
AffichePositionActuelle()
AfficheEtape()
AfficheDestinationPossible()
up.Update()
End Sub
Sub AffichePositionActuelle()
Dim lblPositionActuelle As New Label
lblPositionActuelle.Text = New DManager("DataDev").RetournerScalaire("EXEC SPEED_Voyage_PositionActuelle '" & GetUserGUID().ToString & "'")
lblPositionActuelle.ID = "lblPositionActuelle"
up.ContentTemplateContainer.Controls.Add(lblPositionActuelle)
up.Update()
End Sub
Sub AfficheDestinationPossible()
Dim tblDestination As New Table
For Each dr As DataRow In New DManager("DataDev").RetournerTable("EXEC SPEED_Voyage_ListeVille '" & GetUserGUID().ToString & "'").Rows
Dim rDestiantion As New TableRow
Dim cDestination, cDistance, cDuree, cBouton As New TableCell
Dim lblDestination, lblDistance, lblDuree As New Label
Dim lbVoyage As New LinkButton
lblDestination.Text = dr.Item("VilleF")
lblDistance.Text = "Distance : " & dr.Item("Distance") & " Km"
lblDuree.Text = "Durée du voyage : " & dr.Item("Duree")
With lbVoyage
AddHandler lbVoyage.Click, AddressOf PrendreRoute
.Text = "Prendre la route"
.CommandArgument = dr.Item("VilleF")
End With
cDestination.Controls.Add(lblDestination)
cDistance.Controls.Add(lblDistance)
cDuree.Controls.Add(lblDuree)
cBouton.Controls.Add(lbVoyage)
With rDestiantion.Cells
.Add(cDestination)
.Add(cDistance)
.Add(cDuree)
.Add(cBouton)
End With
tblDestination.Rows.Add(rDestiantion)
Next
up.ContentTemplateContainer.Controls.Add(tblDestination)
up.Update()
End Sub
Sub AfficheEtape()
Dim tblDestination As New Table
For Each dr As DataRow In New DManager("DataDev").RetournerTable("EXEC SPEED_Voyage_Etape '" & GetUserGUID().ToString & "'").Rows
Dim rEtape As New TableRow
Dim cVilleD, cVilleA, cHeureD, cHeureA, cBouton As New TableCell
Dim lblVilleD, lblVilleA, lblHeureD, lblHeureA As New Label
Dim lbEtape As New LinkButton
With lbEtape
AddHandler lbEtape.Click, AddressOf AnnulerEtape
.Text = "Annuler l'étape"
.CommandArgument = dr.Item("IDHistoVoyage")
End With
With rEtape.Cells
.Add(cVilleD)
.Add(cVilleA)
.Add(cHeureD)
.Add(cHeureA)
.Add(cBouton)
End With
tblDestination.Rows.Add(rEtape)
Next
up.ContentTemplateContainer.Controls.Add(tblDestination)
up.Update()
End Sub
Sub PrendreRoute(ByVal sender As Object, ByVal e As System.EventArgs)
Dim lb As LinkButton = sender
Dim dt As DataTable = New DManager("DataDev").RetournerTable("EXEC SPEED_Voyage_PrendreRoute '" & GetUserGUID().ToString & "','" & lb.CommandArgument & "'")
RemiseAJour()
up.Update()
End Sub
Sub AnnulerEtape(ByVal sender As Object, ByVal e As System.EventArgs)
Dim lb As LinkButton = sender
Dim dt As DataTable = New DManager("DataDev").RetournerTable("EXEC SPEED_Voyage_AnnuleEtape '" & GetUserGUID().ToString & "', " & lb.CommandArgument)
RemiseAJour()
up.Update()
End Sub
End Class |
Partager