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
| Imports EMailing
Imports EMailing.Annexe
Imports EMailing.Annexe.Metier
Imports EMailing.Annexe.Outils
Namespace UC
Public Class MailingUC
Inherits System.Web.UI.UserControl
'propriété qui permet d'affecter les droits de l'utilisateur en cours sur le mailing
Private _editType As UC.RightUC
Protected WithEvents TA_ActNow As System.Web.UI.HtmlControls.HtmlTextArea
Protected WithEvents DDL_ME As System.Web.UI.WebControls.DropDownList
Public Property EditType() As UC.RightUC
Get
Return _editType
End Get
Set(ByVal Value As UC.RightUC)
_editType = Value
End Set
End Property
Protected WithEvents DS_DateCampagne As UC.DateSelector
Protected WithEvents btnSupp As Button
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents TA_Texte As System.Web.UI.HtmlControls.HtmlTextArea
Protected WithEvents TXT_Titre As System.Web.UI.WebControls.TextBox
Protected WithEvents TXT_CodeCampagne As System.Web.UI.WebControls.TextBox
Protected WithEvents TXT_Traqueur As System.Web.UI.WebControls.TextBox
Protected WithEvents TXT_Phrase As System.Web.UI.WebControls.TextBox
Protected WithEvents TXT_Nom As System.Web.UI.WebControls.TextBox
Protected WithEvents TXT_Fonction As System.Web.UI.WebControls.TextBox
Protected WithEvents TXT_LienBdc As System.Web.UI.WebControls.TextBox
Protected WithEvents TXT_LienTransfert As System.Web.UI.WebControls.TextBox
Protected WithEvents TXT_LienInteret As System.Web.UI.WebControls.TextBox
Protected WithEvents TXT_LienPrecision As System.Web.UI.WebControls.TextBox
Protected WithEvents REV_Mail As System.Web.UI.WebControls.RegularExpressionValidator
Protected WithEvents REV_Precision As System.Web.UI.WebControls.RegularExpressionValidator
Protected WithEvents REV_Interet As System.Web.UI.WebControls.RegularExpressionValidator
Protected WithEvents REV_Bdc As System.Web.UI.WebControls.RegularExpressionValidator
Protected WithEvents RFV_Style As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents RFV_Titre As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents RFV_Accroche As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents RFV_Texte As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents RFV_CodeCamp As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents RFV_Traqueur As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents TA_Accroche As System.Web.UI.HtmlControls.HtmlTextArea
Protected WithEvents LBL_ImgText As System.Web.UI.WebControls.Label
Protected WithEvents TAB_Corp As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents DDL_Style As System.Web.UI.WebControls.DropDownList
Protected WithEvents HDDL_Couleur As System.Web.UI.HtmlControls.HtmlSelect
Protected WithEvents TXT_Coord As System.Web.UI.WebControls.TextBox
Protected WithEvents HTAB_Logos As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents BTN_AddLogo As System.Web.UI.WebControls.Button
Protected WithEvents RBL_Bandeau As System.Web.UI.WebControls.RadioButtonList
Protected WithEvents BTN_Annuler As System.Web.UI.WebControls.Button
Protected WithEvents BTN_Valider As System.Web.UI.WebControls.Button
Protected WithEvents BTN_Duppliquer As System.Web.UI.WebControls.Button
Protected WithEvents BTN_Delete As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
#Region " Chargement de la page et des données"
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Page.IsPostBack = False Then
fillList()
loadData()
End If
End Sub
Private Sub fillList()
'chargement de la liste des couleurs
Me.HDDL_Couleur.Items.Add(New ListItem("Choisir une couleur", ""))
Me.HDDL_Couleur.Items.Add(New ListItem("", "072B7A"))
Me.HDDL_Couleur.Items.Add(New ListItem("", "A71D26"))
Me.HDDL_Couleur.Items.Add(New ListItem("", "777A7F"))
Me.HDDL_Couleur.Items.Add(New ListItem("", "F29400"))
Me.HDDL_Couleur.Items.Add(New ListItem("", "61ADCC"))
Me.HDDL_Couleur.Items.Add(New ListItem("", "1FA22E"))
Me.HDDL_Couleur.Items.Add(New ListItem("", "D6B25F"))
Me.HDDL_Couleur.Items.Add(New ListItem("", "006AB3"))
Me.HDDL_Couleur.Items.Add(New ListItem("", "E20026"))
Me.HDDL_Couleur.Items.Add(New ListItem("", "00978F"))
For cpt As Integer = 1 To Me.HDDL_Couleur.Items.Count - 1
Me.HDDL_Couleur.Items(cpt).Attributes.Add("style", "background-color:" + Me.HDDL_Couleur.Items(cpt).Value)
Next
'Chargement de la liste des types d'emailing
Me.DDL_Style.Items.Add(New ListItem("Choisir un style", ""))
Me.DDL_Style.Items.Add(New ListItem("...", "1"))
Me.DDL_Style.Items.Add(New ListItem("...", "2"))
Me.DDL_Style.Items.Add(New ListItem("...", "3"))
End Sub
Private Sub loadData()
If IsNothing(Request.QueryString.Item("IdMailing")) = False Then
Dim mailing As New CMailing(Int16.Parse(Request.QueryString.Item("IdMailing")))
Outils.SessionVar.CurrentMailing = mailing
End If
End Sub
#End Region
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
Me.DDL_Style.Attributes.Item("OnPropertyChange") = "AssignDefaultValue('" + Me.UniqueID + "')"
'création du tableau des logos
createLogoTables()
'vérification du nombre d'image de type logo pas plus de deux
Dim nbLogo As Int16 = 0
Dim al As ArrayList
Try
al = SessionVar.LogoMailing
For cpt As Int16 = 0 To al.Count - 1
If CType(al(cpt), CLiaisonImage).Type = TypeImage.Logo Then
nbLogo += 1
End If
Next
If nbLogo = 2 Then
Me.BTN_AddLogo.Visible = False
End If
Catch ex As EMailing.Annexe.Outils.SessionVar.SessionUndefineException
End Try
Me.BTN_AddLogo.Attributes.Item("onClick") = "openLogo();return false;"
End Sub
Private Sub SuppLogo(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim btnSupp As Button = sender
Dim al As ArrayList = SessionVar.LogoMailing
Dim nomImg As String = btnSupp.ID.Split("_")(btnSupp.ID.Split("_").Length - 2)
'parcours de toutes les images
For cpt As Integer = 0 To al.Count - 1
If New IO.FileInfo(CType(al(cpt), CLiaisonImage).Chemin).Name = nomImg Then
'suppression de l'image
al.RemoveAt(cpt)
Exit For
End If
Next
End Sub
Private Sub createLogoTables()
Dim alLogo As ArrayList
Try
alLogo = SessionVar.LogoMailing
Catch ex As SessionVar.SessionUndefineException
Exit Sub
End Try
Dim tcCell As System.Web.UI.HtmlControls.HtmlTableCell
Dim trRow As System.Web.UI.HtmlControls.HtmlTableRow
For cpt As Integer = 0 To alLogo.Count - 1
Dim img As CLiaisonImage = CType(alLogo(cpt), CLiaisonImage)
trRow = New HtmlTableRow
If img.Type = TypeImage.Logo Then
'ajout de la position
tcCell = New HtmlTableCell
tcCell.InnerText = IIf(img.Position = PositionImage.Gauche, "Gauche", "Droite")
trRow.Cells.Add(tcCell)
'ajout de l'image
tcCell = New HtmlTableCell
Dim imgCtrl As New System.Web.UI.WebControls.Image
imgCtrl.ImageUrl = LectureWebC.getElement("Logo") + "tn_" + New IO.FileInfo(img.Chemin).Name
tcCell.Controls.Add(imgCtrl)
trRow.Cells.Add(tcCell)
'ajout d'un bouton de suppression
btnSupp = New Button
btnSupp.Text = "Supprimer"
btnSupp.CausesValidation = False
btnSupp.ID = "BTN_Supp_" + New IO.FileInfo(img.Chemin).Name.Replace(".", "_")
AddHandler Me.btnSupp.Click, AddressOf Me.SuppLogo
tcCell.Controls.Add(Me.btnSupp)
trRow.Cells.Add(tcCell)
'ajout au tableau
Me.HTAB_Logos.Rows.Insert(Me.HTAB_Logos.Rows.Count - 1, trRow)
End If
Next
End Sub
end class
end namespace |