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
|
Private Sub ConstruirePlanning()
RdVQueJeDmd = CType(Utils.GetObjectFromCache(strRdVQueJeDmd), RendezVous)
'Vider le placeHolder car avec le Load se construit 2X l'un derière l'autre
Planning.Controls.Clear()
Dim MaTable As HtmlTable = New HtmlTable
MaTable.Attributes.Add("class", "TBL")
Dim MaRow1 As HtmlTableRow = New HtmlTableRow
Dim MaCell1 As HtmlTableCell = New HtmlTableCell
'Construction de la première ligne
MaRow1.Attributes.Add("class", "ListeEntete")
'1ere cellule vide
MaCell1.Width = 60
MaRow1.Controls.Add(MaCell1)
'Ajouter nom/Fonction/Suppression
For Each ContInfo As KeyValuePair(Of Guid, ContactInfo) In dicInvite
Dim MaCell As HtmlTableCell = New HtmlTableCell
MaCell.Align = "center"
'Suppression pas pour l'inviteur
If ConnectedUser.IDContact <> ContInfo.Key Then
'Pictogramme de réponse
Dim MonImg As New Image
Select Case ContInfo.Value.Etat
Case RendezVous.ETAT_INVITE
MonImg.ImageUrl = "images/ic/g/vote_yes.png"
Case RendezVous.ETAT_ACCEPTE
MonImg.ImageUrl = "images/ic/c/vote_yes.png"
MonImg.ToolTip = ContInfo.Value.ReponseRdv
Case RendezVous.ETAT_REFUSE
MonImg.ImageUrl = "images/ic/c/vote_no.png"
MonImg.ToolTip = ContInfo.Value.ReponseRdv
Case Else
MonImg.ImageUrl = "images/ic/g/attention.png"
End Select
MaCell.Controls.Add(MonImg)
'Nouvelle ligne
MaCell.Controls.Add(New LiteralControl(" "))
'Bouton suppression
Dim btnsupp As New ImageButton
btnsupp.ImageUrl = "~/images/cancel.gif"
btnsupp.CommandArgument = ContInfo.Key.ToString
btnsupp.ID = "btnSupInv" & ContInfo.Key.ToString
AddHandler btnsupp.Click, AddressOf Me.btnDelInvite_Click
MaCell.Controls.Add(btnsupp)
ContInfo.Value.BtnSup = btnsupp
'Vérification de suppression
Dim SurSupp As New AjaxControlToolkit.ConfirmButtonExtender
SurSupp.ConfirmText = "Voulez vous vraiment supprimer ?"
SurSupp.TargetControlID = "btnSupInv" & ContInfo.Key.ToString
MaCell.Controls.Add(SurSupp)
'Nouvelle ligne
MaCell.Controls.Add(New LiteralControl("<BR />"))
End If
'Nom/Fonction
Dim lblnom As Label = New Label
lblnom.Text = ContInfo.Value.NomComplet
lblnom.ToolTip = ContInfo.Value.Fonction
MaCell.Controls.Add(lblnom)
MaRow1.Controls.Add(MaCell)
Next
MaTable.Controls.Add(MaRow1)
'Récupérer la liste des horaires possibles pour les rendez-vous
Dim dtvHoraire As DataView = Horaires.GetAll.Tables(0).DefaultView
dtvHoraire.RowFilter = "Libelle <= '17:00'"
'Pour chaque horaire : controler chaque contact
For Each Hor As DataRowView In dtvHoraire
Dim MaRow As HtmlTableRow = New HtmlTableRow
Dim MaCell As HtmlTableCell = New HtmlTableCell
Dim RdLst As New RadioButton
Dim heure As Date = CDate("10/09/2010 " & Hor("Libelle"))
RdLst.ID = "RdLst" & Hor("Libelle")
RdLst.Text = Hor("Libelle")
RdLst.GroupName = "GrpRdHoraireDeb"
RdLst.TextAlign = TextAlign.Left
RdLst.Checked = (RdVQueJeDmd.HoraireDeb = heure)
MaCell.Controls.Add(RdLst)
MaRow.Controls.Add(MaCell)
'Mise en couleur des cellules
'pour indiquer si contact dispo ou non
Dim NonDispo As Boolean = True
For Each ContInfo As KeyValuePair(Of Guid, ContactInfo) In dicInvite
Dim MaCellDispo As New HtmlTableCell
ContInfo.Value.dtvPlanning.RowFilter = "'" & heure & "' >= HeureDebut AND '" & heure & "' < HeureFin"
Dim dtvtmp As DataView = ContInfo.Value.dtvPlanning
NonDispo = UneFonctionAMoi
If NonDispo Then
MaCellDispo.Attributes.Add("class", "NonDisponible")
RdLst.Enabled = False
Else
If (dtvtmp.Count > 0) AndAlso (dtvtmp(0)("type").ToString = "Rendez-vous") AndAlso (CInt(dtvtmp(0)("ID")) = RdVQueJeDmd.IDRendezVous) Then
MaCellDispo.Attributes.Add("class", "RdVEnCours")
Else
MaCellDispo.Attributes.Add("class", "Disponible")
End If
End If
MaRow.Controls.Add(MaCellDispo)
Next
MaTable.Controls.Add(MaRow)
Next
Planning.Controls.Add(MaTable)
End Sub |
Partager