Line 1: Imports Microsoft.VisualBasic
Line 2: Imports System
Line 3: Imports System.IO
Line 4: Imports System.Text
Line 5: Imports System.Configuration
Line 6: Imports System.Collections
Line 7: Imports System.Web
Line 8: Imports System.Web.Security
Line 9: Imports System.Globalization
Line 10: Imports System.Data
Line 11: Imports System.Data.SqlClient
Line 12: Imports TMS.WebPlanner
Line 13:
Line 14: Partial Class _Default
Line 15: Inherits System.Web.UI.Page
Line 16:
Line 17: Private currWebPlanner As TMS.WebPlanner.WebPlanner
Line 18:
Line 19: Private iUID As Integer
Line 20: Private iRMT As Integer
Line 21: Private iRMT_UID As Integer
Line 22: Private RMTName As String
Line 23: Private iUSRfName As String
Line 24: Private iUSRlName As String
Line 25:
Line 26: Protected WithEvents PnlAppointmentList As Global.System.Web.UI.WebControls.Panel
Line 27: Protected WithEvents PnlIconBar As Global.System.Web.UI.WebControls.Panel
Line 28:
Line 29: Protected WithEvents LblLoginErr As Global.System.Web.UI.WebControls.Label
Line 30: Protected WithEvents LblWelcome As Global.System.Web.UI.WebControls.Label
Line 31: Protected WithEvents LblPanelAppointment As Global.System.Web.UI.WebControls.Label
Line 32: Protected WithEvents LblPnlAppointmentList As Global.System.Web.UI.WebControls.Label
Line 33: Protected WithEvents LblDebug As Global.System.Web.UI.WebControls.Label
Line 34: Protected WithEvents Lbl As Global.System.Web.UI.WebControls.Label
Line 35:
Line 36:
Line 37: Protected WithEvents TxtLogin As Global.System.Web.UI.WebControls.TextBox
Line 38: Protected WithEvents TxtPWD As Global.System.Web.UI.WebControls.TextBox
Line 39: Protected WithEvents TxtRMT As Global.System.Web.UI.WebControls.TextBox
Line 40: Protected WithEvents TxtDocWidth As Global.System.Web.UI.WebControls.TextBox
Line 41: Protected WithEvents TxtUID As Global.System.Web.UI.WebControls.TextBox
Line 42:
Line 43:
Line 44: Protected WithEvents TxtContactName As Global.System.Web.UI.WebControls.TextBox
Line 45: Protected WithEvents TxtContactEmail As Global.System.Web.UI.WebControls.TextBox
Line 46: Protected WithEvents TxtContactMessage As Global.System.Web.UI.WebControls.TextBox
Line 47: Protected WithEvents TxtFName As Global.System.Web.UI.WebControls.TextBox
Line 48: Protected WithEvents TxtLName As Global.System.Web.UI.WebControls.TextBox
Line 49: Protected WithEvents TxtHPhone As Global.System.Web.UI.WebControls.TextBox
Line 50: Protected WithEvents TxtMPhone As Global.System.Web.UI.WebControls.TextBox
Line 51: Protected WithEvents TxtEmail As Global.System.Web.UI.WebControls.TextBox
Line 52: Protected WithEvents TxtPassword As Global.System.Web.UI.WebControls.TextBox
Line 53: Protected WithEvents TxtDay As Global.System.Web.UI.WebControls.TextBox
Line 54:
Line 55: Protected WithEvents TxtProfileEmail As Global.System.Web.UI.WebControls.TextBox
Line 56: Protected WithEvents TxtProfilePassword As Global.System.Web.UI.WebControls.TextBox
Line 57: Protected WithEvents TxtProfileHPhone As Global.System.Web.UI.WebControls.TextBox
Line 58: Protected WithEvents TxtProfileMPhone As Global.System.Web.UI.WebControls.TextBox
Line 59:
Line 60: Protected WithEvents TxtAppointmentTitle As Global.System.Web.UI.WebControls.TextBox
Line 61: Protected WithEvents TxtAppointmentNotes As Global.System.Web.UI.WebControls.TextBox
Line 62: Protected WithEvents TxtEmailPassRequest As Global.System.Web.UI.WebControls.TextBox
Line 63: Protected WithEvents TxtSMSPassRequest As Global.System.Web.UI.WebControls.TextBox
Line 64:
Line 65: Protected WithEvents BtnLogin As Global.System.Web.UI.WebControls.Button
Line 66: Protected WithEvents BtnLogout As Global.System.Web.UI.WebControls.Button
Line 67:
Line 68: Protected WithEvents CbxTEnable As Global.System.Web.UI.WebControls.CheckBox
Line 69: Protected WithEvents CbxProfileTEnable As Global.System.Web.UI.WebControls.CheckBox
Line 70: Protected WithEvents CbxSendSMS As Global.System.Web.UI.WebControls.CheckBox
Line 71:
Line 72: Protected WithEvents RdoSlot As Global.System.Web.UI.WebControls.RadioButton
Line 73: Protected WithEvents RblLMTSelect As Global.System.Web.UI.WebControls.RadioButtonList
Line 74:
Line 75: Protected WithEvents LvAppointmentList As Global.System.Web.UI.WebControls.ListView
Line 76:
Line 77:
Line 78:
Line 79: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Line 80:
Line 81: 'Need: Coookie to retain User Details
Line 82:
Line 83: If Not Session("UID") = Nothing Then
Line 84: iUID = Session("UID")
Line 85: DrawAppointmentList(iUID)
Line 86: OpenUserPanels()
Line 87: Else
Line 88: CloseUserPanels()
Line 89: End If
Line 90:
Line 91: If TxtDocWidth.Text <> "" Then
Line 92: SetPageWidth()
Line 93: End If
Line 94:
Line 95: currWebPlanner = WebPlanner1
Line 96:
Line 97: Session("WebPlanner") = currWebPlanner
Line 98:
Line 99: If Not IsPostBack Then
Line 100: Dim dtWP As DateTime = GetDates(DayController1.Date)
Line 101: TxtDay.Value = dtWP.ToString("MMMM dd, yyyy 08:00:00")
Line 102:
Line 103: If Not Session("RMT") = Nothing Then
Line 104: iRMT = Session("RMT")
Line 105: setRMTDetails()
Line 106: Else
Line 107: iRMT = 3
Line 108: setRMTDetails()
Line 109: End If
Line 110:
Line 111: End If
Line 112:
Line 113: drawWeek()
Line 114:
Line 115: End Sub
Line 116:
Line 117: Private Sub BtnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnLogin.Click
Line 118:
Line 119: Dim sUID As String = TxtLogin.Text
Line 120: Dim sPWD As String = TxtPWD.Text
Line 121:
Line 122: Dim Login As Integer = 0
Line 123: Login = EventsDB.Login_New(sUID, sPWD)
Line 124:
Line 125: 'Dim sNameSyl As String = ""
Line 126:
Line 127: If Not IsDBNull(Login) Then
Line 128:
Line 129: If Login > 0 Then
Line 130:
Line 131: iUID = Login
Line 132: setUSRDetails(iUID)
Line 133:
Line 134: Dim eKey As String = Encryption64.Encrypt(iUID)
Line 135: TxtUID.Value = eKey
Line 136:
Line 137: LblWelcome.Text = "Welcome " & iUSRfName
Line 138: LblLoginErr.Text = ""
Line 139:
Line 140: If Not Session("RMT") Is Nothing Then
Line 141: If iRMT <> Session("RMT") Then
Line 142: EventsDB.SetRMTFilter(iRMT, iUID)
Line 143: End If
Line 144: Else
Line 145: If iRMT > 3 Then
Line 146: setRMTDetails()
Line 147: End If
Line 148:
Line 149: End If
Line 150:
Line 151: DrawAppointmentList(iUID)
Line 152: OpenUserPanels()
Line 153:
Line 154: Else
Line 155: LblLoginErr.Text = "Incorrect Login Attempt"
Line 156:
Line 157: End If
Line 158:
Line 159: Else
Line 160: LblLoginErr.Text = "Incorrect Login Attempt"
Line 161: End If
Line 162:
Line 163: End Sub
Line 164:
Line 165: Private Sub setUSRDetails(ByVal UID As Integer)
Line 166:
Line 167: Dim USRDetails As UserDetails = EventsDB.getUserDetails(UID)
Line 168:
Line 169: iUSRfName = USRDetails.UD_FirstName
Line 170: iUSRlName = USRDetails.UD_LastName
Line 171:
Line 172: Session("UID") = UID
Line 173:
Line 174: iRMT = CInt(USRDetails.UD_LastFilter)
Line 175:
Line 176: End Sub
Line 177: Private Sub setRMTDetails()
Line 178:
Line 179: iRMT_UID = EventsDB.getRMTDetails(iRMT)
Line 180: Dim RMTDetails As UserDetails = EventsDB.getUserDetails(iRMT_UID)
Line 181: RMTName = RMTDetails.UD_FirstName & " " & RMTDetails.UD_LastName
Line 182:
Line 183: TxtRMT.Text = (iRMT & ":" & RMTName).ToString
Line 184: RblLMTSelect.SelectedValue = iRMT
Line 185:
Line 186: Session("RMT") = iRMT
Line 187:
Line 188: End Sub
Line 189:
Line 190: Private Sub BtnLogout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnLogout.Click
Line 191:
Line 192: Logout()
Line 193:
Line 194: End Sub
Line 195:
Line 196: Private Sub Logout()
Line 197:
Line 198: CloseUserPanels()
Line 199: TxtLogin.Text = ""
Line 200: Session("UID") = Nothing
Line 201:
Line 202: 'Not sure this is needed here
Line 203: 'WebPlanner1.DataBind()
Line 204:
Line 205: End Sub
Line 206:
Line 207: Private Sub OpenUserPanels()
Line 208:
Line 209: BtnLogin.Visible = False
Line 210: BtnLogout.Visible = True
Line 211: LblPnlAppointmentList.Visible = True
Line 212: PnlAppointmentList.Visible = True
Line 213: PnlIconBar.Visible = True
Line 214:
Line 215: End Sub
Line 216:
Line 217: Private Sub CloseUserPanels()
Line 218:
Line 219: BtnLogin.Visible = True
Line 220: BtnLogout.Visible = False
Line 221: LblPnlAppointmentList.Visible = False
Line 222: PnlAppointmentList.Visible = False
Line 223: PnlIconBar.Visible = False
Line 224: LblWelcome.Text = ""
Line 225: TxtUID.Value = ""
Line 226:
Line 227:
Line 228: End Sub
Line 229:
Line 230: Private Sub BtnPrev_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnPrev.Click
Line 231:
Line 232: Dim dtToday As Date = Date.Today
Line 233:
Line 234: If DayController1.Date.AddDays(-1) >= dtToday Then
Line 235: DayController1.Date = DayController1.Date.AddDays(-7).ToShortDateString
Line 236: End If
Line 237:
Line 238: Dim dtWP As DateTime = DayController1.Date
Line 239: TxtDay.Value = dtWP.ToString("MMMM dd, yyyy 08:00:00")
Line 240:
Line 241: WebPlanner1.DataBind()
Line 242:
Line 243: End Sub
Line 244:
Line 245: Private Sub BtnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnNext.Click
Line 246:
Line 247: DayController1.Date = DayController1.Date.AddDays(7).ToShortDateString
Line 248:
Line 249: Dim dtWP As DateTime = DayController1.Date
Line 250: TxtDay.Value = dtWP.ToString("MMMM dd, yyyy 08:00:00")
Line 251:
Line 252: WebPlanner1.DataBind()
Line 253:
Line 254: End Sub
Line 255:
Line 256: Protected Sub BtnToday_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnToday.Click
Line 257:
Line 258: DayController1.Date = GetDates(Date.Today.ToShortDateString)
Line 259:
Line 260: Dim dtWP As DateTime = DayController1.Date
Line 261: TxtDay.Value = dtWP.ToString("MMMM dd, yyyy 08:00:00")
Line 262:
Line 263: WebPlanner1.DataBind()
Line 264:
Line 265: End Sub
Line 266:
Line 267:
Line 268: Protected Sub drawWeek()
Line 269:
Line 270: Dim stDate As Date = GetDates(DayController1.Date)
Line 271: DayController1.Date = stDate
Line 272:
Line 273: WebPlanner1.DataBind()
Line 274:
Line 275: End Sub
Line 276:
Line 277: Protected Sub DrawAppointmentList(ByVal UID As Integer)
Line 278:
Line 279: Dim sqlEventList As String
Line 280: sqlEventList = "SELECT Cal_EventID, Cal_EventTitle, TMS_EventStartTime, TMS_EventEndTime FROM Cal_Events WHERE Cal_EventUserID = " & Session("UID") & "AND TMS_EventStartTime > GetDate()-1 ORDER BY TMS_EventStartTime"
Line 281:
Line 282: Dim conn As SqlConnection = EventsDB.connNDCal()
Line 283: Dim cmdEventList As New SqlCommand(sqlEventList, conn)
Line 284:
Line 285: cmdEventList.Parameters.AddWithValue("@UID", UID)
Line 286:
Line 287: Dim dsAppointmentList As New DataSet
Line 288: Dim daAppointmentList As SqlDataAdapter
Line 289:
Line 290: conn.Open()
Line 291: daAppointmentList = New SqlDataAdapter(sqlEventList, conn)
Line 292: daAppointmentList.Fill(dsAppointmentList)
Line 293:
Line 294: conn.Close()
Line 295: conn.Dispose()
Line 296:
Line 297: LvAppointmentList.DataSource = dsAppointmentList
Line 298: LvAppointmentList.DataBind()
Line 299:
Line 300:
Line 301: End Sub
Line 302:
Line 303: Private Function GetDates(ByVal stDate As Date) As Date
Line 304:
Line 305: Dim offset As Double = 0
Line 306: Select Case stDate.DayOfWeek
Line 307: Case DayOfWeek.Monday : offset = 0
Line 308: Case DayOfWeek.Tuesday : offset = -1
Line 309: Case DayOfWeek.Wednesday : offset = -2
Line 310: Case DayOfWeek.Thursday : offset = -3
Line 311: Case DayOfWeek.Friday : offset = -4
Line 312: Case DayOfWeek.Saturday : offset = -5
Line 313: Case DayOfWeek.Sunday : offset = 1
Line 314: End Select
Line 315:
Line 316: stDate = DateAdd(DateInterval.Day, +offset, stDate)
Line 317: Return stDate
Line 318:
Line 319: End Function
Line 320:
Line 321: Protected Sub WebPlanner1_EventsRetrieved(ByVal sender As Object, ByVal e As TMS.WebPlanner.PlannerCollectionEventArgs) Handles WebPlanner1.EventsRetrieved
Line 322:
Line 323: Dim i As Integer
Line 324: Dim iID As Integer
Line 325:
Line 326: For i = 0 To e.Events.Count - 1
Line 327:
Line 328: Dim pItem As TMS.WebPlanner.PlannerEvent = e.Events(i)
Line 329:
Line 330: pItem.ReadOnly = True
Line 331: pItem.FixedPosition = True
Line 332: pItem.FixedTime = True
Line 333:
Line 334: If Not Session("UID") Is Nothing Then
Line 335:
Line 336: iID = Session("UID")
Line 337:
Line 338: If iID = pItem.OwnerID Then
Line 339: pItem.Caption.ForeColor = Drawing.Color.SeaGreen
Line 340: pItem.Caption.Text = pItem.Subject
Line 341: Else
Line 342: pItem.Caption.Text = "Reserved"
Line 343: End If
Line 344:
Line 345: Else
Line 346: pItem.Caption.Text = "Reserved"
Line 347:
Line 348: End If
Line 349:
Line 350: Next i
Line 351:
Line 352: End Sub
Line 353:
Line 354: Protected Sub RblLMTSelect_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RblLMTSelect.SelectedIndexChanged
Line 355:
Line 356: iRMT = RblLMTSelect.SelectedItem.Value
Line 357:
Line 358: If Session("UID") > 0 Then
Line 359: iUID = Session("UID")
Line 360: EventsDB.SetRMTFilter(iRMT, iUID)
Line 361: End If
Line 362:
Line 363: setRMTDetails()
Line 364:
Line 365: WebPlanner1.DataBind()
Line 366:
Line 367: End Sub
Line 368:
Line 369: Private Sub BtnDP1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnDP1.Click
Line 370:
Line 371: Dim dtThisWeek As Date = GetDates(Date.Today)
Line 372: Dim dtWeekSelect As Date
Line 373: Dim dtCalSelect As Date
Line 374:
Line 375: dtCalSelect = Date.ParseExact(TxtDP1.Text, "d", CultureInfo.InvariantCulture)
Line 376: dtWeekSelect = GetDates(dtCalSelect)
Line 377:
Line 378: If dtWeekSelect >= dtThisWeek Then
Line 379: DayController1.Date = dtWeekSelect
Line 380: End If
Line 381:
Line 382: Dim dtWP As DateTime = DayController1.Date
Line 383: TxtDay.Value = dtWP.ToString("MMMM dd, yyyy 08:00:00")
Line 384:
Line 385: WebPlanner1.DataBind()
Line 386:
Line 387: End Sub
Line 388:
Line 389: Private Sub BtnSubmit_Register_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSubmit_Register.Click
Line 390:
Line 391: If FormSubmit_Register() = True Then
Line 392: ClearForm_Register()
Line 393: End If
Line 394:
Line 395: End Sub
Line 396:
Line 397: Private Function FormSubmit_Register() As Boolean
Line 398:
Line 399: Dim Valid As Boolean = False
Line 400:
Line 401: Dim conn As SqlConnection = EventsDB.connNDCal
Line 402: Dim cmd As New SqlCommand
Line 403:
Line 404: cmd.CommandType = CommandType.StoredProcedure
Line 405: cmd.CommandText = "CreateProfile"
Line 406: cmd.Connection = conn
Line 407:
Line 408: Dim strFirstName As String = TxtFName.Text
Line 409: Dim strLastName As String = TxtLName.Text
Line 410: Dim strEmail As String = TxtEmail.Text.ToLower
Line 411: Dim strPassword As String = TxtPassword.Text
Line 412: Dim strHphone As String = TxtHPhone.Text
Line 413: Dim strMphone As String = TxtMPhone.Text
Line 414: Dim booTEnable As String = CbxTEnable.Checked
Line 415:
Line 416: With cmd.Parameters
Line 417:
Line 418: .AddWithValue("@FirstName", If(strFirstName = "", CObj(DBNull.Value), strFirstName))
Line 419: .AddWithValue("@LastName", If(strLastName = "", CObj(DBNull.Value), strLastName))
Line 420: .AddWithValue("@UserName", If(strEmail = "", CObj(DBNull.Value), strEmail))
Line 421: .AddWithValue("@Email", If(strEmail = "", CObj(DBNull.Value), strEmail))
Line 422: .AddWithValue("@Password", If(strPassword = "", CObj(DBNull.Value), strPassword))
Line 423: .AddWithValue("@HPhone", If(strHphone = "", CObj(DBNull.Value), strHphone))
Line 424: .AddWithValue("@MPhone", If(strMphone = "", CObj(DBNull.Value), strMphone))
Line 425: .AddWithValue("@Tenable", booTEnable)
Line 426:
Line 427: End With
Line 428:
Line 429: Try
Line 430:
Line 431: conn.Open()
Line 432: cmd.ExecuteNonQuery()
Line 433: Valid = True
Line 434:
Line 435: Catch ex As Exception
Line 436: LblDebug.Text = ex.Message
Line 437: End Try
Line 438:
Line 439: conn.Close()
Line 440: conn.Dispose()
Line 441:
Line 442: Return Valid
Line 443:
Line 444: End Function
Line 445:
Line 446: Private Sub ClearForm_Register()
Line 447:
Line 448: TxtFName.Text = ""
Line 449: TxtLName.Text = ""
Line 450: TxtEmail.Text = ""
Line 451: TxtHPhone.Text = ""
Line 452: TxtMPhone.Text = ""
Line 453: TxtPassword.Text = ""
Line 454:
Line 455: End Sub
Line 456:
Line 457: Protected Sub BtnSubmit_Contact_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSubmit_Contact.Click
Line 458:
Line 459: Dim msgTo As String = "scottlosoya@gmail.com"
Line 460: Dim msgSubject As String = "Contact Form Message"
Line 461:
Line 462: Dim msgName As String = TxtContactName.Text
Line 463: Dim msgFrom As String = TxtContactEmail.Text
Line 464: Dim msgMessage As String = TxtContactMessage.Text
Line 465:
Line 466: Dim msgRMT As String
Line 467:
Line 468: msgRMT = "From: " & msgName & vbCrLf _
Line 469: & "Reply: " & msgFrom & vbCrLf _
Line 470: & "Message :" & vbCrLf & vbCrLf _
Line 471: & msgMessage
Line 472:
Line 473: Alerts_Cal.SendEmail(msgTo, msgSubject, msgRMT, False)
Line 474:
Line 475: 'Dim Scott As String = "18172052302"
Line 476: 'Dim SMS As String = "New calendar contact message"
Line 477: 'Alerts_Cal.SendSMS(Scott, SMS)
Line 478:
Line 479: TxtContactName.Text = ""
Line 480: TxtContactEmail.Text = ""
Line 481: TxtContactMessage.Text = ""
Line 482:
Line 483: End Sub
Line 484:
Line 485: Private Sub BtnSubmit_Profile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSubmit_Profile.Click
Line 486:
Line 487: 'Dim sqlSave As String
Line 488:
Line 489: Dim uidChange As Boolean = False
Line 490:
Line 491: If TxtProfileEmail.Text <> "" Then
Line 492: uidChange = True
Line 493: End If
Line 494:
Line 495: 'If Not TxtProfilePassword.Text = Nothing Then
Line 496: 'sqlSave = "UPDATE [Cal_User] SET [Cal_User_EmailAddress]=LOWER(@Cal_User_EmailAddress), [Cal_User_UserName]=LOWER(@Cal_User_UserName), [Cal_User_HPhone]=@Cal_User_HPhone, [Cal_User_MPhone]=@Cal_User_MPhone, [Cal_User_Password]=@Cal_User_Password, [Cal_User_TEnable]=@Cal_User_TEnable Where [Cal_User_ID]=@Cal_User_ID"
Line 497: 'Else
Line 498: 'sqlSave = "UPDATE [Cal_User] SET [Cal_User_EmailAddress]=LOWER(@Cal_User_EmailAddress), [Cal_User_UserName]=LOWER(@Cal_User_UserName), [Cal_User_HPhone]=@Cal_User_HPhone, [Cal_User_MPhone]=@Cal_User_MPhone, [Cal_User_TEnable]=@Cal_User_TEnable Where [Cal_User_ID]=@Cal_User_ID"
Line 499: 'End If
Line 500:
Line 501: Dim conn As SqlConnection = EventsDB.connNDCal
Line 502: Dim cmd As New SqlCommand
Line 503:
Line 504: cmd.CommandType = CommandType.StoredProcedure
Line 505: cmd.CommandText = "UpdateProfile"
Line 506: cmd.Connection = conn
Line 507:
Line 508: Dim strEmail As String = TxtProfileEmail.Text
Line 509: Dim strPassword As String = TxtProfilePassword.Text
Line 510: Dim strHphone As String = TxtProfileHPhone.Text
Line 511: Dim strMphone As String = TxtProfileMPhone.Text
Line 512: Dim booTEnable As String = CbxProfileTEnable.Checked
Line 513:
Line 514: With cmd.Parameters
Line 515:
Line 516: .AddWithValue("@ID", Session("UID"))
Line 517: .AddWithValue("@Email", If(strEmail = "", CObj(DBNull.Value), strEmail))
Line 518: .AddWithValue("@Password", If(strPassword = "", CObj(DBNull.Value), strPassword))
Line 519: .AddWithValue("@Hphone", If(strHphone = "", CObj(DBNull.Value), strHphone))
Line 520: .AddWithValue("@Mphone", If(strMphone = "", CObj(DBNull.Value), strMphone))
Line 521: .AddWithValue("@Tenable", booTEnable)
Line 522:
Line 523: End With
Line 524:
Line 525: Try
Line 526:
Line 527: conn.Open()
Line 528: cmd.ExecuteNonQuery()
Line 529:
Line 530: Catch ex As Exception
Line 531: LblDebug.Text = ex.Message
Line 532: End Try
Line 533:
Line 534: conn.Close()
Line 535: conn.Dispose()
Line 536:
Line 537: If uidChange = True Then Logout()
Line 538:
Line 539:
Line 540: End Sub
Line 541:
Line 542: Protected Sub BtnSubmit_Passhelp_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSubmit_Passhelp.Click
Line 543:
Line 544: Dim pwdgen As String = RandomString(7)
Line 545: Dim email As String = TxtEmailPassRequest.Text
Line 546: Dim body As String
Line 547:
Line 548: EventsDB.SetTempPassword(email, pwdgen)
Line 549:
Line 550: body = "New temporary password: " & pwdgen
Line 551:
Line 552: Alerts_Cal.SendEmail(email, "New Password", body, False)
Line 553:
Line 554: If CbxSendSMS.Checked = True Then
Line 555:
Line 556: Dim mphone As String = TxtSMSPassRequest.Text
Line 557: Alerts_Cal.SendSMS(mphone, body)
Line 558:
Line 559: End If
Line 560:
Line 561: End Sub
Line 562:
Line 563: Private Sub BtnSubmit_Appointment_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSubmit_Appointment.Click
Line 564:
Line 565: If Not Session("RMT") Is Nothing Then
Line 566:
Line 567: iUID = CInt(Encryption64.Decrypt(TxtUID.Value))
Line 568:
Line 569: iRMT = Session("RMT")
Line 570: iRMT_UID = EventsDB.getRMTDetails(iRMT)
Line 571:
Line 572: Dim strStartTime As String = TxtVBDate.Text
Line 573: Dim provider As CultureInfo = CultureInfo.CurrentCulture
Line 574: Dim dtStartTime As DateTime = DateTime.ParseExact(strStartTime, "MM/dd/yyyy hh:mm:ss tt", provider)
Line 575:
Line 576: Dim sTitle As String = TxtAppointmentTitle.Text
Line 577: Dim sBody As String = TxtAppointmentNotes.Text
Line 578:
Line 579: Dim i As Integer
Line 580: Dim varLength As Integer
Line 581: Dim aryTS(5) As Integer
Line 582:
Line 583: aryTS(0) = 30
Line 584: aryTS(1) = 60
Line 585: aryTS(2) = 90
Line 586: aryTS(3) = 120
Line 587: aryTS(4) = 150
Line 588: aryTS(5) = 180
Line 589:
Line 590: Dim strSlot As String
Line 591: For i = 0 To 5
Line 592: strSlot = "rdoSlots_" & aryTS(i).ToString
Line 593: RdoSlot = Me.FindControl(strSlot)
Line 594:
Line 595: If RdoSlot.Checked = True Then
Line 596: varLength = aryTS(i)
Line 597: End If
Line 598: Next
Line 599:
Line 600:
Line 601: Dim dtEndTime As DateTime = dtStartTime.AddMinutes(varLength)
Line 602:
Line 603: Dim Cal_StartDate As DateTime
Line 604: Dim Cal_EndDate As DateTime
Line 605: Dim Cal_StartTime As DateTime
Line 606: Dim Cal_EndTime As DateTime
Line 607:
Line 608: Dim PID As String
Line 609:
Line 610: Cal_StartDate = DateTime.Parse(dtStartTime.ToShortDateString)
Line 611: Cal_EndDate = DateTime.Parse(dtEndTime.ToShortDateString)
Line 612:
Line 613: Cal_StartTime = DateTime.Parse("12/30/1899 " & dtStartTime.ToShortTimeString)
Line 614: Cal_EndTime = DateTime.Parse("12/30/1899 " & dtEndTime.ToShortTimeString)
Line 615:
Line 616: Dim conn As SqlConnection = EventsDB.connNDCal()
Line 617: Dim cmd As New SqlCommand()
Line 618:
Line 619: cmd.CommandType = CommandType.StoredProcedure
Line 620: cmd.CommandText = "LockAppointment"
Line 621:
Line 622: cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = sTitle
Line 623: cmd.Parameters.Add("@Body", SqlDbType.NVarChar).Value = sBody
Line 624: cmd.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = Cal_StartDate
Line 625: cmd.Parameters.Add("@EndDate", SqlDbType.DateTime).Value = Cal_EndDate
Line 626: cmd.Parameters.Add("@StartTime", SqlDbType.DateTime).Value = Cal_StartTime
Line 627: cmd.Parameters.Add("@EndTime", SqlDbType.DateTime).Value = Cal_EndTime
Line 628: cmd.Parameters.Add("@TMS_StartTime", SqlDbType.DateTime).Value = dtStartTime
Line 629: cmd.Parameters.Add("@TMS_EndTime", SqlDbType.DateTime).Value = dtEndTime
Line 630: cmd.Parameters.Add("@DayEvent", SqlDbType.NVarChar).Value = "NO"
Line 631: cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = iUID
Line 632: cmd.Parameters.Add("@GroupID", SqlDbType.Int).Value = iRMT
Line 633: cmd.Parameters.Add("@InviteID", SqlDbType.Int).Value = iUID
Line 634: cmd.Parameters.Add("@Status", SqlDbType.NVarChar).Value = "APPROVED"
Line 635: cmd.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output
Line 636:
Line 637: cmd.Connection = conn
Line 638:
Line 639: Try
Line 640: conn.Open()
Line 641: cmd.ExecuteNonQuery()
Line 642: PID = cmd.Parameters("@ID").Value.ToString
Line 643: Catch ex As Exception
Line 644: Throw ex
Line 645: Finally
Line 646: conn.Close()
Line 647: conn.Dispose()
Line 648: End Try
Line 649:
Line 650: 'Session("PID") = PID
Line 651:
Line 652: Try
Line 653: SendAlerts(dtStartTime, dtEndTime, sTitle, sBody, iUID, iRMT_UID, "user")
Line 654: Catch ex As Exception
Line 655:
Line 656: End Try
Line 657:
Line 658: Try
Line 659: SendAlerts(dtStartTime, dtEndTime, sTitle, sBody, iRMT_UID, iRMT_UID, "admin")
Line 660: Catch ex As Exception
Line 661:
Line 662: End Try
Line 663:
Line 664: DrawAppointmentList(iUID)
Line 665: 'WebPlanner1.DataBind()
Line 666:
Line 667: Else
Line 668:
Line 669: Dim strJS As String = "alert('Session timed out');"
Line 670: ClientScript.RegisterStartupScript(Me.GetType(), "myScript", strJS, True)
Line 671:
Line 672: End If
Line 673:
Line 674:
Line 675: End Sub
Line 676:
Line 677: Private Sub SendAlerts(ByVal StartTime As DateTime, ByVal EndTime As DateTime, ByVal Title As String, ByVal Body As String, ByVal UID As Integer, ByVal RMT As Integer, ByVal Recipient As String)
Line 678:
Line 679: Dim Usr As UserDetails = EventsDB.getUserDetails(UID)
Line 680:
Line 681: Dim RMTDetails As UserDetails = EventsDB.getUserDetails(RMT)
Line 682: 'Dim USRDetails As UserDetails = EventsDB.getUserDetails(iUID)
Line 683: 'Dim USRName As String
Line 684:
Line 685: RMTName = RMTDetails.UD_FirstName & " " & RMTDetails.UD_LastName
Line 686: 'USRName = USRDetails.UD_FirstName & " " & USRDetails.UD_LastName
Line 687:
Line 688: Dim msgTo As String
Line 689: Dim msgSubject As String
Line 690:
Line 691: Dim smsBody As String
Line 692:
Line 693: Dim sbBody As New StringBuilder
Line 694:
Line 695: sbBody.Append("<html><head>")
Line 696: sbBody.Append("<style type=" & Chr(34) & "text/css" & Chr(34) & ">")
Line 697: sbBody.Append("<!-- ")
Line 698:
Line 699: sbBody.Append(".EventListingTable")
Line 700: sbBody.Append("{")
Line 701: sbBody.Append(" border-style:solid;")
Line 702: sbBody.Append(" border-width:1;")
Line 703: sbBody.Append(" border-color:white;")
Line 704: sbBody.Append(" border-collapse:collapse;")
Line 705: sbBody.Append(" border-width:1;")
Line 706: sbBody.Append(" text-align:left;")
Line 707: sbBody.Append(" background-color:white;")
Line 708: sbBody.Append(" padding:1;")
Line 709: sbBody.Append(" width:100%;")
Line 710: sbBody.Append(" }")
Line 711:
Line 712: sbBody.Append(".EventListingTitleFont")
Line 713: sbBody.Append(" {")
Line 714: sbBody.Append(" font-family:Trebuchet MS;")
Line 715: sbBody.Append(" font-size:12px;")
Line 716: sbBody.Append(" font-weight:normal;")
Line 717: sbBody.Append(" color:black;")
Line 718: sbBody.Append(" }")
Line 719: sbBody.Append(" A.EventListingTitleFont:Hover")
Line 720: sbBody.Append(" {")
Line 721: sbBody.Append(" color:blue;")
Line 722: sbBody.Append(" font-weight:normal;")
Line 723: sbBody.Append(" text-decoration:underline;")
Line 724: sbBody.Append(" } ")
Line 725:
Line 726: sbBody.Append(".EventListingTimeFont")
Line 727: sbBody.Append(" {")
Line 728: sbBody.Append(" font-family:Trebuchet MS;")
Line 729: sbBody.Append(" font-size:10px;")
Line 730: sbBody.Append(" font-weight:normal;")
Line 731: sbBody.Append(" color:black;")
Line 732: sbBody.Append(" }")
Line 733:
Line 734: sbBody.Append(".EventListingTimeCell")
Line 735: sbBody.Append(" {")
Line 736: sbBody.Append(" width:100%;")
Line 737: sbBody.Append(" text-align:left;")
Line 738: sbBody.Append(" background-color:white;")
Line 739: sbBody.Append(" }")
Line 740:
Line 741: sbBody.Append(".EventListingBodyCell")
Line 742: sbBody.Append(" {")
Line 743: sbBody.Append(" width:100%;")
Line 744: sbBody.Append(" text-align:left;")
Line 745: sbBody.Append(" background-color:white;")
Line 746: sbBody.Append(" }")
Line 747:
Line 748: sbBody.Append(".EventListingTitleCell")
Line 749: sbBody.Append(" {")
Line 750: sbBody.Append(" width:100%;")
Line 751: sbBody.Append("text-align:left;")
Line 752: sbBody.Append("background-color:#EEEEEE;")
Line 753: sbBody.Append("}")
Line 754:
Line 755: sbBody.Append("//-->")
Line 756: sbBody.Append("</style>")
Line 757: sbBody.Append("</head><body>")
Line 758:
Line 759: sbBody.Append("<font class='EventListingTitleFont'>Natural Dynamics Appointment Confirmation:<br /></font>")
Line 760:
Line 761: sbBody.Append("<table cellpadding=3 cellspacing0 WIDTH='100%'><tr><td width='100%'>")
Line 762: sbBody.Append("<table class='EventListingTable'>")
Line 763: sbBody.Append("<tr>")
Line 764: sbBody.Append("<td width='10' bgcolor='#0098D7'><font class='EventListingTitleFont'> </font></td>")
Line 765: sbBody.Append("<td class='EventListingTitleCell'><font class='EventListingTitleFont'>")
Line 766:
Line 767: ' sbBody.Append("<a class='EventListingTitleFont' target='_new' href='" & PathToCalendar & "calendar.asp?caltype=day&date=" & varEventDate & "'" & Chr(34) & ">")
Line 768: sbBody.Append(Title)
Line 769:
Line 770: sbBody.Append("</font></td></tr>")
Line 771: sbBody.Append("<tr>")
Line 772: sbBody.Append("<td width='10' bgcolor='#0098D7'><font class='EventListingTitleFont'> </font></td>")
Line 773: sbBody.Append("<td class='EventListingTimeCell'><font class='EventListingTimeFont'>")
Line 774:
Line 775:
Line 776: sbBody.Append("<b><font color=blue>" & StartTime.ToShortDateString & "</font></b> | " & StartTime.ToShortTimeString & " - " & EndTime.ToShortTimeString & " with " & RMTName)
Line 777:
Line 778: sbBody.Append("</font></td>")
Line 779: sbBody.Append("</tr>")
Line 780: sbBody.Append("</table>")
Line 781: sbBody.Append("</td></tr></table>")
Line 782: sbBody.Append("</body></html>")
Line 783:
Line 784: 'Send to Home Email
Line 785:
Line 786: msgSubject = "New Appointment"
Line 787: msgTo = "admin@body-mind-spirit.com"
Line 788:
Line 789: Alerts_Cal.SendEmail(msgTo, msgSubject, sbBody.ToString, True)
Line 790:
Line 791: Select Case Recipient
Line 792:
Line 793: Case "admin"
Line 794:
Line 795: msgSubject = "New Appointment"
Line 796: msgTo = Usr.UD_Email
Line 797:
Line 798: Alerts_Cal.SendEmail(msgTo, msgSubject, sbBody.ToString, True)
Line 799:
Line 800: If Usr.UD_TEnable = True Then
Line 801:
Line 802: smsBody = Title & vbCrLf _
Line 803: & StartTime.ToShortDateString & " | " _
Line 804: & StartTime.ToShortTimeString & " - " _
Line 805: & EndTime.ToShortTimeString & vbCrLf & vbCrLf _
Line 806: & "Notes:" & vbCrLf _
Line 807: & Body
Line 808:
Line 809: Alerts_Cal.SendSMS(Usr.UD_MPhone, smsBody)
Line 810:
Line 811: End If
Line 812:
Line 813: Case "user"
Line 814:
Line 815: msgSubject = "Appointment Confirmation"
Line 816: msgTo = Usr.UD_Email
Line 817:
Line 818: Alerts_Cal.SendEmail(msgTo, msgSubject, sbBody.ToString, True)
Line 819:
Line 820: If Usr.UD_TEnable = True Then
Line 821:
Line 822: smsBody = Title & vbCrLf _
Line 823: & StartTime.ToShortDateString & " | " _
Line 824: & StartTime.ToShortTimeString & " - " _
Line 825: & EndTime.ToShortTimeString & vbCrLf & vbCrLf _
Line 826: & "with " & RMTName
Line 827:
Line 828: Alerts_Cal.SendSMS(Usr.UD_MPhone, smsBody)
Line 829: End If
Line 830:
Line 831: End Select
Line 832:
Line 833:
Line 834: End Sub
Line 835:
Line 836: Protected Sub lnkLinkEvent_Click(ByVal sender As Object, ByVal e As EventArgs)
Line 837:
Line 838:
Line 839: End Sub
Line 840:
Line 841: Public Function RandomString(ByVal length As Integer) As String
Line 842: Dim random As New Random()
Line 843: Dim charOutput As Char() = New Char(length - 1) {}
Line 844: For i As Integer = 0 To length - 1
Line 845: Dim selector As Integer = random.[Next](65, 101)
Line 846: If selector > 90 Then
Line 847: selector -= 43
Line 848: End If
Line 849: charOutput(i) = Convert.ToChar(selector)
Line 850: Next
Line 851: Return New String(charOutput)
Line 852: End Function
Line 853:
Line 854: Protected Sub SetPageWidth()
Line 855:
Line 856: WebPlanner1.Width = TxtDocWidth.Text
Line 857: WebPlanner1.DataBind()
Line 858:
Line 859: End Sub
Line 860:
Line 861: Protected Function checkNull(ByVal strPhone As String) As String
Line 862:
Line 863: Dim Out As String = ""
Line 864:
Line 865: If strPhone <> "" Then
Line 866: If strPhone <> "Null" Then
Line 867: Dim y As Double = Double.Parse(strPhone)
Line 868: Out = String.Format("{0:(###)###-####}", y)
Line 869: End If
Line 870: End If
Line 871:
Line 872: Return Out
Line 873:
Line 874: End Function
Line 875:
Line 876:
Line 877: End Class
Line 878:
Line 879:
Line 880:
|