Line 1: Imports Microsoft.VisualBasic
Line 2: Imports System
Line 3: Imports System.IO
Line 4: Imports System.Xml
Line 5: Imports System.Text
Line 6: Imports System.Data
Line 7: Imports System.Security.Cryptography
Line 8: 'Imports SQLRS
Line 9: 'Imports PayPal.Payments.Common
Line 10: 'Imports PayPal.Payments.Common.Utility
Line 11: 'Imports PayPal.Payments.DataObjects
Line 12: 'Imports PayPal.Payments.Transactions
Line 13: Imports System.Globalization
Line 14: Imports System.Net.Mail
Line 15: Imports System.Net
Line 16: Imports System.Text.RegularExpressions
Line 17: Imports System.Net.Http
Line 18:
Line 19: Imports Newtonsoft.Json
Line 20: 'Imports System.Data.Services.Client
Line 21: Imports SalesForce.SalesForceName
Line 22: Imports SendGrid
Line 23: Imports SendGrid.Helpers.Mail
Line 24: Imports System.Drawing
Line 25:
Line 26: Public Class CInvitationClass
Line 27: Public TicketTypeBoothworkerID As String
Line 28: Public TicketTypeInvitationID As String
Line 29: Public EventId As String
Line 30: Dim BoothWorkerAllPriceMember As String
Line 31: Dim BoothWorkerAllPriceNonMember As String
Line 32: Dim SalesBoothRentalItemID As String
Line 33: Dim SalesBoothWorkerItemID As String
Line 34: Dim BadgeExhibitorBoothWorkerOnly As String
Line 35: Dim BadgeExhibitorBoothWorkerTypeId As String
Line 36: Dim BoothWorkerFormID As String
Line 37: Dim FieldGroupId As String
Line 38:
Line 39: 'Dim ProductIDRETAIL As String = System.Configuration.ConfigurationManager.AppSettings("ProductIDRETAIL")
Line 40:
Line 41: Public Sub New()
Line 42: Try
Line 43: TicketTypeBoothworkerID = System.Configuration.ConfigurationManager.AppSettings("TicketTypeBoothworkerID")
Line 44: TicketTypeInvitationID = System.Configuration.ConfigurationManager.AppSettings("TicketTypeInvitationID")
Line 45: EventId = System.Configuration.ConfigurationManager.AppSettings("EventId")
Line 46: BoothWorkerAllPriceMember = System.Configuration.ConfigurationManager.AppSettings("BoothWorkerAllPriceMember")
Line 47: BoothWorkerAllPriceNonMember = System.Configuration.ConfigurationManager.AppSettings("BoothWorkerAllPriceNonMember")
Line 48: SalesBoothRentalItemID = System.Configuration.ConfigurationManager.AppSettings("SalesBoothRentalItemID")
Line 49: SalesBoothWorkerItemID = System.Configuration.ConfigurationManager.AppSettings("SalesBoothWorkerItemID")
Line 50: BadgeExhibitorBoothWorkerOnly = System.Configuration.ConfigurationManager.AppSettings("BadgeExhibitorBoothWorkerOnly")
Line 51: BadgeExhibitorBoothWorkerTypeId = System.Configuration.ConfigurationManager.AppSettings("BadgeExhibitorBoothWorkerTypeId")
Line 52: BoothWorkerFormID = System.Configuration.ConfigurationManager.AppSettings("BoothWorkerFormID")
Line 53: FieldGroupId = System.Configuration.ConfigurationManager.AppSettings("FieldGroupId")
Line 54: Catch ex As Exception
Line 55: Throw ex
Line 56: End Try
Line 57:
Line 58: End Sub
Line 59:
Line 60: Public Structure PaypalTransaction
Line 61: Public Response As String
Line 62: Public ResponseMsg As String
Line 63: Public PNREF As String
Line 64: Public AuthCode As String
Line 65: Public Comments As String
Line 66: Public PaymentsKey As Integer
Line 67: Public CVVMatch As String
Line 68: End Structure
Line 69: Public Structure PaymentInfo
Line 70: Public Amount As Decimal
Line 71: Public PaymentType As String
Line 72: Public MaskedCCNumber As String
Line 73: Public CCName As String
Line 74: Public DatePaid As DateTime
Line 75: Public CCFirstChar As String
Line 76: End Structure
Line 77: Public Structure ProductInfo
Line 78: Public ShortDescription As String
Line 79: Public LongDescription As String
Line 80: Public Subsystem As String
Line 81: Public ParentProduct As String
Line 82: Public ProductCode As String
Line 83: Public ProductId As String
Line 84: 'added below 3/20/13 BTW
Line 85: Public NeedBirthDate As String
Line 86: Public NeedGender As String
Line 87: Public NeedSize As String
Line 88: Public Usr_Team_Info_Text As String
Line 89: Public Usr_Team As String
Line 90: Public sCart_Before_PrivateKey As Integer
Line 91: Public USR_ASK_YRS_INDUSTRY_FLAG As String
Line 92: Public USR_ASK_FIRST_TIME_FLAG As String
Line 93: Public usr_mailed_badge As String
Line 94: Public ECOMMERCE_END_DATE As String
Line 95: Public START_DATE As String
Line 96: Public product_type_code As String
Line 97: End Structure
Line 98: Public Structure ZipLookup
Line 99: Public city As String
Line 100: Public state As String
Line 101: End Structure
Line 102: Public Structure ExhSalesShipTo
Line 103: Public masterid As String
Line 104: Public addressid As String
Line 105: Public State As String
Line 106: Public Country As String
Line 107: End Structure
Line 108: Public Structure ExhibitorShipTo
Line 109: Public masterid As String
Line 110: Public addressid As String
Line 111: Public State As String
Line 112: Public Country As String
Line 113: End Structure
Line 114:
Line 115: Public Structure CustomerInfo
Line 116: Public BadgeType As String
Line 117: Public FirstName As String
Line 118: Public LastName As String
Line 119: Public Company As String
Line 120: Public Address1 As String
Line 121: Public Address2 As String
Line 122: Public City As String
Line 123: Public State As String
Line 124: Public StateCode As String
Line 125: Public Postal As String
Line 126: Public CountryCode As String
Line 127: Public CountryDesc As String
Line 128: Public Phone As String
Line 129: Public Fax As String
Line 130: Public Email As String
Line 131: Public JobTitle As String
Line 132: Public Cus_Address_ID As String
Line 133: Public BusType As String
Line 134: Public MASTER_CUSTOMER_ID As String
Line 135: 'BELOW USED FOR FUNCTION GetBoothBillContactInfo
Line 136: Public FirstTime As String
Line 137: Public MailBadge As String
Line 138: Public Optout As String
Line 139: Public EmployeeId As String
Line 140: Public ShipMasterId As String
Line 141: Public USR_BADGE_EMAIL_REGLIST_FLAG As String
Line 142:
Line 143: Public Address3 As String
Line 144: Public Address4 As String
Line 145: Public URL As String
Line 146: Public Name_Prefix As String
Line 147: Public Name_Suffix As String
Line 148: Public Middle_Name As String
Line 149: Public AddressTypeCode As String
Line 150: Public formatted_address As String
Line 151: Public Customer_label_name As String
Line 152: Public customer_class_code As String
Line 153: End Structure
Line 154:
Line 155: Public Structure BoothWorkerInfo
Line 156: Public BadgeType As String
Line 157: Public FirstName As String
Line 158: Public AliasFirstName As String
Line 159: Public LastName As String
Line 160: Public Company As String
Line 161: Public Address1 As String
Line 162: Public Address2 As String
Line 163: Public City As String
Line 164: Public State As String
Line 165: Public Postal As String
Line 166: Public CountryCode As String
Line 167: Public CountryDescr As String
Line 168: Public Phone As String
Line 169: Public Fax As String
Line 170: Public Email As String
Line 171: Public JobTitle As String
Line 172: Public BusType As String
Line 173: Public USR_BADGE_SEQ As String
Line 174: Public USR_ORDERNO As String
Line 175: Public USR_ORDER_LINE_NUMBER As String
Line 176: Public USR_FIRST_TIME As String
Line 177: Public USR_Mail_Badge_Flag As String
Line 178: Public Master_Customer_ID As String
Line 179: Public Master_Customer_Address_ID As Integer
Line 180: Public Employeeid As String
Line 181: Public EmployeeAddressid As String
Line 182: Public USR_BADGE_REGLIST_FLAG As String
Line 183: Public USR_BADGE_EMAIL_REGLIST_FLAG As String
Line 184: 'Public Booth_no As String
Line 185: End Structure
Line 186: Public Structure OrderMasterInfo
Line 187: Public BMasterID As String
Line 188: Public BAddressID As String
Line 189: Public SMasterID As String
Line 190: Public SAddressID As String
Line 191: Public ShipName As String
Line 192: Public ShipCompany As String
Line 193: Public ShipAddress1 As String
Line 194: Public ShipAddress2 As String
Line 195: Public ShipCity As String
Line 196: Public ShipState As String
Line 197: Public ShipPostal As String
Line 198: Public ShipCountry As String
Line 199: Public ShipPhone As String
Line 200: End Structure
Line 201: Public Structure OrderDetailInfo
Line 202: Public RateCode As String
Line 203: Public RateStructure As String
Line 204: Public SMasterID As String
Line 205: Public SAddressID As String
Line 206: End Structure
Line 207: Public Structure ExhibitorInfo
Line 208: Public ShipMasterID As String
Line 209: Public ExhibitorAlias As String
Line 210: Public CompanyName As String
Line 211: End Structure
Line 212: Public Structure BadgeInfo
Line 213: Public FirstName As String
Line 214: Public LastName As String
Line 215: Public Company As String
Line 216: Public City As String
Line 217: Public State As String
Line 218: Public Country As String
Line 219: Public MailBadge As String
Line 220: Public MailtoExhibitor As String
Line 221: Public Email As String
Line 222: Public OrderNumber As String
Line 223: End Structure
Line 224: Public Structure AddressVerification
Line 225: Public Validated As Boolean
Line 226: Public ErrorMsg As String
Line 227: Public Address1 As String
Line 228: Public Address2 As String
Line 229: Public City As String
Line 230: Public State As String
Line 231: Public Postal As String
Line 232: Public CountryCode As String
Line 233: Public CountryDesc As String
Line 234: Public XMLRESPONSE As String
Line 235: End Structure
Line 236: Public Structure A2ZInfo
Line 237: Public CustomerID As String
Line 238: Public A2ZCompanyID As String
Line 239: Public OrderNo As String
Line 240: Public OrderLineNo As String
Line 241: Public BoothNo As String
Line 242: Public EventId As String
Line 243: Public EventCode As String
Line 244: Public SubExhibitor As String
Line 245: Public CompanyName As String
Line 246: Public IsFloral As Boolean
Line 247: End Structure
Line 248: Public Structure CreditTotals
Line 249:
Line 250: 'SELECT Id, FS_Boothworker_Credits_Used__c, FS_Exhibitor_Credits__c, FS_Manual_Exhibitor_Credits__c, FS_Purchased_Exhibitor_Credits__c, FS_Purchased_Exhibitor_Credits_Used__c, FS_Tradeshow_Pass_Credits_Used__c FROM FS_Exhibitor_Booth__c WHERE Id = 'a2x5b00000624XwAAI'
Line 251: Public Total_Credits As Integer
Line 252: Public Booth_Workers_Used_Credits As Integer
Line 253: 'Public Booth_Workers_Pending_Credits As Integer
Line 254: Public All_Access_Pass_Upgraded_Credits As Integer
Line 255: Public Floral_Access_Pass_Upgraded_Credits As Integer
Line 256: Public Trade_Show_Only_Passes_Used_Credits As Integer
Line 257: Public Trade_Show_Only_Passes_Pending_Credits As Integer
Line 258: Public Trade_Show_Only_Passes_Registered As Integer
Line 259:
Line 260: Public Booth_Workers_Used_Passes As Integer
Line 261: 'Public Booth_Workers_Pending_Passes As Integer
Line 262: Public All_Access_Pass_Upgraded_Passes As Integer
Line 263: Public Floral_Access_Upgraded_Passes As Integer
Line 264: Public Trade_Show_Only_Passes_Used_Passes As Integer
Line 265: Public Trade_Show_Only_Passes_Pending_Passes As Integer
Line 266:
Line 267: Public Total_Credits_Available As Integer
Line 268: Public Total_Credits_Used As Integer
Line 269: Public OrderLineNo As String
Line 270: Public OrderNo As String
Line 271: Public inviteCount As Integer
Line 272: End Structure
Line 273: Public Structure VerisignTransaction
Line 274: Public Response As String
Line 275: Public ResponseMsg As String
Line 276: Public AuthCode As String
Line 277: Public PNREF As String
Line 278: Public Comments As String
Line 279: Public CVVMatch As String
Line 280: End Structure
Line 281: Private key() As Byte = {}
Line 282: Private IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}
Line 283: Dim PersonifyDatabaseName As String = System.Configuration.ConfigurationManager.AppSettings("PersonifyDatabaseName")
Line 284: Dim Database As String = Left(UCase(Trim(PersonifyDatabaseName)), 5)
Line 285: Dim MeetingCode As String = System.Configuration.ConfigurationManager.AppSettings("CurrentShow").Trim()
Line 286: Dim CurrentEXPO As String = System.Configuration.ConfigurationManager.AppSettings("CurrentEXPO").Trim()
Line 287: Dim SurveyReasonAttendingID As String = System.Configuration.ConfigurationManager.AppSettings("SurveyReasonAttendingID")
Line 288: Public Sub OpenPDFWindow(ByVal myurl As String, ByVal MyPage As System.Web.UI.Page)
Line 289: Dim strScript As String
Line 290: Dim type As Type = Me.GetType()
Line 291:
Line 292: 'strScript = "<script language=" & Chr(34) & "javascript" & Chr(34) & " type=" & Chr(34) & "text/javascript" & Chr(34) & ">"
Line 293: 'strScript += "window.open('" & myurl & "', '_newtab');")
Line 294: 'strScript += "</script>"
Line 295:
Line 296: 'MyPage.ClientScript.RegisterStartupScript(type, "INVITE", strScript)
Line 297: MyPage.ClientScript.RegisterStartupScript(type, "INVITE", "window.open('" & myurl & "');", True)
Line 298: End Sub
Line 299: Public Sub RegisterDisableButtonScript(ByVal MyPage As System.Web.UI.Page)
Line 300: Dim strScript As String
Line 301: Dim type As Type = Me.GetType()
Line 302:
Line 303: strScript = "<script language=" & Chr(34) & "javascript" & Chr(34) & " type=" & Chr(34) & "text/javascript" & Chr(34) & ">"
Line 304: strScript += "<!--"
Line 305: strScript += "Function DisableButton() {"
Line 306: strScript += "document.forms[0].submit();"
Line 307: strScript += "window.setTimeout(" & Chr(34) & "disableButton('" & Chr(34) & " + "
Line 308: strScript += " window.event.srcElement.id + " & Chr(34) & "')" & Chr(34) & ", 0);"
Line 309: strScript += " }"
Line 310: strScript += " function disableButton(buttonID) {"
Line 311: strScript += " document.getElementById(buttonID).disabled=true;"
Line 312: strScript += " }"
Line 313: strScript += " //-->"
Line 314: strScript += " </script>"
Line 315:
Line 316: MyPage.ClientScript.RegisterStartupScript(type, "disablebutton", strScript)
Line 317: End Sub
Line 318: Public Function GetStateCode(ByVal cntrycode As String, ByVal statedescr As String) As String
Line 319: GetStateCode = ""
Line 320: Dim myqueryStates As String = "SELECT State__c, State_Code__c FROM Countries__c where Country__c= '" & cntrycode & "' and State__c = '" & statedescr & "' Limit 1 "
Line 321: Dim dtStates As DataTable = SalesForceHelper.strQuerySalesforce(myqueryStates)
Line 322:
Line 323: Try
Line 324: For Each row As DataRow In dtStates.Rows
Line 325: GetStateCode = row("StateCodec").ToString()
Line 326: Next
Line 327:
Line 328: Catch ex As Exception
Line 329:
Line 330: End Try
Line 331:
Line 332: End Function
Line 333: Public Function GetCheckboxes(ByVal ckbxlst As CheckBoxList) As [String]
Line 334: Dim str As [String] = ""
Line 335: Try
Line 336: For i As Integer = 0 To ckbxlst.Items.Count - 1
Line 337: If ckbxlst.Items(i).Selected Then
Line 338: If str = "" Then
Line 339: str = ckbxlst.Items(i).Value
Line 340: Else
Line 341: str += "," + ckbxlst.Items(i).Value
Line 342: End If
Line 343: End If
Line 344: Next
Line 345: Catch ex As Exception
Line 346: 'Me.ShowErrorMessage(ex.Message, "...btnSaveSetProject")
Line 347: End Try
Line 348: GetCheckboxes = str
Line 349: End Function
Line 350: Function ReplaceUni(ByVal entrystring As String) As String
Line 351: entrystring = Replace(entrystring, Chr(160), " ")
Line 352: ReplaceUni = entrystring
Line 353: End Function
Line 354: Function ReplaceBln(ByVal thisboolean As Boolean) As String
Line 355: ReplaceBln = "N"
Line 356: If thisboolean = True Then
Line 357: ReplaceBln = "Y"
Line 358: End If
Line 359: End Function
Line 360: Public Sub WriteCookieSetSession(ByVal strValue As String, ByVal StrSessionName As String)
Line 361: Try
Line 362: Dim acookie As New HttpCookie("INV")
Line 363: Dim encryptedKey As String = strValue
Line 364: acookie.Values.Add(StrSessionName, strValue)
Line 365: acookie.Expires = DateTime.MaxValue ' Never Expires
Line 366: System.Web.HttpContext.Current.Response.Cookies.Add(acookie)
Line 367: Catch ex As Exception
Line 368:
Line 369: End Try
Line 370:
Line 371: If System.Web.HttpContext.Current.Session(StrSessionName) Is Nothing Then
Line 372: System.Web.HttpContext.Current.Session.Add(StrSessionName, strValue)
Line 373: Else
Line 374: System.Web.HttpContext.Current.Session(StrSessionName) = strValue
Line 375: End If
Line 376:
Line 377: End Sub
Line 378: Public Sub CookieSet(ByVal myName As String, ByVal myValue As String)
Line 379: Try
Line 380: Dim logincookie As New HttpCookie(myName)
Line 381: logincookie.Values(myName) = myValue
Line 382: System.Web.HttpContext.Current.Response.Cookies.Add(logincookie)
Line 383: Catch ex As Exception
Line 384:
Line 385: End Try
Line 386: End Sub
Line 387: Public Function CookieGet(ByVal myName As String) As String
Line 388: CookieGet = ""
Line 389: Try
Line 390: Dim logincookie As HttpCookie = System.Web.HttpContext.Current.Request.Cookies(myName)
Line 391: CookieGet = logincookie.Values(myName)
Line 392: 'If System.Web.HttpContext.Current.Request.Cookies.Get(myName) Is Nothing Then
Line 393: ' CookieGet = ""
Line 394: 'Else
Line 395: ' CookieGet = System.Web.HttpContext.Current.Request.Cookies.Get(myName).ToString()
Line 396: 'End If
Line 397: Catch ex As Exception
Line 398: System.Web.HttpContext.Current.Response.Write("CookieGet:" & ex.Message)
Line 399: End Try
Line 400: End Function
Line 401:
Line 402: Public Function ContactExistsInEvent(ByVal mcontact As String) As Boolean
Line 403: ContactExistsInEvent = False
Line 404:
Line 405: Dim myemailquery As String = "SELECT Id "
Line 406: myemailquery += " From EventApi__Attendee__c Where "
Line 407: myemailquery += " EventApi__Attendee_Event__c = '" & EventId & "' AND "
Line 408: myemailquery += " IsDeleted = false AND "
Line 409: myemailquery += " EventApi__Status__c = 'Registered' AND "
Line 410: myemailquery += " (EventApi__Contact__c = '" & mcontact & "' )"
Line 411: Dim dtEmail As DataTable = SalesForceHelper.strQuerySalesforce(myemailquery)
Line 412:
Line 413:
Line 414: For Each row As DataRow In dtEmail.Rows
Line 415: ContactExistsInEvent = True
Line 416: Exit For
Line 417: Next
Line 418:
Line 419:
Line 420: End Function
Line 421: Public Function EmailorContactExistsInEvent(ByVal memail As String, ByVal mcontact As String) As Boolean
Line 422: EmailorContactExistsInEvent = False
Line 423:
Line 424: Dim myemailquery As String = "SELECT Id "
Line 425: myemailquery += " From EventApi__Attendee__c Where "
Line 426: myemailquery += " EventApi__Attendee_Event__c = '" & EventId & "' AND "
Line 427: myemailquery += " IsDeleted = false AND "
Line 428: myemailquery += " EventApi__Status__c = 'Registered' AND "
Line 429: myemailquery += " (EventApi__Contact__c = '" & mcontact & "' or EventApi__Preferred_Email__c = '" & memail & "' or EventApi__Contact__r.Email = '" & memail & "' or EventApi__Contact__r.OrderApi__Preferred_Email__c = '" & memail & "')"
Line 430: Dim dtEmail As DataTable = SalesForceHelper.strQuerySalesforce(myemailquery)
Line 431:
Line 432:
Line 433: For Each row As DataRow In dtEmail.Rows
Line 434: EmailorContactExistsInEvent = True
Line 435: Exit For
Line 436: Next
Line 437:
Line 438:
Line 439: End Function
Line 440: Public Function GetBarcodeHtmlEmbedded(ByVal id As String) As String
Line 441:
Line 442: Try
Line 443:
Line 444: 'barcode.Alphabet = 25 '25 = QRCODE CODE128
Line 445: 'barcode.QrECL = 1 '0=>L, 1 =>M, 2=>Q, 3=>H
Line 446: 'barcode.QrMinVersion = 10
Line 447: 'barcode.ECI = 0
Line 448: 'barcode.UTF8 = 0
Line 449: 'barcode.Text = data
Line 450: 'Dim w = barcode.BitmapW
Line 451: 'Dim h = barcode.BitmapH
Line 452: 'stream = barcode.GetPicture(1, w * 3, h * 3) '1 =>GIF, 2=>PNG, 3=>JPG
Line 453: 'Dim data = System.Configuration.ConfigurationManager.AppSettings("QRCodeURL") & "?keyid=" & Request.QueryString("data")
Line 454: Dim guid = id
Line 455: Dim data = id
Line 456:
Line 457: 'Creates an instance of StrokeScribe class
Line 458: Dim barcode = CreateObject("STROKESCRIBE.StrokeScribeClass.1")
Line 459: Dim stream As System.Runtime.InteropServices.ComTypes.IStream
Line 460:
Line 461: barcode.Alphabet = 5 '5 CODE128 '25 = QR Code
Line 462: barcode.Text = data
Line 463:
Line 464: 'barcode.QrECL = 1 '0=>L, 1 =>M, 2=>Q, 3=>H
Line 465:
Line 466: Dim w = barcode.BitmapW 'BitmapW returns the smallest image width in pixels to fit the barcode
Line 467: Dim h = barcode.BitmapH
Line 468:
Line 469: stream = barcode.GetPicture(3, w, 90) '1=GIF; w/h - width and height in pixels
Line 470: If barcode.Error Then 'On error, log the description and abort the script execution
Line 471: 'Send the value of barcode.ErrorDescription to a logging facility
Line 472: Else
Line 473:
Line 474: End If
Line 475:
Line 476: Dim stat As System.Runtime.InteropServices.ComTypes.STATSTG
Line 477: stream.Stat(stat, 0) 'Size of data (in bytes) stored in stream
Line 478: Dim buf(stat.cbSize) As Byte 'Buffer to receive streamed data
Line 479:
Line 480: 'Because the BinaryWrite method doesn't accept the IStream interface pointers,
Line 481: 'we need to create a temporary byte array to hold the picture data from the memory stream.
Line 482: stream.Read(buf, stat.cbSize, System.IntPtr.Zero) 'Read picture bytes from stream into the memory array
Line 483:
Line 484: 'want to save the binary file using binarywriter
Line 485: Try
Line 486: System.IO.File.WriteAllBytes(System.Configuration.ConfigurationManager.AppSettings("QRCodePath") & guid & ".jpg", buf)
Line 487: Catch ex As Exception
Line 488:
Line 489: End Try
Line 490:
Line 491: Dim image1 As New System.Drawing.Bitmap(System.Configuration.ConfigurationManager.AppSettings("QRCodePath") & guid & ".jpg")
Line 492: 'Dim image2 As New System.Drawing.Bitmap("C:\inetpub\Confirm\images\PMA Logo.png")
Line 493:
Line 494: 'resize logo **********************************************
Line 495: 'Dim original As System.Drawing.Image = System.Drawing.Image.FromFile("C:\path\to\some.jpg")
Line 496: 'Dim resized As System.Drawing.Image = ResizeImage(image2, New Size(30, 33))
Line 497: 'Dim memStream As MemoryStream = New MemoryStream()
Line 498: 'resized.Save(memStream, ImageFormat.Jpeg)
Line 499: 'resize logo **********************************************
Line 500:
Line 501: Dim bitmap As Bitmap = New Bitmap(image1.Width, image1.Height)
Line 502:
Line 503: Dim g As Graphics = Graphics.FromImage(bitmap)
Line 504: 'Dim adjustmentPosition As Int16 = IIf(System.Configuration.ConfigurationManager.AppSettings("QRCodeURL").Length > 23, 5, 0)
Line 505:
Line 506: g.DrawImage(image1, 0, 0)
Line 507: 'g.DrawImage(resized, 32 + adjustmentPosition, 36 + adjustmentPosition)
Line 508: If (Not System.IO.Directory.Exists(System.Configuration.ConfigurationManager.AppSettings("QRCodePath") & "/" & guid & "/")) Then
Line 509: System.IO.Directory.CreateDirectory(System.Configuration.ConfigurationManager.AppSettings("QRCodePath") & "/" & guid & "/")
Line 510: End If
Line 511: bitmap.Save(System.Configuration.ConfigurationManager.AppSettings("QRCodePath") & "/" & guid & "/" & guid & "_with_logo.jpg", Drawing.Imaging.ImageFormat.Jpeg)
Line 512: 'delete qrcode without logo
Line 513: 'Dim strbody As String = ""
Line 514: 'Dim mybase64image As String = Convert.ToBase64String(System.IO.File.ReadAllBytes(System.Configuration.ConfigurationManager.AppSettings("QRCodePath") & "/" & guid & "/" & guid & "_with_logo.jpg"))
Line 515: GetBarcodeHtmlEmbedded = GetImageUrl(System.Configuration.ConfigurationManager.AppSettings("QRCodePath") & "/" & guid & "/" & guid & "_with_logo.jpg")
Line 516:
Line 517:
Line 518:
Line 519: stream = Nothing
Line 520: barcode = Nothing
Line 521: bitmap.Dispose()
Line 522: image1.Dispose()
Line 523: 'image2.Dispose()
Line 524: g.Dispose()
Line 525: buf = Nothing
Line 526: stat = Nothing
Line 527: Dim FileDelete As String = System.Configuration.ConfigurationManager.AppSettings("QRCodePath") & guid & ".jpg"
Line 528: If System.IO.File.Exists(FileDelete) = True Then
Line 529: System.IO.File.Delete(FileDelete)
Line 530: End If
Line 531:
Line 532: 'Response.Clear() 'Our script will output binary data, so we need to set a new content type
Line 533: 'Response.ClearHeaders()
Line 534: 'Response.ContentType = "image/GIF"
Line 535: 'Response.AddHeader("Content-Disposition", "attachment; filename=barcode.gif")
Line 536: 'Response.OutputStream.Write(buf, 0, stat.cbSize) 'Send data to the remote browser
Line 537: 'Response.End()
Line 538:
Line 539: 'GetBarcodeHtml = "<p>" & "<img src='" & System.Configuration.ConfigurationManager.AppSettings("QRCodeURL") & "/" & id & "/" & id & "_with_logo.jpg'" & "/></p>"
Line 540: 'https:/ /IFPAPass.pma.com/a1n8K0000004b1rQAA/a1n8K0000004b1rQAA_with_logo.jpg
Line 541: Catch ex As Exception
Line 542: Console.Write("Error creating qrcode " & ex.Message.ToString())
Line 543: GetBarcodeHtmlEmbedded = ""
Line 544: End Try
Line 545: End Function
Line 546: Public Function GetImageUrl(ByVal imagePath As String) As String
Line 547: Dim image As System.Drawing.Image = System.Drawing.Image.FromFile(imagePath)
Line 548: Dim memoryStream As MemoryStream = New MemoryStream()
Line 549: image.Save(memoryStream, Imaging.ImageFormat.Jpeg)
Line 550: Dim bytes As Byte() = New Byte(memoryStream.Length - 1) {}
Line 551: memoryStream.Position = 0
Line 552: memoryStream.Read(bytes, 0, CInt(bytes.Length))
Line 553: Dim base64String As String = Convert.ToBase64String(bytes, 0, bytes.Length)
Line 554: Dim imageUrl As String = "data:image/png;base64," & base64String
Line 555: Return imageUrl
Line 556: End Function
Line 557: 'Public Function SetUserAccountAndContact(ByVal Accountid As String, ByVal Contactid As String, ByVal Id As String) As String
Line 558: ' Dim sfUser As SFUserUpdateAccountAndContact = New SFUserUpdateAccountAndContact()
Line 559:
Line 560: ' sfUser.AccountId = Accountid
Line 561: ' sfUser.ContactId = Contactid
Line 562:
Line 563: ' Dim result As Object = SalesForceHelper.UpdateUserAccountAndContact(sfUser, Id)
Line 564:
Line 565: ' If result.Data > "" Or result.IsSuccess = True Then
Line 566: ' Console.WriteLine(result.Data)
Line 567: ' End If
Line 568: ' Return result.data.ToString.Trim()
Line 569: 'End Function
Line 570:
Line 571: Public Function EmailExistsInEvent(ByVal memail As String) As Boolean
Line 572: EmailExistsInEvent = False
Line 573:
Line 574: Dim myemailquery As String = "SELECT Id "
Line 575: myemailquery += " From EventApi__Attendee__c Where "
Line 576: myemailquery += " EventApi__Attendee_Event__c = '" & EventId & "' AND "
Line 577: myemailquery += " IsDeleted = false AND "
Line 578: myemailquery += " EventApi__Status__c = 'Registered' AND "
Line 579: myemailquery += " (EventApi__Preferred_Email__c = '" & memail & "' or EventApi__Contact__r.Email = '" & memail & "' or EventApi__Contact__r.OrderApi__Preferred_Email__c = '" & memail & "')"
Line 580: Dim dtEmail As DataTable = SalesForceHelper.strQuerySalesforce(myemailquery)
Line 581:
Line 582:
Line 583: For Each row As DataRow In dtEmail.Rows
Line 584: EmailExistsInEvent = True
Line 585: Exit For
Line 586: Next
Line 587:
Line 588:
Line 589: End Function
Line 590: Public Function AttendeeExists(ByVal TicketTypeID As String, ByVal mcontactid As String, ByVal memail As String) As Boolean
Line 591: AttendeeExists = False
Line 592:
Line 593: Dim myqueryBoothWorker As String = "SELECT Id "
Line 594: myqueryBoothWorker += " From EventApi__Attendee__c Where "
Line 595: myqueryBoothWorker += " EventApi__Attendee_Event__c = '" & EventId & "' AND "
Line 596: myqueryBoothWorker += " EventApi__Status__c = 'Registered' and "
Line 597:
Line 598: If memail > "" And mcontactid > "" Then
Line 599: myqueryBoothWorker += " (EventApi__Contact__c='" & mcontactid & "' or EventApi__Preferred_Email__c = '" & memail & "')"
Line 600: ElseIf memail > "" Then
Line 601: myqueryBoothWorker += " EventApi__Preferred_Email__c = '" & memail & "' "
Line 602: ElseIf mcontactid > "" Then
Line 603: myqueryBoothWorker += " EventApi__Contact__c='" & mcontactid & "' "
Line 604: Else
Line 605: myqueryBoothWorker += " EventApi__Contact__c='123456789012345678' "
Line 606: End If
Line 607:
Line 608: Dim BoothWorkerdt As DataTable = SalesForceHelper.strQuerySalesforce(myqueryBoothWorker)
Line 609:
Line 610:
Line 611: For Each row As DataRow In BoothWorkerdt.Rows
Line 612: AttendeeExists = True
Line 613: Next
Line 614:
Line 615:
Line 616: End Function
Line 617:
Line 618: Public Sub UpdateCreditsUsed(ByVal ExhibitorBoothid As String, ByVal creditUsed As Int32, ByVal mytype As String)
Line 619: Dim myqueryExhibitorCredits As String = "SELECT Sum(FS_Exhibitor_Credits__c) Credits, sum(FS_Boothworker_Credits_Used__c) UsedBooth, sum(FS_Tradeshow_Pass_Credits_Used__c) UsedInvites FROM FS_Exhibitor_Booth__c WHERE id = '" & ExhibitorBoothid & "' "
Line 620: Dim ExhibitorCredits As DataTable = SalesForceHelper.strQuerySalesforce(myqueryExhibitorCredits)
Line 621:
Line 622: Dim TotalCredits As Int32 = 0
Line 623: Dim UsedBoothCredits As Int32 = 0
Line 624: Dim UsedInviteCredits As Int32 = 0
Line 625: For Each row As DataRow In ExhibitorCredits.Rows
Line 626: TotalCredits = Val(row("Credits"))
Line 627: UsedBoothCredits = Val(row("UsedBooth"))
Line 628: UsedInviteCredits = Val(row("UsedInvites"))
Line 629: Next
Line 630: If mytype = "BW" And TotalCredits > 0 Then
Line 631: 'update Booth Credits used
Line 632: Dim myBoothcredits As FSUpdateExhibitorBoothCredits = New FSUpdateExhibitorBoothCredits
Line 633: myBoothcredits.FS_Boothworker_Credits_Used__c = UsedBoothCredits + creditUsed
Line 634: Dim resultBooth As Object = SalesForceHelper.updateExhibitorBoothCredits(myBoothcredits, ExhibitorBoothid)
Line 635: If resultBooth.Data > "" Or resultBooth.IsSuccess = True Then
Line 636: End If
Line 637: End If
Line 638: If mytype = "Z" And TotalCredits > 0 Then
Line 639: 'update invites used could be more then 1 qty
Line 640: Dim myInvitecredits As FSUpdateExhibitorInviteCredits = New FSUpdateExhibitorInviteCredits
Line 641: myInvitecredits.FS_Tradeshow_Pass_Credits_Used__c = UsedInviteCredits + creditUsed
Line 642: Dim resultBooth As Object = SalesForceHelper.updateExhibitorInviteCredits(myInvitecredits, ExhibitorBoothid)
Line 643: If resultBooth.Data > "" Or resultBooth.IsSuccess = True Then
Line 644: End If
Line 645:
Line 646: End If
Line 647: End Sub
Line 648: Public Sub UpdateZCreditsPurchased(ByVal ExhibitorBoothid As String, ByVal creditUsed As Int32)
Line 649: Dim myqueryExhibitorCredits As String = "SELECT FS_Purchased_Exhibitor_Credits__c FROM FS_Exhibitor_Booth__c WHERE id = '" & ExhibitorBoothid & "' "
Line 650: Dim ExhibitorCredits As DataTable = SalesForceHelper.strQuerySalesforce2(myqueryExhibitorCredits)
Line 651:
Line 652: Dim TotalzCredits As Int32 = 0
Line 653: For Each row As DataRow In ExhibitorCredits.Rows
Line 654: TotalzCredits = Val(row("FS_Purchased_Exhibitor_Credits__c"))
Line 655: Next
Line 656:
Line 657: 'update invites purchased credits used could be more then 1 qty
Line 658: Dim myInvitecredits As FSUpdateExhibitorInvitePurchasedCredits = New FSUpdateExhibitorInvitePurchasedCredits
Line 659: myInvitecredits.FS_Purchased_Exhibitor_Credits__c = TotalzCredits + creditUsed
Line 660: Dim resultBooth As Object = SalesForceHelper.updateExhibitorInvitePurchasedCredits(myInvitecredits, ExhibitorBoothid)
Line 661: If resultBooth.Data > "" Or resultBooth.IsSuccess = True Then
Line 662: End If
Line 663:
Line 664:
Line 665: End Sub
Line 666:
Line 667:
Line 668: Public Function CreateUser(ByVal Contactid As String, ByVal FirstName As String, ByVal LastName As String, ByVal Email As String) As String
Line 669: CreateUser = ""
Line 670: Dim ProfileId As String = ""
Line 671: Try
Line 672: Dim myqueryProfile As String = "SELECT Id FROM Profile WHERE Name = 'Fonteva Customer Community Login User'"
Line 673: Dim Profile As DataTable = SalesForceHelper.strQuerySalesforce(myqueryProfile)
Line 674:
Line 675: For Each row As DataRow In Profile.Rows
Line 676: ProfileId = row("Id")
Line 677: Next
Line 678:
Line 679: Catch ex As Exception
Line 680: System.Web.HttpContext.Current.Response.Write("BoothWorkerBadgePrinted: " & ex.Message)
Line 681: End Try
Line 682:
Line 683:
Line 684: 'create user
Line 685: 'Account acc = [SELECT Id, Name, ShippingCountry from Account where Id='00102000008pn4EAAQ'];
Line 686:
Line 687: 'Contact c = [SELECT Id, FirstName, LastName, Accountid, Email, OrderApi__Work_Email__c, OrderApi__Preferred_Email_Type__c, OrderApi__Personal_Email__c from Contact where Id='00302000009DnCuAAK'];
Line 688:
Line 689: 'Profile prf = [SELECT Id FROM Profile WHERE Name = 'Fonteva Customer Community Login User'];
Line 690:
Line 691: Dim myalias As String = Left(Email.Substring(0, Email.IndexOf("@")), 8)
Line 692:
Line 693: Dim sfUser As SFNewUser = New SFNewUser()
Line 694:
Line 695: 'User u = New User(
Line 696: Dim uniqueid As String = Right("000" & (CInt(Math.Ceiling(Rnd() * 999)) + 1).ToString(), 3)
Line 697: Dim uniqueid2 As String = Right("00000000" & (CInt(Math.Ceiling(Rnd() * 99999999)) + 1).ToString(), 8)
Line 698: sfUser.Username = Email & uniqueid
Line 699:
Line 700: sfUser.Email = Email
Line 701: sfUser.LastName = LastName
Line 702: sfUser.Alias = myalias
Line 703: sfUser.CommunityNickname = FirstName & "." & LastName & "." & uniqueid2.ToString()
Line 704: sfUser.TimeZoneSidKey = "America/New_York"
Line 705: sfUser.LanguageLocaleKey = "en_US"
Line 706: sfUser.LocaleSidKey = "en_US"
Line 707: sfUser.EmailEncodingKey = "UTF-8"
Line 708: sfUser.ProfileId = ProfileId
Line 709: sfUser.ContactId = Contactid
Line 710:
Line 711: Dim result As Object = SalesForceHelper.EnableCustomerUser(sfUser)
Line 712:
Line 713: If result.Data > "" Or result.IsSuccess = True Then
Line 714: Console.WriteLine(result.Data)
Line 715: CreateUser = result.Data
Line 716: End If
Line 717:
Line 718: End Function
Line 719:
Line 720: Public Function GetProfileId(ByVal Accountid As String, ByVal Contactid As String, ByVal FirstName As String, ByVal LastName As String, ByVal Email As String) As String
Line 721: GetProfileId = ""
Line 722: Dim ProfileId As String = ""
Line 723: Try
Line 724: Dim myqueryProfile As String = "SELECT Id FROM Profile WHERE Name = 'Fonteva Customer Community Login User'"
Line 725: Dim Profile As DataTable = SalesForceHelper.strQuerySalesforce(myqueryProfile)
Line 726:
Line 727: For Each row As DataRow In Profile.Rows
Line 728: ProfileId = row("Id")
Line 729: Next
Line 730:
Line 731: Catch ex As Exception
Line 732: System.Web.HttpContext.Current.Response.Write("BoothWorkerBadgePrinted: " & ex.Message)
Line 733: End Try
Line 734:
Line 735:
Line 736: 'create user
Line 737: 'Account acc = [SELECT Id, Name, ShippingCountry from Account where Id='00102000008pn4EAAQ'];
Line 738:
Line 739: 'Contact c = [SELECT Id, FirstName, LastName, Accountid, Email, OrderApi__Work_Email__c, OrderApi__Preferred_Email_Type__c, OrderApi__Personal_Email__c from Contact where Id='00302000009DnCuAAK'];
Line 740:
Line 741: 'Profile prf = [SELECT Id FROM Profile WHERE Name = 'Fonteva Customer Community Login User'];
Line 742:
Line 743: Dim myalias As String = Left(Email.Substring(0, Email.IndexOf("@")), 8)
Line 744:
Line 745: Dim sfUser As SFNewUser = New SFNewUser()
Line 746:
Line 747: 'User u = New User(
Line 748:
Line 749: Dim uniqueid As String = Right("000" & (CInt(Math.Ceiling(Rnd() * 999)) + 1).ToString(), 3)
Line 750: Dim uniqueid2 As String = Right("00000000" & (CInt(Math.Ceiling(Rnd() * 99999999)) + 1).ToString(), 8)
Line 751: sfUser.Username = Email & uniqueid
Line 752:
Line 753: sfUser.Email = Email
Line 754: sfUser.LastName = LastName
Line 755: sfUser.Alias = myalias
Line 756: sfUser.CommunityNickname = FirstName & "." & LastName & "." & uniqueid2.ToString()
Line 757: sfUser.TimeZoneSidKey = "America/New_York"
Line 758: sfUser.LanguageLocaleKey = "en_US"
Line 759: sfUser.LocaleSidKey = "en_US"
Line 760: sfUser.EmailEncodingKey = "UTF-8"
Line 761: sfUser.ProfileId = ProfileId
Line 762: sfUser.ContactId = Contactid
Line 763:
Line 764: Dim result As Object = SalesForceHelper.EnableCustomerUser(sfUser)
Line 765:
Line 766: If result.Data > "" Or result.IsSuccess = True Then
Line 767: GetProfileId = result.Data
Line 768: 'Console.WriteLine(result.Data)
Line 769: End If
Line 770:
Line 771: End Function
Line 772: Public Function GetTotals(ByVal ExhibitorBoothid As String) As CreditTotals
Line 773: 'System.Web.HttpContext.Current.Response.Write("order=" & OrderNo)
Line 774:
Line 775: Dim mBoothWorkerOrdersFound As Integer = 0
Line 776: GetTotals.Total_Credits = 0
Line 777: GetTotals.Booth_Workers_Used_Credits = 0
Line 778: 'GetTotals.Booth_Workers_Pending_Credits = 0
Line 779: GetTotals.All_Access_Pass_Upgraded_Credits = 0
Line 780: GetTotals.Floral_Access_Pass_Upgraded_Credits = 0
Line 781: GetTotals.Trade_Show_Only_Passes_Pending_Credits = 0
Line 782: GetTotals.Trade_Show_Only_Passes_Used_Credits = 0
Line 783: GetTotals.Trade_Show_Only_Passes_Registered = 0
Line 784:
Line 785: GetTotals.Booth_Workers_Used_Passes = 0
Line 786: 'GetTotals.Booth_Workers_Pending_Passes = 0
Line 787: GetTotals.All_Access_Pass_Upgraded_Passes = 0
Line 788: GetTotals.Floral_Access_Upgraded_Passes = 0
Line 789: GetTotals.Trade_Show_Only_Passes_Pending_Passes = 0
Line 790: GetTotals.Trade_Show_Only_Passes_Used_Passes = 0
Line 791:
Line 792: GetTotals.Total_Credits_Available = 0
Line 793: GetTotals.OrderLineNo = ""
Line 794: GetTotals.OrderNo = ExhibitorBoothid
Line 795:
Line 796:
Line 797: Dim myqueryExhibitorCredits As String = "SELECT FS_Exhibitor_Credits__c,FS_Manual_Exhibitor_Credits__c , FS_Boothworker_Credits_Used__c , FS_Tradeshow_Pass_Credits_Used__c,FS_Purchased_Exhibitor_Credits__c FROM FS_Exhibitor_Booth__c WHERE FS_Event__c = '" & EventId & "' AND id = '" & ExhibitorBoothid & "'"
Line 798: Dim ExhibitorCredits As DataTable = SalesForceHelper.strQuerySalesforce2(myqueryExhibitorCredits)
Line 799:
Line 800: For Each row As DataRow In ExhibitorCredits.Rows
Line 801: GetTotals.Total_Credits = Val(row("FS_Exhibitor_Credits__c")) ' + Val(row("FS_Manual_Exhibitor_Credits__c"))
Line 802: GetTotals.Total_Credits_Used = Val(row("FS_Boothworker_Credits_Used__c")) + Val(row("FS_Tradeshow_Pass_Credits_Used__c"))
Line 803: GetTotals.Total_Credits_Available = GetTotals.Total_Credits - GetTotals.Total_Credits_Used
Line 804: If Val(row("FS_Boothworker_Credits_Used__c")) > 0 Then
Line 805: GetTotals.Booth_Workers_Used_Passes = Val(row("FS_Boothworker_Credits_Used__c")) / 2
Line 806: End If
Line 807: If Val(row("FS_Tradeshow_Pass_Credits_Used__c")) > 0 Or Val(row("FS_Purchased_Exhibitor_Credits__c")) > 0 Then
Line 808: GetTotals.Trade_Show_Only_Passes_Used_Passes = Val(row("FS_Tradeshow_Pass_Credits_Used__c")) + Val(row("FS_Purchased_Exhibitor_Credits__c"))
Line 809: End If
Line 810: Next
Line 811:
Line 812: 'Get Floral and All Access Pass counts
Line 813: '*********************************************************************
Line 814: 'Product Codes BWALL and BWFLORAL
Line 815:
Line 816: 'Try
Line 817:
Line 818: ' Dim Mkeywords = New Dictionary(Of String, String) From {{"OrderNumber", OrderNo}}
Line 819: ' Dim dt As DataTable
Line 820: ' dt = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_Pass_Class_Get_BW_Counts_From_Order_sp", Mkeywords)
Line 821: ' 'country_descr, USR_Spanish_Descr, Phone_Country_Code
Line 822: ' For Each row As DataRow In dt.Rows
Line 823: ' mBoothWorkerOrdersFound += Val(row("BoothWorker"))
Line 824: ' GetTotals.All_Access_Pass_Upgraded_Passes += Val(row("BoothWorkerAll"))
Line 825: ' GetTotals.All_Access_Pass_Upgraded_Credits += Val(row("BoothWorkerAll")) * 2
Line 826: ' Next
Line 827:
Line 828:
Line 829: 'Catch ex As Exception
Line 830: ' System.Web.HttpContext.Current.Response.Write("GetCreditTotals2:" & ex.Message)
Line 831: 'End Try
Line 832:
Line 833: '*********************************************************************
Line 834: '*********************************************************************
Line 835:
Line 836: '***********************************************************************************
Line 837:
Line 838: End Function
Line 839:
Line 840: Public Function FormatAddress(ByVal NameField As String, ByVal CompanyField As String, ByVal Address1 As String, ByVal City As String, ByVal State As String, ByVal Postal As String, ByVal Country As String) As String
Line 841: FormatAddress = ""
Line 842: If Not NameField = "" Then
Line 843: FormatAddress += NameField & "<br />"
Line 844: End If
Line 845: If Not CompanyField = "" Then
Line 846: FormatAddress += CompanyField & "<br />"
Line 847: End If
Line 848: If Not Address1 = "" Then
Line 849: FormatAddress += Address1 & "<br />"
Line 850: End If
Line 851: If Not City = "" Then
Line 852: FormatAddress += City & ", "
Line 853: End If
Line 854: If Not State = "" Then
Line 855: FormatAddress += State & " "
Line 856: End If
Line 857: If Not Postal = "" Then
Line 858: FormatAddress += Postal
Line 859: End If
Line 860: If Not Country = "" Then
Line 861: If Country = "USA" Or Country = "United States" Then
Line 862: Else
Line 863: FormatAddress += "<br />" & Country
Line 864: End If
Line 865: End If
Line 866:
Line 867: End Function
Line 868: 'Public Function ValidateAddressUSPS(ByVal strAddress1 As String, ByVal strCity As String, ByVal strState As String, ByVal strPostal As String, ByVal strCountryCode As String, ByVal strCountryDesc As String) As AddressVerification
Line 869: ' ValidateAddressUSPS.Address1 = strAddress1
Line 870: ' ValidateAddressUSPS.City = strCity
Line 871: ' ValidateAddressUSPS.CountryCode = strCountryCode
Line 872: ' ValidateAddressUSPS.CountryDesc = strCountryDesc
Line 873: ' ValidateAddressUSPS.ErrorMsg = ""
Line 874: ' ValidateAddressUSPS.Postal = strPostal
Line 875: ' ValidateAddressUSPS.State = strState
Line 876: ' ValidateAddressUSPS.XMLRESPONSE = ""
Line 877: ' ValidateAddressUSPS.Validated = False
Line 878: ' 'only for US Addresses
Line 879: ' If strCountryCode = "USA" Then
Line 880: ' Try
Line 881:
Line 882:
Line 883: ' Dim url As String = "http://production.shippingapis.com/ShippingAPI.dll?API=Verify&XML=<AddressValidateRequest%20USERID=" & Chr(34) & "996PRODU1887" & Chr(34) & "><Address ID=" & Chr(34) & "1" & Chr(34) & ">"
Line 884: ' Dim AddressLine1 As String = ""
Line 885: ' 'If strAddress1.StartsWith("Ste ") Or strAddress1.StartsWith("Suite ") Or strAddress1.StartsWith("Fl ") Or strAddress1.StartsWith("Stop ") Or strAddress1.StartsWith("Floor ") Or strAddress1.StartsWith("Room ") Or strAddress1.StartsWith("Rm ") Or strAddress1.StartsWith("Apartment ") Or strAddress1.StartsWith("Apt ") Or strAddress1.StartsWith("#") Or strAddress1.StartsWith("Unit ") Or strAddress1.StartsWith("Bldg ") Then
Line 886: ' ' AddressLine1 = strAddress1
Line 887: ' 'End If
Line 888: ' Dim urlAdd As String = ""
Line 889: ' urlAdd += "<Address1>" & AddressLine1 & "</Address1>"
Line 890: ' urlAdd += "<City>" & strCity & "</City>"
Line 891: ' urlAdd += "<State>" & strState & "</State>"
Line 892: ' strPostal = GetNumericOnly(strPostal)
Line 893: ' Dim Zip5 As String = Left(strPostal, 5)
Line 894: ' Dim Zip4 As String = ""
Line 895: ' If strPostal.Length > 5 Then
Line 896: ' Zip4 = Right(strPostal, 4)
Line 897: ' End If
Line 898: ' urlAdd += "<Zip5>" & Zip5 & "</Zip5>"
Line 899: ' urlAdd += "<Zip4>" & Zip4 & "</Zip4>"
Line 900: ' urlAdd += "</Address></AddressValidateRequest>"
Line 901: ' urlAdd = System.Web.HttpUtility.UrlEncode(urlAdd)
Line 902: ' url = url + urlAdd
Line 903: ' 'System.Web.HttpContext.Current.Response.Write("URL: " & url & "<br>")
Line 904: ' Dim addressresults As String
Line 905: ' With System.Net.WebRequest.Create(New Uri(url)).GetResponse()
Line 906: ' With New StreamReader(.GetResponseStream())
Line 907: ' addressresults = .ReadToEnd()
Line 908: ' End With
Line 909: ' End With
Line 910: ' Dim xmlDoc As New XmlDocument
Line 911: ' xmlDoc.LoadXml(addressresults)
Line 912:
Line 913: ' ValidateAddressUSPS.XMLRESPONSE = addressresults
Line 914: ' Dim strError As String = ""
Line 915: ' Dim Errornode As XmlNode = xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/Error/Description")
Line 916: ' If Errornode IsNot Nothing Then
Line 917: ' strError = Errornode.InnerText
Line 918: ' End If
Line 919:
Line 920: ' If strError = "" Then
Line 921: ' If xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/Address1") IsNot Nothing Then
Line 922: ' ValidateAddressUSPS.Address1 = Replace(InitialCaps(xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/Address1").InnerText), "Po Box", "PO Box")
Line 923: ' Else
Line 924: ' ValidateAddressUSPS.Address1 = ""
Line 925: ' End If
Line 926: ' If xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/Address2") IsNot Nothing Then
Line 927: ' ValidateAddressUSPS.Address2 = Replace(InitialCaps(xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/Address2").InnerText), "Po Box", "PO Box")
Line 928: ' Else
Line 929: ' ValidateAddressUSPS.Address2 = ""
Line 930: ' End If
Line 931: ' If xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/City") IsNot Nothing Then
Line 932: ' ValidateAddressUSPS.City = InitialCaps(xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/City").InnerText)
Line 933: ' End If
Line 934:
Line 935: ' Dim ReturnedZip5 As String = ""
Line 936: ' If xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/Zip5") IsNot Nothing Then
Line 937: ' ReturnedZip5 = xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/Zip5").InnerText
Line 938: ' End If
Line 939: ' Dim ReturnedZip4 As String = ""
Line 940: ' If xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/Zip4") IsNot Nothing Then
Line 941: ' ReturnedZip4 = xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/Zip4").InnerText
Line 942: ' End If
Line 943: ' If ReturnedZip4.Length = 4 Then
Line 944: ' ValidateAddressUSPS.Postal = ReturnedZip5 & "-" & ReturnedZip4
Line 945: ' Else
Line 946: ' ValidateAddressUSPS.Postal = ReturnedZip5
Line 947: ' End If
Line 948: ' If xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/State") IsNot Nothing Then
Line 949: ' ValidateAddressUSPS.State = xmlDoc.SelectSingleNode("/AddressValidateResponse/Address/State").InnerText.ToUpper
Line 950: ' End If
Line 951: ' ValidateAddressUSPS.Validated = True
Line 952: ' Else
Line 953: ' ValidateAddressUSPS.ErrorMsg = strError
Line 954: ' End If
Line 955: ' Catch ex As Exception
Line 956: ' System.Web.HttpContext.Current.Response.Write("ValidateAddressUSPS: " & ex.Message)
Line 957: ' End Try
Line 958: ' End If
Line 959: 'End Function
Line 960: Public Function InitialCaps(ByVal sValue As String) As String
Line 961: Dim sTemp As String = ""
Line 962: Dim iPos As Integer = 1
Line 963: Do While InStr(iPos, sValue, " ", 1) <> 0
Line 964: Dim iSpace As Integer = InStr(iPos, sValue, " ", 1)
Line 965: sTemp = sTemp & UCase(Mid(sValue, iPos, 1))
Line 966: sTemp = sTemp & LCase(Mid(sValue, iPos + 1, iSpace - iPos))
Line 967: iPos = iSpace + 1
Line 968: Loop
Line 969:
Line 970: sTemp = sTemp & UCase(Mid(sValue, iPos, 1))
Line 971: sTemp = sTemp & LCase(Mid(sValue, iPos + 1))
Line 972:
Line 973: InitialCaps = sTemp
Line 974:
Line 975: End Function
Line 976:
Line 977: Public Function GetNumericOnly(ByVal Input As String) As String
Line 978: Input.Trim()
Line 979: Dim newstr As String = ""
Line 980: For Each c As Char In Input.ToCharArray()
Line 981: If c = "1" Or c = "2" Or c = "3" Or c = "4" Or c = "5" Or c = "6" Or c = "7" Or c = "8" Or c = "9" Or c = "0" Then
Line 982: newstr = newstr + c
Line 983: End If
Line 984: Next
Line 985: GetNumericOnly = newstr
Line 986: End Function
Line 987: Public Function GetPrimaryCustomerInfo(ByVal MasterID As String) As CustomerInfo
Line 988: GetPrimaryCustomerInfo.Address1 = ""
Line 989: GetPrimaryCustomerInfo.Address2 = ""
Line 990: GetPrimaryCustomerInfo.Address3 = ""
Line 991: GetPrimaryCustomerInfo.Address4 = ""
Line 992: GetPrimaryCustomerInfo.JobTitle = ""
Line 993: GetPrimaryCustomerInfo.City = ""
Line 994: GetPrimaryCustomerInfo.Company = ""
Line 995: GetPrimaryCustomerInfo.CountryCode = ""
Line 996: GetPrimaryCustomerInfo.CountryDesc = ""
Line 997: GetPrimaryCustomerInfo.Email = ""
Line 998: GetPrimaryCustomerInfo.Fax = ""
Line 999: GetPrimaryCustomerInfo.FirstName = ""
Line 1000: GetPrimaryCustomerInfo.LastName = ""
Line 1001: GetPrimaryCustomerInfo.Phone = ""
Line 1002: GetPrimaryCustomerInfo.Postal = ""
Line 1003: GetPrimaryCustomerInfo.State = ""
Line 1004: GetPrimaryCustomerInfo.Cus_Address_ID = ""
Line 1005: GetPrimaryCustomerInfo.URL = ""
Line 1006: GetPrimaryCustomerInfo.Name_Prefix = ""
Line 1007: GetPrimaryCustomerInfo.Name_Suffix = ""
Line 1008: GetPrimaryCustomerInfo.Middle_Name = ""
Line 1009: GetPrimaryCustomerInfo.AddressTypeCode = ""
Line 1010: GetPrimaryCustomerInfo.Customer_label_name = ""
Line 1011: GetPrimaryCustomerInfo.formatted_address = ""
Line 1012: GetPrimaryCustomerInfo.customer_class_code = ""
Line 1013:
Line 1014:
Line 1015: If Len(MasterID) >= 4 Then
Line 1016: Try
Line 1017:
Line 1018: Dim myqueryAccountShippingInfo As String = "SELECT Id, OrderApi__Account_Email__c, Fax, Name, Phone, FS_Active_Membership__c, FS_Company_Class_Code__c, FS_Contact_Name__c, FS_Customer_Status_Code__c, FS_Primary_Business_Type__c, ShippingCity, ShippingCountry, ShippingCountryCode, ShippingState, ShippingStateCode, ShippingStreet, ShippingPostalCode,ShippingAddress FROM Account WHERE Id = '" & Trim(MasterID) & "'"
Line 1019: Dim AccountShippingInfo As DataTable = SalesForceHelper.strQuerySalesforce(myqueryAccountShippingInfo)
Line 1020:
Line 1021: 'Dim Mkeywords = New Dictionary(Of String, String) From {{"MasterId", Trim(MasterID)}}
Line 1022: 'Dim dt As DataTable
Line 1023: 'dt = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_GET_ODATA_GetPrimaryCustomerInfo", Mkeywords)
Line 1024: 'country_descr, USR_Spanish_Descr, Phone_Country_Code
Line 1025: For Each row As DataRow In AccountShippingInfo.Rows
Line 1026: If Not IsDBNull(row("first_name")) Then
Line 1027: GetPrimaryCustomerInfo.FirstName = "" 'row("first_name").ToString.Trim
Line 1028: End If
Line 1029: If Not IsDBNull(row("last_name")) Then
Line 1030: GetPrimaryCustomerInfo.LastName = "" 'row("last_name").ToString.Trim
Line 1031: End If
Line 1032: If Not IsDBNull(row("Name")) Then
Line 1033: GetPrimaryCustomerInfo.Company = row("Name").ToString.Trim
Line 1034: End If
Line 1035: If Not IsDBNull(row("ShippingStreet")) Then
Line 1036: GetPrimaryCustomerInfo.Address1 = row("ShippingStreet").ToString.Trim
Line 1037: End If
Line 1038: 'If Not IsDBNull(row("address_2")) Then
Line 1039: 'GetPrimaryCustomerInfo.Address2 = row("address_2").ToString.Trim
Line 1040: 'End If
Line 1041: If Not IsDBNull(row("ShippingCity")) Then
Line 1042: GetPrimaryCustomerInfo.City = row("ShippingCity").ToString.Trim
Line 1043: End If
Line 1044: If Not IsDBNull(row("ShippingState")) Then
Line 1045: GetPrimaryCustomerInfo.State = row("ShippingState").ToString.Trim
Line 1046: End If
Line 1047: If Not IsDBNull(row("ShippingPostalCode")) Then
Line 1048: GetPrimaryCustomerInfo.Postal = row("ShippingPostalCode").ToString.Trim
Line 1049: End If
Line 1050: If Not IsDBNull(row("ShippingCountryCode")) Then
Line 1051: GetPrimaryCustomerInfo.CountryCode = row("ShippingCountryCode").ToString.Trim
Line 1052: End If
Line 1053: If Not IsDBNull(row("ShippingCountry")) Then
Line 1054: GetPrimaryCustomerInfo.CountryDesc = row("ShippingCountry").ToString.Trim
Line 1055: End If
Line 1056: If Not IsDBNull(row("Phone")) Then
Line 1057: GetPrimaryCustomerInfo.Phone = row("Phone").ToString.Trim
Line 1058: End If
Line 1059: If Not IsDBNull(row("Fax")) Then
Line 1060: GetPrimaryCustomerInfo.Fax = row("Fax").ToString.Trim
Line 1061: End If
Line 1062: If Not IsDBNull(row("OrderApiAccountEmailc")) Then
Line 1063: GetPrimaryCustomerInfo.Email = row("OrderApiAccountEmailc").ToString.Trim
Line 1064: End If
Line 1065: If Not IsDBNull(row("cus_address_id")) Then
Line 1066: GetPrimaryCustomerInfo.Cus_Address_ID = "" 'row("cus_address_id").ToString.Trim
Line 1067: End If
Line 1068: If Not IsDBNull(row("primary_job_title")) Then
Line 1069: GetPrimaryCustomerInfo.JobTitle = "" 'row("primary_job_title").ToString.Trim
Line 1070: End If
Line 1071: If Not IsDBNull(row("primary_URL")) Then
Line 1072: GetPrimaryCustomerInfo.URL = row("primary_URL").ToString.Trim
Line 1073: End If
Line 1074: If Not IsDBNull(row("name_prefix")) Then
Line 1075: GetPrimaryCustomerInfo.Name_Prefix = "" 'row("name_prefix").ToString.Trim
Line 1076: End If
Line 1077: If Not IsDBNull(row("Name_suffix")) Then
Line 1078: GetPrimaryCustomerInfo.Name_Suffix = "" 'row("Name_suffix").ToString.Trim
Line 1079: End If
Line 1080: If Not IsDBNull(row("middle_name")) Then
Line 1081: GetPrimaryCustomerInfo.Middle_Name = "" 'row("middle_name").ToString.Trim
Line 1082: End If
Line 1083: If Not IsDBNull(row("address_type_code")) Then
Line 1084: GetPrimaryCustomerInfo.AddressTypeCode = "Shipping" 'row("address_type_code").ToString.Trim
Line 1085: End If
Line 1086: If Not IsDBNull(row("CUSTOMER_LABEL_NAME")) Then
Line 1087: GetPrimaryCustomerInfo.Customer_label_name = row("CUSTOMER_LABEL_NAME").ToString.Trim
Line 1088: End If
Line 1089: 'btw 2/14/2023
Line 1090: If Not IsDBNull(row("ShippingAddress")) Then
Line 1091: GetPrimaryCustomerInfo.formatted_address = "" 'row("ShippingAddress").ToString.Trim
Line 1092: End If
Line 1093: GetPrimaryCustomerInfo.customer_class_code = row("FSCompanyClassCodec").ToString.Trim
Line 1094: Next
Line 1095:
Line 1096: Catch ex As Exception
Line 1097: System.Web.HttpContext.Current.Response.Write("GetPrimaryCustomerInfo: " & ex.Message)
Line 1098: End Try
Line 1099: End If
Line 1100:
Line 1101: End Function
Line 1102: Public Function GetCompanyInfo(ByVal MasterID As String) As CustomerInfo
Line 1103: GetCompanyInfo.Address1 = ""
Line 1104: GetCompanyInfo.Address2 = ""
Line 1105: GetCompanyInfo.Address3 = ""
Line 1106: GetCompanyInfo.Address4 = ""
Line 1107: GetCompanyInfo.JobTitle = ""
Line 1108: GetCompanyInfo.City = ""
Line 1109: GetCompanyInfo.Company = ""
Line 1110: GetCompanyInfo.CountryDesc = ""
Line 1111: GetCompanyInfo.Email = ""
Line 1112: GetCompanyInfo.Fax = ""
Line 1113: GetCompanyInfo.FirstName = ""
Line 1114: GetCompanyInfo.LastName = ""
Line 1115: GetCompanyInfo.Phone = ""
Line 1116: GetCompanyInfo.Postal = ""
Line 1117: GetCompanyInfo.State = ""
Line 1118: GetCompanyInfo.Cus_Address_ID = ""
Line 1119: GetCompanyInfo.URL = ""
Line 1120: GetCompanyInfo.Name_Prefix = ""
Line 1121: GetCompanyInfo.Name_Suffix = ""
Line 1122: GetCompanyInfo.Middle_Name = ""
Line 1123: GetCompanyInfo.AddressTypeCode = ""
Line 1124: GetCompanyInfo.Customer_label_name = ""
Line 1125: GetCompanyInfo.formatted_address = ""
Line 1126: GetCompanyInfo.customer_class_code = ""
Line 1127:
Line 1128:
Line 1129: If Len(MasterID) >= 4 Then
Line 1130: Try
Line 1131:
Line 1132: Dim myqueryAccountShippingInfo As String = "SELECT Id,Website, OrderApi__Account_Email__c, Fax, Name, Phone, FS_Active_Membership__c, FS_Company_Class_Code__c, FS_Contact_Name__c, FS_Customer_Status_Code__c, FS_Primary_Business_Type__c, ShippingCity, ShippingCountry, ShippingState, ShippingStreet, ShippingPostalCode,ShippingAddress FROM Account WHERE Id = '" & Trim(MasterID) & "'"
Line 1133: Dim AccountShippingInfo As DataTable = SalesForceHelper.strQuerySalesforce(myqueryAccountShippingInfo)
Line 1134:
Line 1135: 'Dim Mkeywords = New Dictionary(Of String, String) From {{"MasterId", Trim(MasterID)}}
Line 1136: 'Dim dt As DataTable
Line 1137: 'dt = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_GET_ODATA_GetPrimaryCustomerInfo", Mkeywords)
Line 1138:
Line 1139: For Each row As DataRow In AccountShippingInfo.Rows
Line 1140:
Line 1141: If Not IsDBNull(row("Name")) Then
Line 1142: GetCompanyInfo.Company = row("Name").ToString.Trim
Line 1143: End If
Line 1144: If Not IsDBNull(row("ShippingStreet")) Then
Line 1145: GetCompanyInfo.Address1 = row("ShippingStreet").ToString.Trim
Line 1146: End If
Line 1147: If Not IsDBNull(row("ShippingCity")) Then
Line 1148: GetCompanyInfo.City = row("ShippingCity").ToString.Trim
Line 1149: End If
Line 1150: If Not IsDBNull(row("ShippingState")) Then
Line 1151: GetCompanyInfo.State = row("ShippingState").ToString.Trim
Line 1152: End If
Line 1153: If Not IsDBNull(row("ShippingPostalCode")) Then
Line 1154: GetCompanyInfo.Postal = row("ShippingPostalCode").ToString.Trim
Line 1155: End If
Line 1156: 'If Not IsDBNull(row("ShippingCountryCode")) Then
Line 1157: ' GetCompanyInfo.CountryCode = row("ShippingCountryCode").ToString.Trim
Line 1158: 'End If
Line 1159: If Not IsDBNull(row("ShippingCountry")) Then
Line 1160: GetCompanyInfo.CountryDesc = row("ShippingCountry").ToString.Trim
Line 1161: End If
Line 1162: If Not IsDBNull(row("Phone")) Then
Line 1163: GetCompanyInfo.Phone = row("Phone").ToString.Trim
Line 1164: End If
Line 1165: If Not IsDBNull(row("Fax")) Then
Line 1166: GetCompanyInfo.Fax = row("Fax").ToString.Trim
Line 1167: End If
Line 1168: If Not IsDBNull(row("OrderApiAccountEmailc")) Then
Line 1169: GetCompanyInfo.Email = row("OrderApiAccountEmailc").ToString.Trim
Line 1170: End If
Line 1171:
Line 1172:
Line 1173: If Not IsDBNull(row("Website")) Then
Line 1174: GetCompanyInfo.URL = row("Website").ToString.Trim
Line 1175: End If
Line 1176:
Line 1177:
Line 1178: If Not IsDBNull(row("Name")) Then
Line 1179: GetCompanyInfo.Customer_label_name = row("Name").ToString.Trim
Line 1180: End If
Line 1181: If Not IsDBNull(row("ShippingAddress")) Then
Line 1182: GetCompanyInfo.formatted_address = ""
Line 1183: Else
Line 1184: GetCompanyInfo.formatted_address = row("ShippingAddress").ToString.Trim
Line 1185: End If
Line 1186: GetCompanyInfo.customer_class_code = row("FSCompanyClassCodec").ToString.Trim
Line 1187: GetCompanyInfo.BusType = row("FSPrimaryBusinessTypec").ToString.Trim
Line 1188: Next
Line 1189:
Line 1190: Catch ex As Exception
Line 1191: System.Web.HttpContext.Current.Response.Write("GetCompanyInfo: " & ex.Message)
Line 1192: End Try
Line 1193: End If
Line 1194:
Line 1195: End Function
Line 1196: Public Function RemoveInvalidXmlChars(ByVal text As String) As String
Line 1197: If (text Is Nothing) Then
Line 1198: Return text
Line 1199: End If
Line 1200:
Line 1201: If (text.Length = 0) Then
Line 1202: Return text
Line 1203: End If
Line 1204:
Line 1205: ' a bit complicated, but avoids memory usage if not necessary
Line 1206: Dim result As StringBuilder = Nothing
Line 1207: Dim i As Integer = 0
Line 1208: Do While (i < text.Length)
Line 1209: Dim ch = text(i)
Line 1210: If XmlConvert.IsXmlChar(ch) Then
Line 1211: result.Append(ch)
Line 1212: ElseIf (result Is Nothing) Then
Line 1213: result = New StringBuilder
Line 1214: result.Append(text.Substring(0, i))
Line 1215: End If
Line 1216:
Line 1217: i = (i + 1)
Line 1218: Loop
Line 1219:
Line 1220: If (result Is Nothing) Then
Line 1221: Return text
Line 1222: End If
Line 1223:
Line 1224: ' no invalid xml chars detected - return original text
Line 1225: Dim regex As Regex = New Regex("[^\w\.\,!""$%^&*\(\)-_+=::@']")
Line 1226:
Line 1227: ' Replace the matched text in the InputText using the replacement pattern
Line 1228: Dim result2 As String = regex.Replace(result.ToString.Trim(), "")
Line 1229: Return result2.ToString
Line 1230: End Function
Line 1231:
Line 1232: Public Function RemoveDiacritics(ByVal s As String) As String
Line 1233: Dim normalizedString As String
Line 1234: Dim stringBuilder As New StringBuilder
Line 1235: normalizedString = s.Normalize(NormalizationForm.FormD)
Line 1236: Dim i As Integer
Line 1237: Dim c As Char
Line 1238: If normalizedString.Length - 1 < 0 Then
Line 1239: Return ""
Line 1240: Else
Line 1241: For i = 0 To normalizedString.Length - 1
Line 1242: c = normalizedString(i)
Line 1243: If CharUnicodeInfo.GetUnicodeCategory(c) <> UnicodeCategory.NonSpacingMark Then
Line 1244: stringBuilder.Append(c)
Line 1245: End If
Line 1246: Next
Line 1247: Return stringBuilder.ToString()
Line 1248: End If
Line 1249:
Line 1250: End Function
Line 1251: Public Function GetUserIPAddress() As String
Line 1252: GetUserIPAddress = ""
Line 1253: Dim ip As String = System.Web.HttpContext.Current.Request.ServerVariables("HTTP_X_FORWARDED_FOR")
Line 1254: If Not String.IsNullOrEmpty(ip) Then
Line 1255: Dim ipRange As String() = ip.Split(","c)
Line 1256: Dim le As Integer = ipRange.Length - 1
Line 1257: Dim trueIP As String = ipRange(le)
Line 1258: Else
Line 1259: ip = System.Web.HttpContext.Current.Request.ServerVariables("REMOTE_ADDR")
Line 1260: End If
Line 1261: GetUserIPAddress = ip
Line 1262: End Function
Line 1263: 'Public Function CheckForCapacityOk(ByVal product_id As String) As Boolean
Line 1264: ' CheckForCapacityOk = False
Line 1265: ' 'Response.Write("CheckForCapacityOk=" & product_id)
Line 1266: ' Try
Line 1267: ' 'Dim Mkeywords = New Dictionary(Of String, String) From {{"product_id", product_id}, {"Database", Database}}
Line 1268: ' 'Dim dt As DataTable
Line 1269: ' 'dt = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_Estore_Class_Check_Capacity_ok_sp", Mkeywords)
Line 1270:
Line 1271: ' Dim myqueryCapacity As String = "SELECT Id, OrderApi__Description__c, EventApi__Event__c, OrderApi__Is_Active__c, EventApi__Event__r.EventApi__Capacity__c, EventApi__Event__r.EventApi__Quantity_Remaining__c, EventApi__Event__r.EventApi__Quantity_Sold__c, EventApi__Event__r.EventApi__Total_Event_Capacity__c FROM OrderApi__Item__c WHERE Id = '" & ProductIDRETAIL & "'"
Line 1272: ' Dim myqueryCapacitydt As DataTable = SalesForceHelper.strQuerySalesforce(myqueryCapacity)
Line 1273:
Line 1274: ' For Each row As DataRow In myqueryCapacitydt.Rows
Line 1275: ' CheckForCapacityOk = True 'default true
Line 1276: ' If row("OrderApiIsActivec") = False Then
Line 1277: ' CheckForCapacityOk = False
Line 1278: ' End If
Line 1279: ' If Val(row("EventApiQuantityRemainingc")) < 1 Then
Line 1280: ' CheckForCapacityOk = False
Line 1281: ' End If
Line 1282: ' Next
Line 1283:
Line 1284: ' Catch ex As Exception
Line 1285: ' System.Web.HttpContext.Current.Response.Write("CheckForCapacityOk:" & ex.Message)
Line 1286:
Line 1287: ' End Try
Line 1288:
Line 1289: 'End Function
Line 1290: Public Function BadgeDelete(ByVal BadgeSeq As String) As Boolean
Line 1291: BadgeDelete = False
Line 1292:
Line 1293: Try
Line 1294: 'btw 5/23/2021 need to add routine here
Line 1295: 'email member service and request badge delete.
Line 1296:
Line 1297: 'Dim Mkeywords = New Dictionary(Of String, String) From {{"Orderno", OrderNo}, {"OrderLineNo", OrderLineNo}, {"BadgeSeq", BadgeSeq}}
Line 1298: 'Dim dt As DataTable
Line 1299: 'dt = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_Pass_Class_Badge_Delete_sp", Mkeywords)
Line 1300:
Line 1301: 'For Each row As DataRow In dt.Rows
Line 1302: ' BadgeDelete = True
Line 1303: 'Next
Line 1304:
Line 1305: Catch ex As Exception
Line 1306: System.Web.HttpContext.Current.Response.Write("BadgeDelete" & ex.Message)
Line 1307: End Try
Line 1308:
Line 1309: End Function
Line 1310: 'btw 05/11/2015
Line 1311: Public Function BadgePendingDelete(ByVal BadgeSeq As String) As Boolean
Line 1312: BadgePendingDelete = False
Line 1313: 'btw 5/23/2021 need to add routine here
Line 1314:
Line 1315: Try
Line 1316: 'Dim Mkeywords = New Dictionary(Of String, String) From {{"Orderno", OrderNo}, {"OrderLineNo", OrderLineNo}, {"BadgeSeq", BadgeSeq}, {"PersonifyDatabaseName", Left(PersonifyDatabaseName, 5).ToUpper()}}
Line 1317: 'Dim dt As DataTable
Line 1318: 'dt = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_Pass_Class_BadgePendingDelete_Status_sp", Mkeywords)
Line 1319:
Line 1320: 'For Each row As DataRow In dt.Rows
Line 1321: ' BadgePendingDelete = True
Line 1322: 'Next
Line 1323:
Line 1324: Catch ex As Exception
Line 1325: System.Web.HttpContext.Current.Response.Write("BadgePendingDelete" & ex.Message)
Line 1326: End Try
Line 1327:
Line 1328: End Function
Line 1329:
Line 1330: Public Function BadgePendingChange(ByVal BadgeSeq As String) As Boolean
Line 1331: BadgePendingChange = False
Line 1332: 'btw 5/23/2021 need to add routine here
Line 1333: Try
Line 1334: 'Dim Mkeywords = New Dictionary(Of String, String) From {{"Orderno", OrderNo}, {"OrderLineNo", OrderLineNo}, {"BadgeSeq", BadgeSeq}, {"PersonifyDatabaseName", Left(PersonifyDatabaseName, 5).ToUpper()}}
Line 1335: 'Dim dt As DataTable
Line 1336: 'dt = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_Pass_Class_Get_Badge_Pending_Changes_sp", Mkeywords)
Line 1337:
Line 1338: 'For Each row As DataRow In dt.Rows
Line 1339: ' BadgePendingChange = True
Line 1340: 'Next
Line 1341: Catch ex As Exception
Line 1342: System.Web.HttpContext.Current.Response.Write("BadgePendingChange" & ex.Message)
Line 1343: End Try
Line 1344:
Line 1345: End Function
Line 1346:
Line 1347:
Line 1348: Public Function GetBoothWorkerInfo(ByVal BadgeSeq As String, ByVal BoothName As String) As BoothWorkerInfo
Line 1349: GetBoothWorkerInfo.Address1 = ""
Line 1350: GetBoothWorkerInfo.Address2 = ""
Line 1351: GetBoothWorkerInfo.BadgeType = ""
Line 1352: 'GetBoothWorkerInfo.Booth_no = ""
Line 1353: GetBoothWorkerInfo.BusType = ""
Line 1354: GetBoothWorkerInfo.City = ""
Line 1355: GetBoothWorkerInfo.Company = ""
Line 1356: GetBoothWorkerInfo.CountryCode = ""
Line 1357: GetBoothWorkerInfo.CountryDescr = ""
Line 1358: GetBoothWorkerInfo.Email = ""
Line 1359: GetBoothWorkerInfo.Employeeid = ""
Line 1360: GetBoothWorkerInfo.EmployeeAddressid = ""
Line 1361: GetBoothWorkerInfo.Fax = ""
Line 1362: GetBoothWorkerInfo.FirstName = ""
Line 1363: GetBoothWorkerInfo.AliasFirstName = ""
Line 1364: GetBoothWorkerInfo.JobTitle = ""
Line 1365: GetBoothWorkerInfo.LastName = ""
Line 1366: GetBoothWorkerInfo.Master_Customer_ID = ""
Line 1367: GetBoothWorkerInfo.Master_Customer_Address_ID = 0
Line 1368: GetBoothWorkerInfo.Phone = ""
Line 1369: GetBoothWorkerInfo.Postal = ""
Line 1370: GetBoothWorkerInfo.State = ""
Line 1371: GetBoothWorkerInfo.USR_BADGE_SEQ = ""
Line 1372: GetBoothWorkerInfo.USR_FIRST_TIME = ""
Line 1373: GetBoothWorkerInfo.USR_Mail_Badge_Flag = ""
Line 1374: GetBoothWorkerInfo.USR_ORDER_LINE_NUMBER = ""
Line 1375: GetBoothWorkerInfo.USR_ORDERNO = ""
Line 1376: GetBoothWorkerInfo.USR_BADGE_REGLIST_FLAG = ""
Line 1377: GetBoothWorkerInfo.USR_BADGE_EMAIL_REGLIST_FLAG = ""
Line 1378:
Line 1379: Try
Line 1380: 'Dim Mkeywords = New Dictionary(Of String, String) From {{"OrderNo", OrderNo}, {"OrderLineNo", OrderLineNo}, {"badge_seq", BadgeSeq}}
Line 1381: 'Dim dt As DataTable
Line 1382: 'dt = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_WebApi_FoodService_GetBadgeCustomerInfo_sp", Mkeywords)
Line 1383: ' ?????? Session("FSEventc")
Line 1384: Dim myqueryBoothWorkers As String = "SELECT Id, EventApi__Account__c, FS_Account_Name__c, EventApi__Contact__c, FS_Display_in_Directory__c, EventApi__Preferred_Email__c, EventApi__Attendee_Event__c, Exhibitor_Booth__r.Id, Exhibitor_Credits_Used__c, EventApi__First_Name__c, EventApi__Is_Invitation_Accepted__c, EventApi__Is_Invitation_Declined__c, EventApi__Is_Invitation_Not_Sent__c, EventApi__Is_Invitation_Sent__c, EventApi__Last_Invitation_Email_Sent__c, EventApi__Last_Name__c, FS_Mail_Badge__c, FS_Print_Date__c, EventApi__Is_Registered__c, EventApi__Registration_Date__c, EventApi__Send_Invitation_Email__c, EventApi__Send_Notification__c, EventApi__Status__c, EventApi__Ticket_Type__c, EventApi__Contact__r.FS_Is_Member__c, EventApi__Contact__r.MailingCity, EventApi__Contact__r.MailingCountry, EventApi__Contact__r.MailingCountryCode, EventApi__Contact__r.MailingState, EventApi__Contact__r.MailingStateCode, EventApi__Contact__r.MailingStreet, EventApi__Contact__r.MailingPostalCode, EventApi__Contact__r.OrderApi__Preferred_Phone__c,PMA_Badge_Category__c,LastModifiedById FROM EventApi__Attendee__c WHERE EventApi__Attendee_Event__c = '" & EventId & "' AND EventApi__Ticket_Type__c = '" & TicketTypeBoothworkerID & "' and Exhibitor_Booth__r.Id ='" & BoothName & "'"
Line 1385: Dim BoothWorkers As DataTable = SalesForceHelper.strQuerySalesforce(myqueryBoothWorkers)
Line 1386:
Line 1387: 'MailingCity, MailingCountry,
Line 1388: 'MailingCountryCode, MailingState, MailingStateCode,
Line 1389: 'MailingStreet, MailingPostalCode
Line 1390: 'OrderApi__Preferred_Phone__c,PMA_Badge_Category__c
Line 1391: For Each row As DataRow In BoothWorkers.Rows
Line 1392: GetBoothWorkerInfo.Address1 = row("MailingStreet").ToString.Trim
Line 1393: GetBoothWorkerInfo.Address2 = "" 'row("USR_ADDRESS2").ToString.Trim
Line 1394: GetBoothWorkerInfo.BadgeType = row("EventApiTicketTypec").ToString.Trim
Line 1395: GetBoothWorkerInfo.BusType = row("PMABadgeCategoryc").ToString.Trim
Line 1396: GetBoothWorkerInfo.City = row("MailingCity").ToString.Trim
Line 1397: GetBoothWorkerInfo.Company = row("FSAccountNamec").ToString.Trim
Line 1398:
Line 1399: GetBoothWorkerInfo.CountryDescr = row("MailingCountry").ToString.Trim
Line 1400: GetBoothWorkerInfo.CountryCode = row("MailingCountryCode").ToString.Trim
Line 1401: GetBoothWorkerInfo.Email = row("EventApiPreferredEmailc").ToString.Trim
Line 1402: GetBoothWorkerInfo.Employeeid = row("EventApiContactc").ToString.Trim
Line 1403: GetBoothWorkerInfo.EmployeeAddressid = "" 'row("USR_EMPLOYEE_ADDRESS_ID").ToString.Trim
Line 1404: GetBoothWorkerInfo.Fax = "" ' row("USR_FAX").ToString.Trim
Line 1405: GetBoothWorkerInfo.FirstName = row("USR_REAL_FIRST_NAME").ToString.Trim
Line 1406: GetBoothWorkerInfo.AliasFirstName = row("first_name").ToString.Trim
Line 1407: GetBoothWorkerInfo.JobTitle = row("USR_JOB_TITLE").ToString.Trim
Line 1408: GetBoothWorkerInfo.LastName = row("FULL_NAME").ToString.Trim
Line 1409: GetBoothWorkerInfo.Master_Customer_ID = row("USR_COMPANYID").ToString.Trim
Line 1410: GetBoothWorkerInfo.Phone = row("OrderApiPreferredPhonec").ToString.Trim
Line 1411: GetBoothWorkerInfo.Postal = row("MailingPostalCode").ToString.Trim
Line 1412: GetBoothWorkerInfo.State = row("MailingState").ToString.Trim
Line 1413: GetBoothWorkerInfo.USR_BADGE_SEQ = row("ID").ToString.Trim
Line 1414: GetBoothWorkerInfo.USR_FIRST_TIME = row("EventApiFirstNamec").ToString.Trim
Line 1415: GetBoothWorkerInfo.USR_Mail_Badge_Flag = row("FSMailBadgec").ToString.Trim
Line 1416: 'GetBoothWorkerInfo.USR_ORDER_LINE_NUMBER = row("ORDER_LINE_NO").ToString.Trim
Line 1417: GetBoothWorkerInfo.USR_ORDERNO = row("EventApiAccountc").ToString.Trim
Line 1418: GetBoothWorkerInfo.Master_Customer_ID = row("EventApiAccountc").ToString.Trim
Line 1419: GetBoothWorkerInfo.Master_Customer_Address_ID = "" 'row("USR_COMPANYADDRESSID").ToString.Trim
Line 1420: GetBoothWorkerInfo.USR_BADGE_REGLIST_FLAG = row("FSDisplayinDirectoryc").ToString.Trim
Line 1421: GetBoothWorkerInfo.USR_BADGE_EMAIL_REGLIST_FLAG = "" ' row("USR_BADGE_EMAIL_REGLIST_FLAG").ToString.Trim
Line 1422: Next
Line 1423:
Line 1424: Catch ex As Exception
Line 1425: System.Web.HttpContext.Current.Response.Write("GetBoothWorkerInfo: " & ex.Message)
Line 1426: System.Web.HttpContext.Current.Response.End()
Line 1427: End Try
Line 1428:
Line 1429: End Function
Line 1430: Public Function wasinvitepurchaseAdded(ByVal Salesorderline As String) As Boolean
Line 1431: Dim msqlPurchased As String = "SELECT "
Line 1432: msqlPurchased += " Sales_Order_LineId__c "
Line 1433: msqlPurchased += " From IFPA_Exhibitor_Booth_Credit_Transactions__c "
Line 1434: msqlPurchased += " Where Sales_Order_LineId__c = '" & Salesorderline & "' "
Line 1435: Dim Purchased As DataTable = SalesForceHelper.strQuerySalesforce2(msqlPurchased)
Line 1436: If Purchased.Rows.Count > 0 Then
Line 1437: wasinvitepurchaseAdded = True
Line 1438: Else
Line 1439: wasinvitepurchaseAdded = False
Line 1440: End If
Line 1441:
Line 1442: End Function
Line 1443: Public Function HasUsedCredits(ByVal AttendeeId As String) As Boolean
Line 1444: HasUsedCredits = False
Line 1445: Dim myqueryCreditsUsed = "SELECT sum(Credit_Used__c) credits FROM IFPA_Exhibitor_Booth_Credit_Transactions__c WHERE AttendeeId__c = '" & AttendeeId & "' Group by AttendeeId__c "
Line 1446: Dim Credit_Used As DataTable = SalesForceHelper.strQuerySalesforce2(myqueryCreditsUsed)
Line 1447:
Line 1448: If Credit_Used.Rows.Count > 0 Then
Line 1449: 'Found credit_Used records
Line 1450: For Each rowCredit As DataRow In Credit_Used.Rows
Line 1451: If Val(rowCredit("credits")) > 0 Then
Line 1452: HasUsedCredits = True
Line 1453: End If
Line 1454: Next
Line 1455: End If
Line 1456: End Function
Line 1457:
Line 1458: 'Public Function GetPaymentInfo(ByVal CCPREQANSID As String) As PaymentInfo
Line 1459: ' GetPaymentInfo.Amount = 0
Line 1460: ' GetPaymentInfo.CCName = ""
Line 1461: ' GetPaymentInfo.DatePaid = System.DateTime.Now
Line 1462: ' GetPaymentInfo.MaskedCCNumber = ""
Line 1463: ' GetPaymentInfo.PaymentType = ""
Line 1464: ' GetPaymentInfo.CCFirstChar = ""
Line 1465: ' Try
Line 1466: ' Dim MkeywordsReceipt = New Dictionary(Of String, String) From {{"CCPREQANSID", CCPREQANSID}, {"Database", Left(PersonifyDatabaseName, 5).ToUpper()}}
Line 1467: ' Dim dtReceipt As DataTable
Line 1468: ' dtReceipt = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_Estore_class_Get_Pay_Order_Receipt_using_ccp_req_ans_id_sp", MkeywordsReceipt)
Line 1469:
Line 1470: ' For Each row As DataRow In dtReceipt.Rows
Line 1471: ' If Not IsDBNull(row("Actual_Amount")) Then
Line 1472: ' GetPaymentInfo.Amount = row("Actual_Amount")
Line 1473: ' End If
Line 1474: ' If Not IsDBNull(row("cc_name")) Then
Line 1475: ' GetPaymentInfo.CCName = row("cc_name").ToString.Trim
Line 1476: ' End If
Line 1477: ' If Not IsDBNull(row("req_status_date")) Then
Line 1478: ' GetPaymentInfo.DatePaid = row("req_status_date")
Line 1479: ' End If
Line 1480: ' If Not IsDBNull(row("partial_cc_acct_no")) Then
Line 1481: ' GetPaymentInfo.MaskedCCNumber = row("partial_cc_acct_no").ToString.Trim
Line 1482: ' End If
Line 1483: ' If Not IsDBNull(row("cc_acct_no")) Then
Line 1484: ' If Left(row("cc_acct_no").ToString, 1) = "3" Then
Line 1485: ' GetPaymentInfo.PaymentType = "American Express"
Line 1486: ' ElseIf Left(row("cc_acct_no").ToString, 1) = "4" Then
Line 1487: ' GetPaymentInfo.PaymentType = "Visa"
Line 1488: ' ElseIf Left(row("cc_acct_no").ToString, 1) = "5" Or Left(row("cc_acct_no").ToString, 1) = "2" Then
Line 1489: ' GetPaymentInfo.PaymentType = "MasterCard"
Line 1490: ' End If
Line 1491: ' GetPaymentInfo.CCFirstChar = Left(row("cc_acct_no").ToString, 1)
Line 1492: ' End If
Line 1493: ' Next
Line 1494:
Line 1495:
Line 1496: ' Catch ex As Exception
Line 1497: ' System.Web.HttpContext.Current.Response.Write("GetPaymentInfo:" & ex.Message)
Line 1498: ' End Try
Line 1499:
Line 1500: 'End Function
Line 1501: 'Public Function EmailExists(ByVal memail As String) As Boolean
Line 1502: ' EmailExists = False
Line 1503: ' memail = Replace(Replace(Replace(Replace(Replace(memail, "'", ""), "[", ""), "]", ""), ";", ""), "|", "")
Line 1504: ' If memail > "" Then
Line 1505: ' Try
Line 1506:
Line 1507: ' Dim Mkeywords2 = New Dictionary(Of String, String) From {{"email", "badgecategory"}}
Line 1508: ' Dim dt2 As DataTable
Line 1509: ' dt2 = SvcClientTAUG.SQLExecuteStoredProcedure("USR_BTW_Pass_Class_EmailExists_In_CusCommunication_sp", Mkeywords2)
Line 1510: ' For Each row As DataRow In dt2.Rows
Line 1511: ' If Not String.IsNullOrEmpty(row("FORMATTED_PHONE_ADDRESS")) Then
Line 1512: ' EmailExists = True
Line 1513: ' End If
Line 1514: ' Next
Line 1515: ' Catch ex As Exception
Line 1516: ' System.Web.HttpContext.Current.Response.Write("EmailExists: " & ex.Message)
Line 1517: ' End Try
Line 1518: ' End If
Line 1519: 'End Function
Line 1520: Function IsValidEmail(ByVal email As String) As Boolean
Line 1521: Static emailRegex As New Regex("^[._a-z0-9-]+(.[a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$")
Line 1522: 'Static emailRegex As New Regex("^ ([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$")
Line 1523: Return emailRegex.IsMatch(email.ToLower())
Line 1524: End Function
Line 1525: Function IsEmailValid(ByVal email As String) As Boolean
Line 1526: IsEmailValid = False
Line 1527: Try
Line 1528: Dim xemail As MailAddress = New MailAddress(email)
Line 1529: IsEmailValid = True
Line 1530: Catch ex As Exception
Line 1531: IsEmailValid = False
Line 1532: End Try
Line 1533:
Line 1534: End Function
Line 1535: Public Shared Function DerializeDataTable(ByVal data As String) As DataTable
Line 1536: Dim json As String = data
Line 1537: Dim table = JsonConvert.DeserializeObject(Of DataTable)(json)
Line 1538: DerializeDataTable = table
Line 1539: End Function
Line 1540:
Line 1541: 'Public Shared Function RemoveInvalidXmlChars(ByVal content As String) As String
Line 1542: ' Return New String(content.Where(() >= {}, System.Xml.XmlConvert.IsXmlChar(ch)).ToArray)
Line 1543: 'End Function
Line 1544:
Line 1545: End Class
Line 1546:
Line 1547: Public Class AddValue
Line 1548: Private m_Display As String
Line 1549: Private m_Value As String
Line 1550: Public Sub New(ByVal Display As String, ByVal Value As String)
Line 1551: MyBase.New()
Line 1552: m_Display = Display
Line 1553: m_Value = Value
Line 1554: End Sub
Line 1555: Public ReadOnly Property Display As String
Line 1556: Get
Line 1557: Return m_Display
Line 1558: End Get
Line 1559: End Property
Line 1560: Public ReadOnly Property Value As String
Line 1561: Get
Line 1562: Return m_Value
Line 1563: End Get
Line 1564: End Property
Line 1565: End Class
Line 1566:
|