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
|
Imports bLangue.cLangue
Partial Public Class wcCatalogueArticles
Inherits System.Web.UI.UserControl
#Region "Propriétés"
Private _cnxString As String = "Provider=" & System.Configuration.ConfigurationManager.ConnectionStrings("Dotsoft").ProviderName & ";" & System.Configuration.ConfigurationManager.ConnectionStrings("Dotsoft").ConnectionString
Public Property connectionString() As String
Get
Return Me._cnxString
End Get
Set(ByVal value As String)
_cnxString = value
End Set
End Property
Private _langue As Integer = 1
Public Property Langue() As Integer
Get
Return Me._langue
End Get
Set(ByVal value As Integer)
_langue = value
End Set
End Property
Public ReadOnly Property ddl() As WebControls.DropDownList
Get
EnsureChildControls()
Return Me.ddlCatalogueArticle
End Get
End Property
Public ReadOnly Property lbl() As WebControls.Label
Get
EnsureChildControls()
Return Me.lblCatalogueArticle
End Get
End Property
''' <summary>Si on souhaite afficher la dropDownList uniquement alors il faut passer ce paramètre à True</summary>
Private _noLabel As Boolean = False
Public Property noLabel() As Boolean
Get
Return Me._noLabel
End Get
Set(ByVal value As Boolean)
Me._noLabel = value
End Set
End Property
#End Region
Protected Overrides Sub CreateChildControls()
If Not Me._noLabel Then
Me.lblCatalogueArticle.Text = xL(4575, Me._langue, "Catalogue article", Me._cnxString)
Me.Controls.Add(Me.lblCatalogueArticle)
Me.Controls.Add(New LiteralControl(" : "))
End If
Me.mInitDropDownListCatalogueArticle()
Me.Controls.Add(Me.ddlCatalogueArticle)
End Sub
''' <summary>
''' Vide et reremplie le menu déroulant du distributeur
''' </summary>
Private Sub mInitDropDownListCatalogueArticle()
'Affiche l'info bulle
Me.ddlCatalogueArticle.ToolTip = xL(6623, Me._langue, "Choisissez ici un catalogue d'articles", Me._cnxString)
'Vide le control
While Me.ddlCatalogueArticle.Items.Count > 0
Me.ddlCatalogueArticle.Items.Remove(Me.ddlCatalogueArticle.Items(0))
End While
'Ajoute la première ligne par défaut
Me.ddlCatalogueArticle.Items.Add(New ListItem("-- " & xL(4567, Me._langue, "Choix Catalogue", Me._cnxString) & " --", "-1"))
'Remplie le control avec la liste des distributeurs
Dim oCatalogues As Generic.List(Of bObjets.oCatalogueArticles) = bObjets.oCataloguesArticles.msCataloguesArticles(Me._cnxString)
If Not oCatalogues Is Nothing Then
For Each catalogue As bObjets.oCatalogueArticles In oCatalogues
Me.ddlCatalogueArticle.Items.Add(New ListItem(catalogue.pLibelle, catalogue.pIdCatalogue))
Next
End If 'Fin si il y a des catalogue d'articles
End Sub
End Class |
Partager