Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module SendEmailsModule
- Public Function SendEmailTimescaleChangedAddNotes()
- 'ConnectToDatabase()
- Dim TicketDetails, ReplyDate, Sql As String
- ReplyDate = Format(Now, "dd/MM/yyyy HH:mm:ss")
- TicketDetails = ReplyToEmployeeAdditionalNotes.txtAdditionalDetails.Text
- Sql = "INSERT INTO tblTicket_Reply_Details (Employee_ID, TechSupport_ID, Reply_Description, Reply_Date) " _
- & "VALUES ('" & TechSupportMenu.grdTickets.CurrentRow.Cells(1).Value.ToString() & "','" & UserIDDatabase & "','" & ReplyToEmployeeAdditionalNotes.txtAdditionalDetails.Text & "' , '" & ReplyDate & "')"
- ReplyToEmployeeAdditionalNotes.Close()
- db.connect()
- ds = db.sqltblSubmitted_Ticket_Details(Sql)
- db.Close()
- Dim EmployeeNumbers As String 'This code makes a variable to skip an amount of characters in a label, so just the numbers in my label are used in my sql
- 'ticketnumbers2 is made because otherwise multiple variable declarations will be in the same enclosing block
- EmployeeNumbers = Mid(ReplyToEmployee.lblEmployeeID.Text, 14, 18)
- Dim sql2 As String
- sql2 = "SELECT Employee_Email FROM tblEmployee_Details WHERE Employee_ID = '" & EmployeeNumbers & "'"
- db.connect()
- ds = db.sqlEmployeeEmailSql2(sql2)
- db.Close()
- Dim EmployeeEmail As String
- EmployeeEmail = (ds.Tables("EmployeeEmail").Rows(0).Item(0)) 'Navigates to value in ds array and stores it as a string variable
- Dim Outlook As Microsoft.Office.Interop.Outlook._Application
- Outlook = New Microsoft.Office.Interop.Outlook.Application
- Dim Msg As Microsoft.Office.Interop.Outlook.MailItem
- Msg = Outlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
- Msg.Subject = "Details Concerning Your Ticket"
- Msg.Body = TicketDetails
- 'Sends custom message where controls = text user puts in
- Msg.To = EmployeeEmail
- ' Msg.CC = "fredsls1234@gmail.com"
- Msg.Send()
- MessageBox.Show("An Email has also been sent successfully to the Employee!", ReplyToEmployee.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
- 'Verifies if email has been sent successful or not
- con.Close()
- Return ReplyToEmployee.Text
- End Function
- Public Function SendEmailTicketSolved()
- Dim TicketDetails, ReplyDate As String
- ReplyDate = Format(Now, "dd/MM/yyyy HH:mm")
- TicketDetails = ReplyToEmployeeAdditionalNotes.txtAdditionalDetails.Text
- ReplyToEmployeeAdditionalNotes.Close()
- Dim EmployeeNumbers As String 'This code makes a variable to skip an amount of characters in a label, so just the numbers in my label are used in my sql
- 'ticketnumbers2 is made because otherwise multiple variable declarations will be in the same enclosing block
- EmployeeNumbers = Mid(ReplyToEmployee.lblEmployeeID.Text, 14, 18)
- Dim sql2 As String
- sql2 = "SELECT Employee_Email FROM tblEmployee_Details WHERE Employee_ID = '" & EmployeeNumbers & "'"
- db.connect()
- ds = db.sqlEmployeeEmailSql2(sql2)
- db.Close()
- Dim EmployeeEmail As String
- EmployeeEmail = (ds.Tables("EmployeeEmail").Rows(0).Item(0)) 'Navigates to value in ds array and stores it as a string variable
- 'Connects to outlook------------------------------------------
- Dim Outlook As Microsoft.Office.Interop.Outlook._Application
- Outlook = New Microsoft.Office.Interop.Outlook.Application
- Dim Msg As Microsoft.Office.Interop.Outlook.MailItem
- Msg = Outlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
- Msg.Subject = "Details Concerning Your Ticket"
- Msg.Body = "Your ticket has been solved. Thank you for using GE Tech Support."
- 'Sends custom message where controls = text user puts in
- Msg.To = EmployeeEmail
- ' Msg.CC = "fredsls1234@gmail.com"
- Msg.Send()
- MessageBox.Show("An Email has also been sent successfully to the Employee!", ReplyToEmployee.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
- 'Verifies if email has been sent successful or not
- con.Close()
- Return ReplyToEmployee.Text
- End Function
- Public Function SendEmailTimescaleChangedNoNotes()
- Dim TicketDetails, ReplyDate, Sql As String
- ReplyDate = Format(Now, "dd/MM/yyyy HH:mm")
- TicketDetails = ReplyToEmployeeAdditionalNotes.txtAdditionalDetails.Text
- Sql = "INSERT INTO tblTicket_Reply_Details (Employee_ID, TechSupport_ID, Reply_Description, Reply_Date) VALUES " _
- & "('" & TechSupportMenu.grdTickets.CurrentRow.Cells(1).Value.ToString() & "','" & UserIDDatabase & "', ""Your Ticket is taking longer than expected to solve and your Timescale has been changed. Thank you for your patience!"" , '" & ReplyDate & "')"
- ReplyToEmployeeAdditionalNotes.Close()
- db.connect()
- ds = db.sqltblSubmitted_Ticket_Details(Sql)
- db.Close()
- Dim EmployeeNumbers As String 'This code makes a variable to skip an amount of characters in a label, so just the numbers in my label are used in my sql
- 'ticketnumbers2 is made because otherwise multiple variable declarations will be in the same enclosing block
- EmployeeNumbers = Mid(ReplyToEmployee.lblEmployeeID.Text, 14, 18)
- Dim sql2 As String
- sql2 = "SELECT Employee_Email FROM tblEmployee_Details WHERE Employee_ID = '" & EmployeeNumbers & "'"
- db.connect()
- ds = db.sqlEmployeeEmailSql2(sql2)
- db.Close()
- Dim EmployeeEmail As String
- EmployeeEmail = (ds.Tables("EmployeeEmail").Rows(0).Item(0)) 'Navigates to value in ds array and stores it as a string variable
- Dim Outlook As Microsoft.Office.Interop.Outlook._Application
- Outlook = New Microsoft.Office.Interop.Outlook.Application
- Dim Msg As Microsoft.Office.Interop.Outlook.MailItem
- Msg = Outlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
- Msg.Subject = "Details Concerning Your Ticket"
- Msg.Body = "Your ticket is taking slightly longer than usual to solve and we have extended the deadline. Please see your sent tickets to see the new deadline."
- 'Sends custom message where controls = text user puts in
- Msg.To = EmployeeEmail
- ' Msg.CC = "fredsls1234@gmail.com"
- Msg.Send()
- MessageBox.Show("An Email has also been sent successfully to the Employee!", ReplyToEmployee.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
- 'Verifies if email has been sent successful or not
- Return ReplyToEmployee.Text
- End Function
- Public Function SendEmailToCorrectEmployee()
- Dim EmployeeNumbers, EmployeeEmail, sql2, TicketDetails As String 'This code makes a variable to skip an amount of characters in a label, so just the numbers in my label are used in my sql
- 'ticketnumbers2 is made because otherwise multiple variable declarations will be in the same enclosing block
- EmployeeNumbers = Mid(ReplyToEmployee.lblEmployeeID.Text, 14, 18)
- TicketDetails = ReplyToEmployeeAdditionalNotes.txtAdditionalDetails.Text
- con.Open()
- sql2 = "SELECT Employee_Email FROM tblEmployee_Details WHERE Employee_ID = '" & EmployeeNumbers & "'"
- db.connect()
- ds = db.sqlEmployeeEmailSql2(sql2)
- db.Close()
- EmployeeEmail = (ds.Tables("EmployeeEmail").Rows(0).Item(0)) 'Navigates to value in ds array and stores it as a string variable
- Dim Outlook As Microsoft.Office.Interop.Outlook._Application
- Outlook = New Microsoft.Office.Interop.Outlook.Application
- Dim Msg As Microsoft.Office.Interop.Outlook.MailItem
- Msg = Outlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
- Msg.Subject = "Details Concerning Your Ticket"
- Msg.Body = TicketDetails
- 'Sends custom message where controls = text user puts in
- Msg.To = EmployeeEmail
- Msg.Send()
- MessageBox.Show("An Email has also been sent successfully to the Employee!", ReplyToEmployee.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
- 'Verifies if email has been sent successful or not
- Return ReplyToEmployee.Text
- End Function
- End Module
Add Comment
Please, Sign In to add comment