-
Notifications
You must be signed in to change notification settings - Fork 15
/
Wishlist.aspx.vb
231 lines (176 loc) · 9.39 KB
/
Wishlist.aspx.vb
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
230
231
'========================================================================
'Kartris - www.kartris.com
'Copyright 2024 CACTUSOFT
'GNU GENERAL PUBLIC LICENSE v2
'This program is free software distributed under the GPL without any
'warranty.
'www.gnu.org/licenses/gpl-2.0.html
'KARTRIS COMMERCIAL LICENSE
'If a valid license.config issued by Cactusoft is present, the KCL
'overrides the GPL v2.
'www.kartris.com/t-Kartris-Commercial-License.aspx
'========================================================================
Partial Class Wishlist
Inherits PageBaseClass
Private blnPrivate As Boolean = False
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim numCustomerID As Integer = 0
Dim numWishlistID As Integer = 0
blnPrivate = False
If Not (IsPostBack) Then
Try
numWishlistID = CInt(Request.QueryString("WishlistID"))
Catch ex As Exception
End Try
If numWishlistID > 0 Then ''// query string paramater passed
If Not (User.Identity.IsAuthenticated) Then
numCustomerID = 0
Else
numCustomerID = CurrentLoggedUser.ID
End If
Dim tblWishList As New DataTable
Dim objBasket As New kartris.Basket
tblWishList = BasketBLL.GetCustomerWishList(numCustomerID, numWishlistID)
Dim blnAllow As Boolean = False
If tblWishList.Rows.Count > 0 Then
If tblWishList.Rows(0).Item("WL_UserID") = numCustomerID Then blnAllow = True
End If
If blnAllow Then ''// current login is the owner of passed wishlist id
blnPrivate = True
litOwnerName.Text = Server.HtmlEncode(CkartrisDataManipulation.FixNullFromDB(tblWishList.Rows(0).Item("U_AccountHolderName"))) & ""
If litOwnerName.Text = "" Then litOwnerName.Text = Server.HtmlEncode(tblWishList.Rows(0).Item("U_EmailAddress")) & ""
litMessage.Text = tblWishList.Rows(0).Item("WL_Message")
rptWishList.DataSource = BasketBLL.GetRequiredWishlist(numCustomerID, numWishlistID, Session("LANG"))
rptWishList.DataBind()
pnlLogin.Visible = False
pnlWishlist.Visible = True
Else ''// wishlist id is from the other owner or wishlist id doesn't exist
With popMessage
.SetTitle = GetGlobalResourceObject("Kartris", "PageTitle_WishListLogin")
.SetTextMessage = GetGlobalResourceObject("Kartris", "ContentText_WishListNotFound")
.ShowPopup()
End With
pnlLogin.Visible = True
pnlWishlist.Visible = False
End If
tblWishList.Dispose()
objBasket = Nothing
Else ''// invalid passed wishlist id or not passed
blnPrivate = False
''// for kartris v2
Dim objSession As New SessionsBLL
If Val(objSession.Value("WL_ID")) > 0 Then ''// get wishlist from current session
Dim tblWishList As New DataTable
Dim objBasket As New kartris.Basket
''// for kartris v2
With objSession
Session("WL_ID") = .Value("WL_ID")
litOwnerName.Text = Server.HtmlEncode(.Value("WL_Owner"))
litMessage.Text = Server.HtmlEncode(.Value("WL_Message"))
rptWishList.DataSource = BasketBLL.GetRequiredWishlist(Val(.Value("WL_UserID")), Val(.Value("WL_ID")), Session("LANG"))
rptWishList.DataBind()
End With
tblWishList.Dispose()
objBasket = Nothing
pnlLogin.Visible = False
pnlWishlist.Visible = True
Else
pnlLogin.Visible = True
pnlWishlist.Visible = False
End If
End If
End If
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
If blnPrivate Then
phdLogout.Visible = False
Else
phdLogout.Visible = True
End If
End Sub
Protected Sub rptWishList_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptWishList.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
CType(e.Item.FindControl("lnkWishListItem"), HyperLink).Text = e.Item.DataItem("VersionName")
Dim strURL As String = SiteMapHelper.CreateURL(SiteMapHelper.Page.CanonicalProduct, e.Item.DataItem("V_ProductID"))
Dim strOptionLink As String = ""
'Dim objOptionsBasket As New kartris.Basket
If Not String.IsNullOrEmpty(BasketBLL.GetOptionText(CkartrisBLL.GetLanguageIDfromSession, e.Item.DataItem("BV_ID"), strOptionLink)) Then
strOptionLink = "&strOptions=" & strOptionLink
Else
strOptionLink = "&strOptions=0"
End If
If strURL.Contains("?") Then
strURL = strURL & strOptionLink
Else
strURL = strURL & Replace(strOptionLink, "&", "?")
End If
CType(e.Item.FindControl("lnkWishListItem"), HyperLink).NavigateUrl = strURL
'objOptionsBasket = Nothing
If blnPrivate Then
CType(e.Item.FindControl("litRequired"), Literal).Text = e.Item.DataItem("WishlistQty") & "/" & e.Item.DataItem("BV_Quantity") & " " & GetGlobalResourceObject("Kartris", "ContentText_StillRequired")
Else
CType(e.Item.FindControl("litRequired"), Literal).Text = e.Item.DataItem("WishlistQty") & " " & GetGlobalResourceObject("Kartris", "ContentText_StillRequired")
End If
If e.Item.DataItem("WishlistQty") < 1 Then
CType(e.Item.FindControl("litRequired"), Literal).Text = GetGlobalResourceObject("Kartris", "ContentText_AllRequiredPurchased")
End If
End If
End Sub
Sub WishListLogin_Click(ByVal Sender As Object, ByVal E As CommandEventArgs)
' Dim objBasket As New kartris.Basket
Dim strWishlistEmail As String = Trim(txtWishListEmail.Text)
Dim strPassword As String = Trim(txtPassword.Text)
Dim tblWishList As DataTable = BasketBLL.GetWishListLogin(strWishlistEmail, strPassword)
If tblWishList.Rows.Count > 0 Then
''// for kartris v2
Dim objSession As New SessionsBLL
With objSession
.Edit("WL_UserID", tblWishList.Rows(0).Item("WL_UserID"))
.Edit("WL_ID", tblWishList.Rows(0).Item("WL_ID"))
.Edit("WL_Owner", IIf(tblWishList.Rows(0).Item("U_AccountHolderName") & "" = "", strWishlistEmail, tblWishList.Rows(0).Item("U_AccountHolderName")))
.Edit("WL_Message", tblWishList.Rows(0).Item("WL_Message"))
End With
litOwnerName.Text = Server.HtmlEncode(IIf(tblWishList.Rows(0).Item("U_AccountHolderName") & "" = "", strWishlistEmail, tblWishList.Rows(0).Item("U_AccountHolderName")))
litMessage.Text = Server.HtmlEncode(tblWishList.Rows(0).Item("WL_Message"))
rptWishList.DataSource = BasketBLL.GetRequiredWishlist(tblWishList.Rows(0).Item("WL_UserID"), tblWishList.Rows(0).Item("WL_ID"), Session("LANG"))
rptWishList.DataBind()
Session("WL_UserID") = tblWishList.Rows(0).Item("WL_UserID")
Session("WL_ID") = tblWishList.Rows(0).Item("WL_ID")
Session("WL_Owner") = IIf(tblWishList.Rows(0).Item("U_AccountHolderName") & "" = "", strWishlistEmail, tblWishList.Rows(0).Item("U_AccountHolderName"))
Session("WL_Message") = tblWishList.Rows(0).Item("WL_Message")
tblWishList.Dispose()
'objBasket = Nothing
pnlLogin.Visible = False
pnlWishlist.Visible = True
updWishlist.Update()
Else
With popMessage
.SetTitle = GetGlobalResourceObject("Kartris", "PageTitle_WishListLogin")
.SetTextMessage = GetGlobalResourceObject("Kartris", "ContentText_WishListNotFound")
.ShowPopup()
End With
End If
tblWishList.Dispose()
'objBasket = Nothing
End Sub
Protected Sub Logout_Click()
''// for kartris v2
Dim objSession As New SessionsBLL
With objSession
.Delete("WL_UserID")
.Delete("WL_ID")
.Delete("WL_Owner")
.Delete("WL_Message")
End With
''//
''// to be removed
Session("WL_UserID") = 0
Session("WL_ID") = 0
Session("WL_Owner") = ""
Session("WL_Message") = ""
txtPassword.Text = ""
pnlLogin.Visible = True
pnlWishlist.Visible = False
updWishlist.Update()
End Sub
End Class