'********************************************************************************************************************************************************** ' ' EasyAccess.biz ' ' Copyright EasyAccess Business Solutions Inc. January 2004 - February 2008. All rights reserved. Unauthorized reproduction, distribution or copying is strictly prohibited. ' For further information, please contact EasyAccess Business Solutions Inc. 905-729-3459 - www.EasyAccess.biz ' '********************************************************************************************************************************************************** Imports System.IO Imports System.Text Imports System.Web.ui Imports System.Data Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Public Class Incident Inherits System.Web.UI.Page Protected WithEvents SummaryLabel As System.Web.UI.WebControls.Label Protected WithEvents IncidentID As System.Web.UI.WebControls.TextBox Protected WithEvents IncidentIDLabel As System.Web.UI.WebControls.Label Protected WithEvents Priority As System.Web.UI.WebControls.DropDownList Protected WithEvents PriorityLabel As System.Web.UI.WebControls.Label Protected WithEvents Status As System.Web.UI.WebControls.DropDownList Protected WithEvents StatusLabel As System.Web.UI.WebControls.Label Protected WithEvents StartDateLabel As System.Web.UI.WebControls.Label Protected WithEvents SLA As System.Web.UI.WebControls.DropDownList Protected WithEvents SLALabel As System.Web.UI.WebControls.Label Protected WithEvents Product As System.Web.UI.WebControls.DropDownList Protected WithEvents ProductLabel As System.Web.UI.WebControls.Label Protected WithEvents Version As System.Web.UI.WebControls.DropDownList Protected WithEvents VersionLabel As System.Web.UI.WebControls.Label Protected WithEvents Platform As System.Web.UI.WebControls.DropDownList Protected WithEvents Platformlabel As System.Web.UI.WebControls.Label Protected WithEvents Database As System.Web.UI.WebControls.DropDownList Protected WithEvents DatabaseLabel As System.Web.UI.WebControls.Label Protected WithEvents Duration As System.Web.UI.WebControls.TextBox Protected WithEvents ContactInformation As System.Web.UI.WebControls.Label Protected WithEvents IncidentDescriptionLabel As System.Web.UI.WebControls.Label Protected WithEvents Categorizationlabel As System.Web.UI.WebControls.Label Protected WithEvents Summary As System.Web.UI.WebControls.TextBox Protected WithEvents AssignedTo As System.Web.UI.WebControls.DropDownList Protected WithEvents AssignedToLabel As System.Web.UI.WebControls.Label Protected WithEvents AssignedToGroup As System.Web.UI.WebControls.DropDownList Protected WithEvents Submitter As System.Web.UI.WebControls.TextBox Protected WithEvents SubmitterLabel As System.Web.UI.WebControls.Label Protected WithEvents DeleteIncident As System.Web.UI.WebControls.Button Protected WithEvents StartNewIncident As System.Web.UI.WebControls.Button Protected WithEvents SaveIncident As System.Web.UI.WebControls.Button Protected WithEvents Assign As System.Web.UI.WebControls.Label Protected WithEvents ContactID As System.Web.UI.WebControls.DropDownList Protected WithEvents FirstNameLabel As System.Web.UI.WebControls.Label Protected WithEvents FirstName As System.Web.UI.WebControls.TextBox Protected WithEvents CompanyLabel As System.Web.UI.WebControls.Label Protected WithEvents CompanyDropDownList As System.Web.UI.WebControls.DropDownList Protected WithEvents LastNameLabel As System.Web.UI.WebControls.Label Protected WithEvents LastName As System.Web.UI.WebControls.TextBox Protected WithEvents AddressLabel As System.Web.UI.WebControls.Label Protected WithEvents Address As System.Web.UI.WebControls.TextBox Protected WithEvents PhoneLabel As System.Web.UI.WebControls.Label Protected WithEvents Phone As System.Web.UI.WebControls.TextBox Protected WithEvents CityLabel As System.Web.UI.WebControls.Label Protected WithEvents City As System.Web.UI.WebControls.TextBox Protected WithEvents EMailLabel As System.Web.UI.WebControls.Label Protected WithEvents EMail As System.Web.UI.WebControls.TextBox Protected WithEvents State As System.Web.UI.WebControls.DropDownList Protected WithEvents ZipLabel As System.Web.UI.WebControls.Label Protected WithEvents Zip As System.Web.UI.WebControls.TextBox Protected WithEvents StateLabel As System.Web.UI.WebControls.Label Protected WithEvents YesDeleteIncidentButton As System.Web.UI.WebControls.Button Protected WithEvents NoDeleteIncidentButton As System.Web.UI.WebControls.Button Protected WithEvents YesButton As System.Web.UI.WebControls.Button Protected WithEvents NoButton As System.Web.UI.WebControls.Button Protected WithEvents ContactIDLabel As System.Web.UI.WebControls.Label Protected WithEvents Assignmentlabel As System.Web.UI.WebControls.Label Protected WithEvents SearchButton As System.Web.UI.WebControls.Button Protected WithEvents Attachments As System.Web.UI.WebControls.ListBox Protected WithEvents AssetDropDownList As System.Web.UI.WebControls.DropDownList Protected WithEvents AssetsDropDownListLabel As System.Web.UI.WebControls.Label Protected WithEvents IncidentButton As System.Web.UI.WebControls.Button Protected WithEvents About As System.Web.UI.WebControls.LinkButton Protected WithEvents SiteFeedback As System.Web.UI.WebControls.LinkButton Protected WithEvents LinkButton3 As System.Web.UI.WebControls.LinkButton Protected WithEvents LinkButton2 As System.Web.UI.WebControls.LinkButton Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton Protected WithEvents FrequentlyAsked As System.Web.UI.WebControls.LinkButton Protected WithEvents ChangeSettings As System.Web.UI.WebControls.LinkButton Protected WithEvents ChangePassword As System.Web.UI.WebControls.LinkButton Protected WithEvents Logout As System.Web.UI.WebControls.Button Protected WithEvents IncidentLabel As System.Web.UI.WebControls.Label Protected WithEvents MainConsole As System.Web.UI.WebControls.LinkButton Protected WithEvents Worklogs As System.Web.UI.WebControls.Button Protected WithEvents Attach As System.Web.UI.WebControls.Button Protected WithEvents Audit As System.Web.UI.WebControls.Button Protected WithEvents Button1 As System.Web.UI.WebControls.Button Protected WithEvents FirstNameLookup As System.Web.UI.WebControls.Button Protected WithEvents LastNameLookup As System.Web.UI.WebControls.Button Protected WithEvents EMailLookup As System.Web.UI.WebControls.Button Protected WithEvents CompanyLookup As System.Web.UI.WebControls.Button Protected WithEvents PhoneLookup As System.Web.UI.WebControls.Button Protected WithEvents CityLookup As System.Web.UI.WebControls.Button Protected WithEvents AddressLookup As System.Web.UI.WebControls.Button Protected WithEvents AssetLookup As System.Web.UI.WebControls.Button Protected WithEvents Knowledgebase As System.Web.UI.WebControls.LinkButton Protected WithEvents StateZipLookup As System.Web.UI.WebControls.Button Protected WithEvents EMailContact As System.Web.UI.WebControls.LinkButton Protected WithEvents PrintIncident As System.Web.UI.WebControls.Button Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer Protected WithEvents Label1 As System.Web.UI.WebControls.Label Protected WithEvents CreateKB As System.Web.UI.WebControls.Button Protected WithEvents QuickTicket As System.Web.UI.WebControls.Button Protected WithEvents LinkButton4 As System.Web.UI.WebControls.LinkButton Protected WithEvents AgentLookup As System.Web.UI.WebControls.LinkButton Protected WithEvents IncidentAssociations As System.Web.UI.WebControls.Button Protected WithEvents Sequence As System.Web.UI.WebControls.TextBox Protected WithEvents SequenceLabel As System.Web.UI.WebControls.Label Protected WithEvents IncidentConsole As System.Web.UI.WebControls.LinkButton Protected WithEvents CreateProblem As System.Web.UI.WebControls.Button Protected WithEvents SiteLabel As System.Web.UI.WebControls.Label Protected WithEvents BusinessUnit As System.Web.UI.WebControls.DropDownList Protected WithEvents SiteDropDownList As System.Web.UI.WebControls.DropDownList Protected WithEvents OrganizationLabel As System.Web.UI.WebControls.Label Protected WithEvents Department As System.Web.UI.WebControls.DropDownList Protected WithEvents DepartmentLabel As System.Web.UI.WebControls.Label Protected WithEvents Organization As System.Web.UI.WebControls.DropDownList Protected WithEvents BusinessUnitLookup As System.Web.UI.WebControls.Button Protected WithEvents SiteLookup As System.Web.UI.WebControls.Button Protected WithEvents OrganizationLookup As System.Web.UI.WebControls.Button Protected WithEvents DepartmentLookup As System.Web.UI.WebControls.Button Protected WithEvents StatusReasonLabel As System.Web.UI.WebControls.Label Protected WithEvents ClassificationLabel As System.Web.UI.WebControls.Label Protected WithEvents ImpactLabel As System.Web.UI.WebControls.Label Protected WithEvents Impact As System.Web.UI.WebControls.DropDownList Protected WithEvents UrgencyLabel As System.Web.UI.WebControls.Label Protected WithEvents Urgency As System.Web.UI.WebControls.DropDownList Protected WithEvents ServiceTypeLabel As System.Web.UI.WebControls.Label Protected WithEvents ServiceType As System.Web.UI.WebControls.DropDownList Protected WithEvents ManagerLabel As System.Web.UI.WebControls.Label Protected WithEvents VendorInformationLabel As System.Web.UI.WebControls.Label Protected WithEvents AssignedDateLabel As System.Web.UI.WebControls.Label Protected WithEvents AssignedDate As System.Web.UI.WebControls.TextBox Protected WithEvents VendorSLALabel As System.Web.UI.WebControls.Label Protected WithEvents VendorSLA As System.Web.UI.WebControls.DropDownList Protected WithEvents VendorName As System.Web.UI.WebControls.Label Protected WithEvents VendorContactLabel As System.Web.UI.WebControls.Label Protected WithEvents DefaultGroup As System.Web.UI.WebControls.Button Protected WithEvents Button3 As System.Web.UI.WebControls.Button Protected WithEvents VendorEmailLabel As System.Web.UI.WebControls.Label Protected WithEvents VendorEmail As System.Web.UI.WebControls.TextBox Protected WithEvents VendorPhoneLabel As System.Web.UI.WebControls.Label Protected WithEvents VendorPhone As System.Web.UI.WebControls.TextBox Protected WithEvents TicketLabel As System.Web.UI.WebControls.Label Protected WithEvents Ticket As System.Web.UI.WebControls.TextBox Protected WithEvents SystemInformationLabel As System.Web.UI.WebControls.Label Protected WithEvents LastModifiedByLabel As System.Web.UI.WebControls.Label Protected WithEvents LastModifiedBy As System.Web.UI.WebControls.TextBox Protected WithEvents LastModifiedDateLabel As System.Web.UI.WebControls.Label Protected WithEvents LastModifiedDate As System.Web.UI.WebControls.TextBox Protected WithEvents Resolution As System.Web.UI.WebControls.Button Protected WithEvents Manager As System.Web.UI.WebControls.DropDownList Protected WithEvents StatusReason As System.Web.UI.WebControls.DropDownList Protected WithEvents CreateDate As System.Web.UI.WebControls.TextBox Protected WithEvents StartDate As System.Web.UI.WebControls.TextBox Protected WithEvents StartDateLabel2 As System.Web.UI.WebControls.Label Protected WithEvents ErrorMessage As System.Web.UI.WebControls.Literal Protected WithEvents ResolutionDateLabel As System.Web.UI.WebControls.Label Protected WithEvents ResolutionDate As System.Web.UI.WebControls.TextBox Protected WithEvents ContactInfoViaLDAP As System.Web.UI.WebControls.LinkButton Protected WithEvents BusinessUnitLabel As System.Web.UI.WebControls.Label Protected WithEvents Vendor As System.Web.UI.WebControls.DropDownList Protected WithEvents VendorContact As System.Web.UI.WebControls.DropDownList Protected WithEvents VendorLookup As System.Web.UI.WebControls.Button Protected WithEvents VendorContactLookup As System.Web.UI.WebControls.Button Protected WithEvents Button2 As System.Web.UI.WebControls.Button Protected WithEvents SearchSimilarProblems As System.Web.UI.WebControls.Button Protected WithEvents Attributes As System.Web.UI.WebControls.Button Protected WithEvents Approvals As System.Web.UI.WebControls.Button Protected WithEvents HelpLink As System.Web.UI.WebControls.LinkButton Protected WithEvents RelateToProblem As System.Web.UI.WebControls.Button Protected WithEvents ContactIDLookup As System.Web.UI.WebControls.Button Protected WithEvents ImpactedAreas As System.Web.UI.WebControls.Button #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load 'Put user code to initialize the page here If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If If Session.Item("LoginType") = "Contact" Or Session.Item("LoginType") = "LDAP-Contact" Then Response.Redirect(Session.Item("ConsolePage")) End If Me.ErrorMessage.Text = "" Page.MaintainScrollPositionOnPostBack = True If Not IsNothing(Session.Item("LCID")) Then If Session.Item("LCID") <> 0 Then Session.LCID = Session.Item("LCID") End If End If If Request.QueryString("IncidentID") <> "" Then If IsNumeric(Request.QueryString("IncidentID")) Then Call ClearIncident() Session.Remove("RecordLockIncidentIDTryAndGetLock") Session.Add("RecordLockIncidentIDTryAndGetLock", Request.QueryString("IncidentID")) Response.Redirect("Incident.aspx") End If End If 'If the Session.Item("LoggedIn") no longer exists, the Session has been inactive past the Session.Timeout If Session.Item("LoggedIn") Is Nothing Then Response.Redirect("Login.aspx?SessionTimeout=True") End If If CheckPermissions(Replace(Session.Item("LoginID"), "'", "''"), "Read", "Incident") = False Then Response.Redirect(Session.Item("ConsolePage")) End If If Me.Page.IsPostBack = False Then Me.IncidentLabel.Text = Application(Session.Item("Language") & " Incident") End If If Session.Item("ContactViaLDAP") = "Enabled" Then Me.ContactInfoViaLDAP.Visible = True End If If Me.Page.IsPostBack = False Then Call LoadToolTip() End If If Session.Item("Language") <> "English" And Me.Page.IsPostBack = False Then Call Translate() End If Dim Objrs Dim Objrs2 Dim i As Integer Dim IdentitySearchCriteria As String Dim BizDataSet As DataSet Dim TableRow As DataRow Dim BizDataSet2 As DataSet Dim TableRow2 As DataRow 'Populate the State Dropdown If Me.State.Items.Count < 1 Then Me.State.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("States", "State, ShortName", "1=1", 9999, "State Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.State.Items.Add(New ListItem(TableRow("ShortName").ToString & " - " & TableRow("State").ToString, TableRow("ShortName").ToString)) Next BizDataSet.Dispose() End If 'Populate the Status Dropdown If Me.Status.Items.Count < 1 Then Me.Status.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Status", "Status", "EAModule = 'Incident'", 9999, "Status Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.Status.Items.Add(New ListItem(TableRow("Status").ToString)) Next BizDataSet.Dispose() End If If Me.StatusReason.Items.Count < 1 Then Me.StatusReason.Items.Add("") End If 'Populate the Priority DropDown If Me.Priority.Items.Count < 1 Then Me.Priority.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Priority", "PriorityID, PriorityValue", "EAModule = 'Incident'", 9999, "PriorityID Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.Priority.Items.Add(New ListItem(TableRow("PriorityID").ToString & " - " & TableRow("PriorityValue").ToString, TableRow("PriorityID").ToString)) Next BizDataSet.Dispose() End If 'Populate the Product Dropdown If Me.Product.Items.Count < 1 Then Me.Product.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Categorizations", "Product", "(EAModule='Incident' or EAModule = '' or EAModule is Null) and ((Company is NULL or Company = '') or (Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "')))) Group by Product", 9999, "Product Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.Product.Items.Add(TableRow("Product").ToString()) Next BizDataSet.Dispose() End If Me.Version.Items.Add(" ") Me.Platform.Items.Add(" ") Me.Database.Items.Add(" ") 'Populate the SLA DropDown If Me.SLA.Items.Count < 1 Then Me.SLA.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("SLA", "SLAName", "EAModule='Incident' and Enabled = 'TRUE'", 9999, "SLAName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.SLA.Items.Add(TableRow("SLAName").ToString()) Next BizDataSet.Dispose() End If 'Populate the VendorSLA DropDown If Me.VendorSLA.Items.Count < 1 Then Me.VendorSLA.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("SLA", "SLAName", "EAModule='Incident' and Enabled = 'TRUE'", 9999, "SLAName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.VendorSLA.Items.Add(TableRow("SLAName").ToString()) Next BizDataSet.Dispose() End If 'Populate the Vendor DropDown If Me.Vendor.Items.Count < 1 Then Me.Vendor.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Company", "CompanyName", "1=1", 9999, "CompanyName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.Vendor.Items.Add(TableRow("CompanyName").ToString()) Next BizDataSet.Dispose() End If If Me.VendorContact.Items.Count = 0 Then Me.VendorContact.Items.Add("") End If 'Populates the Company Dropdown with all records If Me.CompanyDropDownList.Items.Count < 1 Then Me.CompanyDropDownList.Items.Add(New ListItem("", "")) Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Company", "CompanyName, CompanyID", "1=1", 9999, "CompanyName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.CompanyDropDownList.Items.Add(New ListItem(TableRow("CompanyName").ToString, TableRow("CompanyID").ToString)) Next BizDataSet.Dispose() End If If Me.Page.IsPostBack = False Then 'Initialize the BusinessUnit Dropdown Me.BusinessUnit.Items.Clear() Me.BusinessUnit.Items.Add(" ") Me.BusinessUnit.Items(0).Text = " " Me.BusinessUnit.Items(0).Value = 0 i = 0 Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("BusinessUnit", "BusinessUnitID, BusinessUnitName", "CompanyID = 0 or CompanyID Is Null", 9999, "BusinessUnitName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows i = i + 1 Me.BusinessUnit.Items.Add(TableRow("BusinessUnitName").ToString) Me.BusinessUnit.Items(i).Text = TableRow("BusinessUnitName").ToString Me.BusinessUnit.Items(i).Value = TableRow("BusinessUnitID").ToString Next BizDataSet.Dispose() End If 'Initialize the BusinessUnit Dropdown If Me.BusinessUnit.Items.Count < 1 Then Me.BusinessUnit.Items.Add(New ListItem(" ", 0)) End If If Me.Page.IsPostBack = False Then Me.SiteDropDownList.Items.Clear() Me.SiteDropDownList.Items.Add(" ") Me.SiteDropDownList.Items(0).Text = " " Me.SiteDropDownList.Items(0).Value = 0 i = 0 Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Site", "SiteID, SiteName", "(BusinessUnitID = 0 or BusinessUnitID Is Null) and (CompanyID = 0 or CompanyID Is Null)", 9999, "SiteName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("SiteName").ToString) Then i = i + 1 Me.SiteDropDownList.Items.Add(TableRow("SiteName").ToString) Me.SiteDropDownList.Items(i).Text = TableRow("SiteName").ToString Me.SiteDropDownList.Items(i).Value = TableRow("SiteID").ToString End If Next BizDataSet.Dispose() Objrs = Nothing End If If Me.SiteDropDownList.Items.Count < 1 Then Me.SiteDropDownList.Items.Add(New ListItem(" ", 0)) End If If Me.Page.IsPostBack = False Then Me.Organization.Items.Clear() Me.Organization.Items.Add(" ") Me.Organization.Items(0).Text = " " Me.Organization.Items(0).Value = 0 i = 0 Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Organization", "OrganizationID, OrganizationName", "(SiteID = 0 or SiteID Is Null) And (BusinessUnitID = 0 or BusinessUnitID Is Null) and (CompanyID = 0 or CompanyID Is Null)", 9999, "OrganizationName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("OrganizationName").ToString) Then i = i + 1 Me.Organization.Items.Add(TableRow("OrganizationName").ToString) Me.Organization.Items(i).Text = TableRow("OrganizationName").ToString Me.Organization.Items(i).Value = TableRow("OrganizationID").ToString End If Next BizDataSet.Dispose() Objrs = Nothing End If If Me.Organization.Items.Count < 1 Then Me.Organization.Items.Add(New ListItem(" ", 0)) End If If Me.Page.IsPostBack = False Then Me.Department.Items.Clear() Me.Department.Items.Add(" ") Me.Department.Items(0).Text = " " Me.Department.Items(0).Value = 0 i = 0 Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Department", "DepartmentID, DepartmentName", "(CompanyID = 0 or CompanyID Is Null) and (BusinessUnitID = 0 or BusinessUnitID Is Null) and (SiteID = 0 or SiteID Is Null) and (OrganizationID = 0 or OrganizationID Is Null)", 9999, "DepartmentName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("DepartmentName").ToString) Then i = i + 1 Me.Department.Items.Add(TableRow("DepartmentName").ToString) Me.Department.Items(i).Text = TableRow("DepartmentName").ToString Me.Department.Items(i).Value = TableRow("DepartmentID").ToString End If Next BizDataSet.Dispose() Objrs = Nothing End If 'Initialize the Department Dropdown If Me.Department.Items.Count < 1 Then Me.Department.Items.Add(New ListItem(" ", 0)) End If 'Populate the ContactID dropdown If Me.ContactID.Items.Count < 1 Then Me.ContactID.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") If IsNothing(Session.Item("IncidentContactSearchCriteria")) Then Session.Add("IncidentContactSearchCriteria", "1=1") End If If Session.Item("LoginType") = "Contact" Or Session.Item("LoginType") = "LDAP-Contact" Then BizDataSet = Objrs.EAGet("Contact", "ContactID", "ContactID = '" & Replace(Session.Item("LoginID"), "'", "''") & "'", 9999, "ContactID Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Else BizDataSet = Objrs.EAGet("Contact", "ContactID", "1=1", 9999, "ContactID Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) End If For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("ContactID").ToString) Then Me.ContactID.Items.Add(New ListItem(TableRow("ContactID").ToString)) End If Next BizDataSet.Dispose() Objrs = Nothing End If 'Populate the AssignedToGroup dropdown If Me.AssignedToGroup.Items.Count < 2 Then Me.AssignedToGroup.Items.Clear() Me.AssignedToGroup.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Groups", "*", "GroupStatus <> 'Inactive' and GroupName <> 'Contacts'", 99999, "GroupName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.AssignedToGroup.Items.Add(TableRow("GroupName").ToString) Next BizDataSet.Dispose() Objrs = Nothing End If 'Populate the Assigned To If Me.AssignedTo.Items.Count < 1 Then Me.AssignedTo.Items.Clear() Me.AssignedTo.Items.Add(" ") Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Agents", "AgentID", "AgentStatus <> 'Absent'", 99999, "AgentID Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.AssignedTo.Items.Add(TableRow("AgentID").ToString) Next BizDataSet.Dispose() Objrs = Nothing End If If Me.Manager.Items.Count < 1 Then Me.Manager.Items.Clear() Me.Manager.Items.Add(" ") Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Agents", "AgentID", "AgentStatus <> 'Absent'", 99999, "AgentID Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.AssignedTo.Items.Add(TableRow("AgentID").ToString) Next BizDataSet.Dispose() Objrs = Nothing End If 'Populate the ServiceType dropdown If Me.ServiceType.Items.Count < 1 Then Me.ServiceType.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("ServiceType", "*", "EAModule='Incident'", 99999, "ServiceType Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.ServiceType.Items.Add(TableRow("ServiceType").ToString) Next BizDataSet.Dispose() Objrs = Nothing End If 'Populate the Impact dropdown If Me.Impact.Items.Count < 1 Then Me.Impact.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Impact", "*", "EAModule='Incident'", 99999, "Impact Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.Impact.Items.Add(TableRow("Impact").ToString) Next BizDataSet.Dispose() Objrs = Nothing End If 'Populate the Urgency dropdown If Me.Urgency.Items.Count < 1 Then Me.Urgency.Items.Add(" ") Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Urgency", "*", "EAModule='Incident'", 99999, "Urgency Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow In BizDataSet.Tables(0).Rows Me.Urgency.Items.Add(TableRow("Urgency").ToString) Next BizDataSet.Dispose() Objrs = Nothing End If Dim cmd As Boolean Objrs = CreateObject("BizClass.NET") cmd = Objrs.CheckPermissions(Replace(Session.Item("LoginID"), "'", "''"), "Delete", "Incident", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Objrs = Nothing If cmd = False Then Me.DeleteIncident.Enabled = False End If If Session.Item("Language") <> "English" And Me.Page.IsPostBack = False Then Call Translate() End If Dim IncidentNumber If Not IsNothing(Session.Item("RecordLockIncidentIDTryAndGetLock")) Then IncidentNumber = Session.Item("RecordLockIncidentIDTryAndGetLock") End If If Not IsNothing(IncidentNumber) Then If IsNumeric(IncidentNumber) Then Session.Remove("RecordLockIncidentIDTryAndGetLock") Session.Add("RecordLockIncidentIDTryAndGetLock", IncidentNumber) End If End If If IsNothing(IncidentNumber) Then Me.DeleteIncident.Enabled = False Me.CreateProblem.Enabled = False Me.RelateToProblem.Enabled = False Me.PrintIncident.Enabled = False Me.CreateKB.Enabled = False End If If IncidentNumber = -1 Then Me.ErrorMessage.Text = "" Exit Sub End If If Not IsNothing(IncidentNumber) And Me.Page.IsPostBack = False Then 'Check to see if the record is locked Dim objCommand Dim RecordLock As String Dim LockOwner As String LockOwner = Session.Item("LoginID") If Not IsNothing(Session.Item("RecordLockIncidentID")) Then objCommand = CreateObject("BizClass.NET") cmd = objCommand.EADelete("RecordLock", "EAModuleID = " & Session.Item("RecordLockIncidentID") & " And EAModule = 'Incident' And LockOwner = '" & Replace(Session.Item("LoginID"), "'", "''") & "'", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objCommand = Nothing End If If IncidentNumber > 0 Then objCommand = CreateObject("BizClass.NET") RecordLock = objCommand.checkRecordLock(IncidentNumber, "Incident", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objCommand = Nothing If RecordLock <> "False" And RecordLock <> Session.Item("LoginID") Then Me.ErrorMessage.Text = "" Session.Remove("RecordLockIncidentID") Session.Add("RecordLockIncidentID", IncidentNumber) Call LockIncident() Else 'Delete the record lock if it's the same LoginID to refresh the Recordlock timeout If RecordLock = Session.Item("LoginID") Then objCommand = CreateObject("BizClass.NET") cmd = objCommand.deleteRecordLock(IncidentNumber, "Incident", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objCommand = Nothing End If objCommand = CreateObject("BizClass.NET") cmd = objCommand.getRecordLock(IncidentNumber, LockOwner, "Incident", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objCommand = Nothing If cmd = False Then Session.Remove("RecordLockIncidentID") Session.Add("RecordLockIncidentID", IncidentNumber) Call LockIncident() Me.ErrorMessage.Text = "" Else Session.Remove("RecordLockIncidentID") Session.Add("RecordLockIncidentID", IncidentNumber) End If End If End If ' IncidentNumber > 0 If Not IsNothing(Session.Item("WorklogTimeEntryRedirect")) Then If Session.Item("WorklogTimeEntryRedirect") = "True" Then Response.Redirect("Worklog.aspx") End If End If Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Incident", "*", "IncidentID = " & IncidentNumber, 1, "IncidentID Desc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If BizDataSet.Tables(0).Rows.Count < 1 Then BizDataSet.Dispose() Objrs = Nothing Session.Remove("RecordLockIncidentIDTryAndGetLock") Session.Remove("RecordLockIncidentID") Me.ErrorMessage.Text = "" Exit Sub End If 'populate the Incident form fields TableRow = BizDataSet.Tables(0).Rows.Item(0) Me.IncidentID.Text = IncidentNumber Me.IncidentLabel.Text = Application(Session.Item("Language") & " Incident") & " " & IncidentNumber If Not IsDBNull(TableRow("FirstName").ToString) Then Me.FirstName.Text = TableRow("FirstName").ToString End If If Not IsDBNull(TableRow("StatusReason").ToString) Then Me.StatusReason.Items(0).Text = TableRow("StatusReason").ToString End If If Not IsDBNull(TableRow("Impact").ToString) Then Me.Impact.Items(0).Text = TableRow("Impact").ToString Me.Impact.SelectedIndex = 0 End If If Not IsDBNull(TableRow("Urgency").ToString) Then Me.Urgency.Items(0).Text = TableRow("Urgency").ToString Me.Urgency.SelectedIndex = 0 End If If Not IsDBNull(TableRow("ServiceType").ToString) Then Me.ServiceType.Items(0).Text = TableRow("ServiceType").ToString Me.ServiceType.SelectedIndex = 0 End If If Not IsDBNull(TableRow("Manager").ToString) Then Me.Manager.Items(0).Text = TableRow("Manager").ToString End If If Not IsDBNull(TableRow("VendorSLA").ToString) Then Me.VendorSLA.Items(0).Text = TableRow("VendorSLA").ToString End If If Not IsDBNull(TableRow("LastName").ToString) Then Me.LastName.Text = TableRow("LastName").ToString End If If Not IsDBNull(TableRow("VendorName").ToString) Then Me.Vendor.SelectedIndex = 0 Me.Vendor.SelectedItem.Text = TableRow("VendorName").ToString End If If Not IsDBNull(TableRow("Ticket").ToString) Then Me.Ticket.Text = TableRow("Ticket").ToString End If If Not IsDBNull(TableRow("VendorContact").ToString) Then If Me.VendorContact.Items.Count < 1 Then Me.VendorContact.Items.Add("") End If Me.VendorContact.SelectedIndex = 0 Me.VendorContact.SelectedItem.Text = TableRow("VendorContact").ToString End If If Not IsDBNull(TableRow("VendorEmail").ToString) Then Me.VendorEmail.Text = TableRow("VendorEmail").ToString End If If Not IsDBNull(TableRow("VendorPhone").ToString) Then Me.VendorPhone.Text = TableRow("VendorPhone").ToString End If If Not IsDBNull(TableRow("AssignedDate").ToString) Then Me.AssignedDate.Text = TableRow("AssignedDate").ToString End If If Not IsDBNull(TableRow("LastModifiedBy").ToString) Then Me.LastModifiedBy.Text = TableRow("LastModifiedBy").ToString End If If Not IsDBNull(TableRow("LastModifiedDate").ToString) Then Me.LastModifiedDate.Text = TableRow("LastModifiedDate").ToString End If If Not IsDBNull(TableRow("StartDate").ToString) Then Me.StartDate.Text = TableRow("StartDate").ToString End If If Not IsDBNull(TableRow("ResolutionDate").ToString) Then Me.ResolutionDate.Text = TableRow("ResolutionDate").ToString End If If Not IsDBNull(TableRow("ContactPhone").ToString) Then Me.Phone.Text = TableRow("ContactPhone").ToString End If If Not IsDBNull(TableRow("ContactEMail").ToString) Then Me.EMail.Text = TableRow("ContactEmail").ToString End If If Not IsDBNull(TableRow("Address").ToString) Then Me.Address.Text = TableRow("Address").ToString End If If Not IsDBNull(TableRow("City").ToString) Then Me.City.Text = TableRow("City").ToString End If If Not IsDBNull(TableRow("CreateDate").ToString) Then Me.CreateDate.Text = TableRow("CreateDate").ToString End If If Not IsDBNull(TableRow("Outbound").ToString) Then Session.Remove("PreDefinedServiceRequestID") Session.Add("PreDefinedServiceRequestID", TableRow("Outbound").ToString) End If If Not IsDBNull(TableRow("ContactID").ToString) Then Me.ContactID.Items(0).Text = TableRow("ContactID").ToString Me.ContactID.SelectedIndex = 0 End If If Not IsDBNull(TableRow("IncidentID").ToString) Then Me.IncidentID.Text = TableRow("IncidentID").ToString Me.IncidentLabel.Text = Application(Session.Item("Language") & " Incident") & " " & TableRow("IncidentID").ToString Session.Remove("CurrentIncidentID") Session.Add("CurrentIncidentID", TableRow("IncidentID").ToString) End If If Not IsDBNull(TableRow("ProblemID").ToString) Then If IsNumeric(TableRow("ProblemID").ToString) Then Session.Remove("IncidentProblemID") Session.Add("IncidentProblemID", TableRow("ProblemID").ToString) Me.CreateProblem.Text = Application(Session.Item("Language") & " Problem") & " " & TableRow("ProblemID").ToString Me.CreateProblem.ToolTip = "Click here to view Problem " & TableRow("ProblemID").ToString & " which was created by Incident " & Me.IncidentID.Text End If End If If Not IsDBNull(TableRow("AssignedDate").ToString) Then If TableRow("AssignedDate").ToString = "1900-01-01" Then Me.AssignedDate.Text = "" Else Me.AssignedDate.Text = TableRow("AssignedDate").ToString End If End If If Not IsDBNull(TableRow("ServiceType").ToString) Then Me.ServiceType.Items(0).Text = TableRow("ServiceType").ToString End If If Not IsDBNull(TableRow("CallDuration").ToString) Then Me.Duration.Text = TableRow("CallDuration").ToString End If If Not IsDBNull(TableRow("Sequence").ToString) Then Me.Sequence.Text = TableRow("Sequence").ToString End If If Not IsDBNull(TableRow("KBID").ToString) Then If IsNumeric(TableRow("KBID").ToString) Then Me.CreateKB.Text = "KB " & TableRow("KBID").ToString Me.CreateKB.Enabled = True Session.Remove("IncidentKBID") Session.Add("IncidentKBID", TableRow("KBID").ToString) Else Me.CreateKB.Text = Application(Session.Item("Language") & " Create Knowledge") Session.Remove("IncidentKBID") End If Else Me.CreateKB.Text = Application(Session.Item("Language") & " Create Knowledge") Session.Remove("IncidentKBID") End If If Not IsDBNull(TableRow("State").ToString) Then Me.State.Items(0).Text = TableRow("State").ToString Me.State.Items(0).Value = TableRow("State").ToString Me.State.SelectedIndex = 0 End If If Not IsDBNull(TableRow("Zip").ToString) Then Me.Zip.Text = TableRow("Zip").ToString End If If Not IsDBNull(TableRow("Submitter").ToString) Then Me.Submitter.Text = TableRow("Submitter").ToString End If If Not IsDBNull(TableRow("Summary").ToString) Then Me.Summary.Text = TableRow("Summary").ToString End If If Not IsDBNull(TableRow("VendorName").ToString) Then Me.Vendor.SelectedIndex = 0 Me.Vendor.SelectedItem.Text = TableRow("VendorName").ToString End If If Not IsDBNull(TableRow("Priority").ToString) Then Me.Priority.Items(0).Text = TableRow("Priority").ToString Me.Priority.Items(0).Value = TableRow("Priority").ToString Me.Priority.SelectedIndex = 0 End If If Not IsDBNull(TableRow("Status").ToString) Then Me.Status.Items(0).Text = TableRow("Status").ToString Me.Status.Items(0).Value = TableRow("Status").ToString Me.Status.SelectedIndex = 0 Session.Remove("OriginalIncidentStatus") Session.Add("OriginalIncidentStatus", TableRow("Status").ToString) Else Session.Remove("OriginalIncidentSTatus") End If If Not IsDBNull(TableRow("SLAName").ToString) Then Me.SLA.Items(0).Text = TableRow("SLAName").ToString End If If Not IsDBNull(TableRow("AssignedToGroup").ToString) Then Me.AssignedToGroup.Items(0).Text = TableRow("AssignedToGroup").ToString End If If Not IsDBNull(TableRow("AssignedTo").ToString) Then Me.AssignedTo.Items(0).Text = TableRow("AssignedTo").ToString End If If Me.AssignedToGroup.SelectedItem.Value <> "" Then Dim CurrentAgent As String If Not IsDBNull(TableRow("AssignedTo").ToString) Then Me.AssignedTo.Items(0).Text = TableRow("AssignedTo").ToString Else Me.AssignedTo.Items(0).Text = " " End If Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EAGet("GroupMembers, Groups, Agents", "GroupMembers.AgentID, Agents.AssignedIncidents, Agents.Name", "GroupName='" & Me.AssignedToGroup.SelectedItem.Value & "' And Agents.AgentStatus = 'Available' And GroupMembers.GroupID = Groups.GroupID And GroupMembers.AgentID = Agents.AgentID ", 200, "GroupMembers.AgentID", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) CurrentAgent = Me.AssignedTo.Items(0).Text Me.AssignedTo.Items.Clear() Me.AssignedTo.Items.Add(CurrentAgent) For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("AgentID")) Then If TableRow2("AgentID").ToString <> CurrentAgent Then Me.AssignedTo.Items.Add(TableRow2("AgentID").ToString) End If End If Next BizDataSet2.Dispose() Objrs2 = Nothing Me.AssignedTo.Items.Add(" ") Me.AssignedTo.Items(0).Text = CurrentAgent End If If Not IsDBNull(TableRow("Product").ToString) Then Me.Product.Items.Clear() Me.Product.Items.Add(TableRow("Product").ToString) Me.Product.Items.Add(" ") Objrs2 = Server.CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EAGet("Categorizations", "Product", "(EAModule='Incident' or EAModule = '' or EAModule is Null) and ((Company is NULL or Company = '') or (Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "')))) Group by Product", 9999, "Product Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("Product").ToString) Then Me.Product.Items.Add(TableRow2("Product").ToString) End If Next BizDataSet2.Dispose() Objrs2 = Nothing If Not IsDBNull(TableRow("Product").ToString) Then Me.Product.Items(0).Value = TableRow("Product").ToString End If Else Me.Product.Items.Add(" ") End If If Not IsDBNull(TableRow("Version").ToString) And Me.Product.SelectedItem.Text <> " " Then Dim SelectedProduct As String SelectedProduct = Replace(Me.Product.SelectedItem.Text, "'", "''") Me.Version.Items.Clear() Me.Version.Items.Add(TableRow("Version").ToString) Me.Version.Items.Add(" ") Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EASelect("Select Distinct Version from Categorizations where Product = '" & SelectedProduct & "' And (EAModule = 'Incident' or EAModule = '' or EAModule Is Null)", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("Version").ToString) Then Me.Version.Items.Add(TableRow2("Version").ToString) End If Next BizDataSet2.Dispose() Objrs2 = Nothing Else Me.Version.Items.Add(" ") End If If Not IsDBNull(TableRow("Platform").ToString) And Me.Product.SelectedItem.Text <> " " And Me.Version.SelectedItem.Text <> " " Then Me.Platform.Items.Clear() Me.Platform.Items.Add(TableRow("Platform").ToString) Me.Platform.Items.Add(" ") Dim sdata(4) As Object If Me.Product.SelectedItem.Value <> " " Then sdata(0) = Replace(Me.Product.SelectedItem.Text, "'", "''") End If If Me.Version.SelectedItem.Value <> " " Then sdata(1) = Replace(Me.Version.SelectedItem.Text, "'", "''") End If sdata(2) = " " sdata(3) = " " Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EASelect("Select Distinct Platform from Categorizations where Product = '" & sdata(0) & "' and Version = '" & sdata(1) & "' And ( EAModule = 'Incident' or EAModule = '' or EAModule Is Null )", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("Platform").ToString) Then Me.Platform.Items.Add(TableRow2("Platform").ToString) End If Next BizDataSet2.Dispose() Objrs2 = Nothing Else Me.Platform.Items.Add(" ") End If If Not IsDBNull(TableRow("DB").ToString) And Me.Product.SelectedItem.Text <> " " And Me.Version.SelectedItem.Text <> " " And Me.Platform.SelectedItem.Text <> " " Then Me.Database.Items.Clear() Me.Database.Items.Add(TableRow("DB").ToString) Me.Database.Items.Add(" ") Dim sdata(4) As Object sdata(0) = Replace(Me.Product.SelectedItem.Text, "'", "''") sdata(1) = Replace(Me.Version.SelectedItem.Text, "'", "''") sdata(2) = Replace(Me.Platform.SelectedItem.Text, "'", "''") sdata(3) = "" Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EASelect("Select Distinct DB from Categorizations where Product = '" & sdata(0) & "' and Version = '" & sdata(1) & "' and Platform = '" & sdata(2) & "' And (EAModule = 'Incident' or EAModule = '' or EAModule Is Null)", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("DB").ToString) Then Me.Database.Items.Add(TableRow2("DB").ToString) End If Next BizDataSet2.Dispose() Objrs2 = Nothing If Session.Item("GroupAssignments") = "Enabled" Then 'Do the Group Assignment sdata(0) = Me.Product.SelectedItem.Value sdata(1) = Me.Version.SelectedItem.Value sdata(2) = Me.Platform.SelectedItem.Value sdata(3) = "" Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.getAssignToGroup("Incident", sdata, Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Me.AssignedToGroup.Items.Add(" ") For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("GroupName").ToString) Then Me.AssignedToGroup.Items.Add(TableRow2("GroupName").ToString) End If Next BizDataSet2.Dispose() Objrs2 = Nothing End If Else Me.Database.Items.Add(" ") End If 'Get the contacts list of Assets Me.AssetDropDownList.Items.Clear() If Not IsDBNull(TableRow("IncidentAssetID").ToString) Then Me.AssetDropDownList.Items.Add(" ") Me.AssetDropDownList.Items.Add(" ") Me.AssetDropDownList.Items(0).Text = TableRow("IncidentAssetID").ToString Else Me.AssetDropDownList.Items.Add(" ") End If Objrs2 = CreateObject("BizClass.NET") If Session.Item("LoginType") = "Contact" Or Session.Item("LoginType") = "LDAP-Contact" Then BizDataSet2 = Objrs2.EAGet("Asset", "Asset", "Owner = '" & Replace(Session.Item("LoginID"), "'", "''") & "'", 999, "Asset Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Else BizDataSet2 = Objrs2.EAGet("Asset", "Asset", "Owner = '" & Replace(Me.ContactID.SelectedItem.Value, "'", "''") & "'", 999, "Asset Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) End If For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("Asset").ToString) Then Me.AssetDropDownList.Items.Add(TableRow2("Asset").ToString) End If Next BizDataSet2.Dispose() Objrs2 = Nothing 'Re-Populates the Company Dropdown with all records Me.CompanyDropDownList.Items.Clear() If Not IsDBNull(TableRow("CompanyName").ToString) Then Me.CompanyDropDownList.Items.Add(New ListItem(TableRow("CompanyName").ToString, TableRow("CompanyName").ToString)) End If Me.CompanyDropDownList.Items.Add(New ListItem("", "")) Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EAGet("Company", "CompanyName", "1=1", 99999, "CompanyName", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow2 In BizDataSet2.Tables(0).Rows Me.CompanyDropDownList.Items.Add(New ListItem(TableRow2("CompanyName").ToString, TableRow2("CompanyName").ToString)) Next BizDataSet2.Dispose() Objrs2 = Nothing 'Re-populate the BusinessUnit Dropdown Me.BusinessUnit.Items.Clear() If Not IsDBNull(TableRow("BusinessUnit").ToString) Then Me.BusinessUnit.Items.Add(New ListItem(TableRow("BusinessUnit").ToString, TableRow("BusinessUnit").ToString)) End If 'Populates the BusinessUnit Dropdown with all records that are related to this company If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then If Trim(Me.CompanyDropDownList.SelectedItem.Text) <> "" Then IdentitySearchCriteria = "CompanyName = '" & Replace(Me.CompanyDropDownList.SelectedItem.Text, "'", "''") & "'" Else IdentitySearchCriteria = "(CompanyID = 0 or CompanyID Is Null) " End If End If Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EAGet("BusinessUnit", "BusinessUnitName", IdentitySearchCriteria, 99999, "BusinessUnitName", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("BusinessUnitName").ToString) Then Me.BusinessUnit.Items.Add(New ListItem(TableRow2("BusinessUnitName").ToString, TableRow2("BusinessUnitName").ToString)) End If Next BizDataSet2.Dispose() Objrs2 = Nothing Me.BusinessUnit.Items.Add(New ListItem("", "")) 'Re-Populate the SiteID dropdown Me.SiteDropDownList.Items.Clear() If Not IsDBNull(TableRow("Site").ToString) Then Me.SiteDropDownList.Items.Add(New ListItem(TableRow("Site").ToString, TableRow("Site").ToString)) End If 'Get all the Sites that belong to the Company and Business Unit If Not IsNothing(Me.BusinessUnit.SelectedItem) Then If Trim(Me.BusinessUnit.SelectedItem.Text) <> "" Then If Len(IdentitySearchCriteria) = 0 Then IdentitySearchCriteria = " BusinessUnitName = '" & Replace(Me.BusinessUnit.SelectedItem.Text, "'", "''") & "'" Else IdentitySearchCriteria = IdentitySearchCriteria & " And BusinessUnitName = '" & Replace(Me.BusinessUnit.SelectedItem.Text, "'", "''") & "'" End If End If End If Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EAGet("Site", "SiteName", IdentitySearchCriteria, 99999, "SiteName", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("SiteName").ToString) And Not IsDBNull(TableRow2("SiteName").ToString) Then Me.SiteDropDownList.Items.Add(New ListItem(TableRow2("SiteName").ToString, TableRow2("SiteName").ToString)) End If Next BizDataSet2.Dispose() Objrs2 = Nothing Me.SiteDropDownList.Items.Add(New ListItem("", "")) 'Re-Populate the Organization dropdown Me.Organization.Items.Clear() If Not IsDBNull(TableRow("Organization").ToString) Then Me.Organization.Items.Add(New ListItem(TableRow("Organization").ToString, TableRow("Organization").ToString)) End If If Not IsNothing(Me.SiteDropDownList.SelectedItem) Then If Trim(Me.SiteDropDownList.SelectedItem.Text) <> "" Then If Len(IdentitySearchCriteria) = 0 Then IdentitySearchCriteria = " SiteName = '" & Replace(Me.SiteDropDownList.SelectedItem.Text, "'", "''") & "'" Else IdentitySearchCriteria = IdentitySearchCriteria & " And SiteName = '" & Replace(Me.SiteDropDownList.SelectedItem.Text, "'", "''") & "'" End If End If Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EAGet("Organization", "OrganizationName", IdentitySearchCriteria, 99999, "OrganizationName", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("OrganizationName").ToString) Then Me.Organization.Items.Add(New ListItem(TableRow2("OrganizationName").ToString, TableRow2("OrganizationName").ToString)) End If Next BizDataSet2.Dispose() Objrs2 = Nothing Me.Organization.Items.Add(New ListItem("", "")) End If 'Re-Populate the Department dropdown Me.Department.Items.Clear() If Not IsDBNull(TableRow("Department").ToString) Then Me.Department.Items.Add(New ListItem(TableRow("Department").ToString, TableRow("Department").ToString)) End If If Not IsNothing(Me.Organization.SelectedItem) Then If Trim(Me.Organization.SelectedItem.Text) <> "" Then If Len(IdentitySearchCriteria) = 0 Then IdentitySearchCriteria = " OrganizationName = '" & Replace(Me.Organization.SelectedItem.Text, "'", "''") & "'" Else IdentitySearchCriteria = IdentitySearchCriteria & " And OrganizationName = '" & Replace(Me.Organization.SelectedItem.Text, "'", "''") & "'" End If End If Objrs2 = CreateObject("BizClass.NET") BizDataSet2 = Objrs2.EAGet("Department", "DepartmentName", IdentitySearchCriteria, 99999, "DepartmentName", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) For Each TableRow2 In BizDataSet2.Tables(0).Rows If Not IsDBNull(TableRow2("DepartmentName").ToString) Then Me.Department.Items.Add(New ListItem(TableRow2("DepartmentName").ToString, TableRow2("DepartmentName").ToString)) End If Next BizDataSet2.Dispose() Objrs2 = Nothing End If Me.Department.Items.Add(New ListItem("", "")) BizDataSet.Dispose() Objrs = Nothing If CheckPermissions(Replace(Session.Item("LoginID"), "'", "''"), "Modify", "Incident") = False Then Me.SaveIncident.Enabled = False End If 'Populate the Product Dropdown of only valid Entries for the Company or the logged in users Group Membership Dim UniqueValue As String Dim OldProductValue As String If Not IsNothing(Me.Product.SelectedItem) Then OldProductValue = Me.Product.SelectedItem.Text End If Me.Product.Items.Clear() Me.Product.Items.Add(OldProductValue) Me.Product.Items.Add(" ") UniqueValue = "" Objrs = Server.CreateObject("BizClass.NET") 'Get the list of valid Products / Tier1 Categorizations for the selected Company or the Logged in users Group Membership If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then BizDataSet = Objrs.EAGet("Categorizations", "Product", "(EAModule='Incident' or EAModule = '' or EAModule is Null) and ((Company = '" & Replace(Me.CompanyDropDownList.SelectedItem.Text, "'", "''") & "' or Company is NULL or Company = '') Or (Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "')))) Group by Product", 9999, "Product Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Else BizDataSet = Objrs.EAGet("Categorizations", "Product", "(EAModule='Incident' or EAModule = '' or EAModule is Null) and ((Company is NULL or Company = '') or (Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "' Group by Product)))) Group by Product", 9999, "Product Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) End If For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("Product").ToString) Then If UniqueValue <> TableRow("Product").ToString Then Me.Product.Items.Add(TableRow("Product").ToString) End If UniqueValue = TableRow("Product").ToString End If Next BizDataSet.Dispose() Objrs = Nothing Me.SaveIncident.Text = Application(Session.Item("Language") & " Modify Incident") Me.DeleteIncident.Enabled = True Me.CreateProblem.Enabled = True Me.RelateToProblem.Enabled = True Me.PrintIncident.Enabled = True If Me.CreateKB.Text = Application(Session.Item("Language") & " Create Knowledge") Then Me.CreateKB.Enabled = True End If 'Set the Indicator that there are worklogs for this Incident Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("IncidentWorkLog", "IncidentID", "IncidentID = " & Me.IncidentID.Text, 999, "WorkLogDate Desc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Dim datasetcount As Integer datasetcount = BizDataSet.Tables(0).Rows.Count If BizDataSet.Tables(0).Rows.Count > 0 Then Me.Worklogs.ForeColor = System.Drawing.Color.DarkBlue Me.Worklogs.Font.Bold = True If BizDataSet.Tables(0).Rows.Count = 1 Then Me.Worklogs.Text = BizDataSet.Tables(0).Rows.Count & " Worklog" Else Me.Worklogs.Text = BizDataSet.Tables(0).Rows.Count & " Worklogs" End If End If BizDataSet.Dispose() Objrs = Nothing 'Set the Indicator that there are Attachments for this Incident Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Attachments", "EAModuleID", "EAModule = 'Incident' and EAModuleID = " & Me.IncidentID.Text, 999, "EAModuleID Desc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If BizDataSet.Tables(0).Rows.Count > 0 Then Me.Attach.ForeColor = System.Drawing.Color.DarkBlue Me.Attach.Font.Bold = True If BizDataSet.Tables(0).Rows.Count = 1 Then Me.Attach.Text = BizDataSet.Tables(0).Rows.Count & " Attachment" Else Me.Attach.Text = BizDataSet.Tables(0).Rows.Count & " Attachments" End If End If BizDataSet.Dispose() Objrs = Nothing 'Set the Indicator that there are Approvals for this Incident Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Approval", "ApprovalID", "EAModule = 'Incident' and EAModuleID = " & Me.IncidentID.Text, 999, "EAModuleID Desc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If BizDataSet.Tables(0).Rows.Count > 0 Then Me.Approvals.ForeColor = System.Drawing.Color.DarkBlue Me.Approvals.Font.Bold = True If BizDataSet.Tables(0).Rows.Count = 1 Then Me.Approvals.Text = BizDataSet.Tables(0).Rows.Count & " Approval" Else Me.Approvals.Text = BizDataSet.Tables(0).Rows.Count & " Approvals" End If End If BizDataSet.Dispose() Objrs = Nothing 'Set the Indicator that there are Service Request Fields for this Incident Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Attribute", "AttributeID", "EAModule = 'Incident' and EAModuleID = " & Me.IncidentID.Text, 999, "EAModuleID Desc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If BizDataSet.Tables(0).Rows.Count > 0 Then Me.Attributes.ForeColor = System.Drawing.Color.DarkBlue Me.Attributes.Font.Bold = True If BizDataSet.Tables(0).Rows.Count = 1 Then Me.Attributes.Text = BizDataSet.Tables(0).Rows.Count & " Service Request Field" Else Me.Attributes.Text = BizDataSet.Tables(0).Rows.Count & " Service Request Fields" End If End If BizDataSet.Dispose() Objrs = Nothing 'Set the Indicator that there are Impacted Areas for this Incident Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("ImpactedArea", "ImpactedAreaID", "EAModule = 'Incident' and EAModuleID = " & Me.IncidentID.Text, 999, "EAModuleID Desc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If BizDataSet.Tables(0).Rows.Count > 0 Then Me.ImpactedAreas.ForeColor = System.Drawing.Color.DarkBlue Me.ImpactedAreas.Font.Bold = True If BizDataSet.Tables(0).Rows.Count = 1 Then Me.ImpactedAreas.Text = BizDataSet.Tables(0).Rows.Count & " Impacted Area" Else Me.ImpactedAreas.Text = BizDataSet.Tables(0).Rows.Count & " Impacted Areas" End If End If BizDataSet.Dispose() Objrs = Nothing End If Call SetLoginView() If Session.Item("StartNewIncident") = "True" Then ClearIncident() Session.Remove("StartNewIncident") Session.Add("StartNewIncident", "False") End If If Session.Item("QuickTicket") = "True" Then Me.SaveIncident.Text = Application(Session.Item("Language") & " Save Incident") Me.IncidentID.Text = "" Me.IncidentLabel.Text = "" Session.Remove("QuickTicket") Session.Remove("RecordLockIncidentIDTryAndGetLock") End If If Not IsNothing(Session.Item("IncidentLocked")) Then If Session.Item("IncidentLocked") = "True" Then Me.Worklogs.Enabled = True Me.Attach.Enabled = True Me.Audit.Enabled = True Me.IncidentAssociations.Enabled = True Me.Resolution.Enabled = True Me.ImpactedAreas.Enabled = True End If End If If Me.Page.IsPostBack = False Then Call RestoreDirtyData() End If Dim ForceCategorizations ForceCategorizations = Session.Item("ForceCategorization") If ForceCategorizations = "Enabled" Then Me.ProductLabel.Font.Bold = True Me.VersionLabel.Font.Bold = True Me.Platformlabel.Font.Bold = True Me.DatabaseLabel.Font.Bold = True End If 'If this is a redirect because a contact was selected from the Contact page, populate the data If Session.Item("AddContactToIncident") = True Then Me.ContactID.SelectedIndex = 0 Me.ContactID.SelectedItem.Text = Session.Item("SelectedContactID") Me.FirstName.Text = Session.Item("SelectedContactFirstName") Me.LastName.Text = Session.Item("SelectedContactLastName") Me.EMail.Text = Session.Item("SelectedContactEMail") Me.Address.Text = Session.Item("SelectedContactAddress") Me.Phone.Text = Session.Item("SelectedContactPhone") Me.City.Text = Session.Item("SelectedContactCity") Me.State.SelectedIndex = 0 Me.State.SelectedItem.Text = Session.Item("SelectedContactState") Me.State.SelectedItem.Value = Session.Item("SelectedContactState") Me.CompanyDropDownList.SelectedIndex = 0 Me.CompanyDropDownList.SelectedItem.Text = Session.Item("SelectedContactCompany") Me.Zip.Text = Session.Item("SelectedContactZip") If Me.Department.Items.Count < 1 Then Me.Department.Items.Add("") End If Me.Department.SelectedIndex = 0 Me.Department.SelectedItem.Text = Session.Item("SelectedContactDepartment") If Me.SiteDropDownList.Items.Count < 1 Then Me.SiteDropDownList.Items.Add("") End If Me.SiteDropDownList.SelectedIndex = 0 Me.SiteDropDownList.SelectedItem.Text = Session.Item("SelectedContactOffice") Session.Remove("AddContactToIncident") End If If Session.Item("IsAdmin") = True Then Me.QuickTicket.Enabled = True Else Me.QuickTicket.Enabled = False End If exit_here: End Sub Private Sub SearchButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchButton.Click If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If Session.Remove("JustLoggedIn") Session.Add("JustLoggedIn", "True") Call SaveDirtyData() Response.Redirect("Search.aspx") exit_here: End Sub Private Sub Contact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If SaveDirtyData() Response.Redirect("Contact.aspx") exit_here: End Sub Private Sub Company_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If SaveDirtyData() Response.Redirect("Company.aspx") exit_here: End Sub Private Sub WhiteBoard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If SaveDirtyData() Response.Redirect("Whiteboard.aspx") exit_here: End Sub Private Sub SaveIncident_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveIncident.Click If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If If Session.Item("LoggedIn") Is Nothing Then Response.Redirect("Login.aspx?SessionTimeout=True") End If If CheckPermissions(Replace(Session.Item("LoginID"), "'", "''"), "Create", "Incident") = False Then Me.ErrorMessage.Text = "" Exit Sub End If Dim incidentSTR(255) As Object Dim objCommand Dim updateCriteria Dim Agent As String Dim objrs Dim cmd Dim IncidentNumber As VariantType Dim BizDataSet As DataSet Dim TableRow As DataRow Dim CurrentTime As DateTime Dim USCurrentTime As String 'Check for required fields If Trim(Me.FirstName.Text) = "" Then Me.ErrorMessage.Text = "" SetFocus(Me.FirstName) Exit Sub End If If Trim(Me.LastName.Text) = "" Then Me.ErrorMessage.Text = "" SetFocus(Me.LastName) Exit Sub End If If Trim(Me.Phone.Text) = "" Then Me.ErrorMessage.Text = "" SetFocus(Me.Phone) Exit Sub End If If Trim(Me.EMail.Text) = "" Then Me.ErrorMessage.Text = "" SetFocus(Me.EMail) Exit Sub End If If Trim(Me.Status.SelectedItem.Text) = "" Then Me.ErrorMessage.Text = "" SetFocus(Me.Status) Exit Sub End If If Trim(Me.Priority.SelectedItem.Text) = "" Or IsNothing(Me.Priority.SelectedItem) Then Me.ErrorMessage.Text = "" SetFocus(Me.Priority) Exit Sub End If If Trim(Me.Summary.Text) = "" Then Me.ErrorMessage.Text = "" SetFocus(Me.Summary) Exit Sub End If If Me.StartDate.Text <> "" Then If Not IsDate(Me.StartDate.Text) Then Me.ErrorMessage.Text = "" SetFocus(Me.StartDate) Exit Sub End If End If If Not IsNumeric(Me.Sequence.Text) And Trim(Me.Sequence.Text <> "") Then Me.ErrorMessage.Text = "" SetFocus(Me.Sequence) Exit Sub End If If InStr(Me.Sequence.Text, ".") > 0 Or InStr(Me.Sequence.Text, ",") > 0 Then Me.ErrorMessage.Text = "" SetFocus(Me.Sequence) Exit Sub End If If Not IsNothing(Me.StartDate.Text) And Not IsNothing(Me.AssignedDate.Text) And Me.AssignedDate.Text <> "" And Me.StartDate.Text <> "" Then If DateDiff("s", Me.StartDate.Text, Me.AssignedDate.Text) < 0 Then Me.ErrorMessage.Text = "" SetFocus(Me.StartDate) Exit Sub End If End If Dim ForceCategorizations ForceCategorizations = Session.Item("ForceCategorization") If ForceCategorizations = "Enabled" Then If Trim(Me.Product.SelectedItem.Text) = "" Then Me.ErrorMessage.Text = "" SetFocus(Me.Product) Exit Sub End If End If 'Check to make sure this is a valid Status Transition if the status has changed or initial create If Not IsNothing(Session.Item("OriginalIncidentStatus")) Or Me.IncidentID.Text = "" Then If (Me.IncidentID.Text <> "" And Trim(Session.Item("OriginalIncidentStatus")) <> Me.Status.SelectedItem.Text) Or Me.IncidentID.Text = "" Then Dim ValidTransition As Boolean objCommand = CreateObject("BizClass.NET") ValidTransition = objCommand.CheckStatusTransition("Incident", Me.IncidentID.Text, Me.Status.SelectedItem.Text, Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objCommand = Nothing If ValidTransition = False Then Me.ErrorMessage.Text = "" SetFocus(Me.Status) Exit Sub End If End If End If If Me.ContactID.SelectedItem.Value = "" Or IsNothing(Me.ContactID.SelectedItem) Then incidentSTR(0) = "ContactID = '" & Trim(Replace(Me.FirstName.Text, "'", "''")) & " " & Trim(Replace(Me.LastName.Text, "'", "''")) & "'" Else incidentSTR(0) = "ContactID = '" & Replace(Me.ContactID.SelectedItem.Value, "'", "''") & "'" End If incidentSTR(1) = "FirstName = '" & Replace(Me.FirstName.Text, "'", "''") & "'" incidentSTR(2) = "LastName = '" & Replace(Me.LastName.Text, "'", "''") & "'" incidentSTR(3) = "Address = '" & Replace(Me.Address.Text, "'", "''") & "'" incidentSTR(4) = "City = '" & Replace(Me.City.Text, "'", "''") & "'" incidentSTR(5) = "State = '" & Replace(Me.State.SelectedItem.Value, "'", "''") & "'" incidentSTR(6) = "Zip = '" & Replace(Me.Zip.Text, "'", "''") & "'" If Not IsNothing(Me.Priority.SelectedItem) Then If Trim(Me.Priority.SelectedItem.Value) <> "" Then incidentSTR(7) = "Priority = " & Me.Priority.SelectedItem.Value End If End If If Not IsNothing(Me.Impact.SelectedItem) Then If Trim(Me.Impact.SelectedItem.Text) <> "" Then incidentSTR(8) = "Impact = '" & Me.Impact.SelectedItem.Text & "'" Else incidentSTR(8) = "Impact = Null" End If End If If Not IsNothing(Me.Urgency.SelectedItem) Then If Trim(Me.Urgency.SelectedItem.Text) <> "" Then incidentSTR(9) = "Urgency = '" & Me.Urgency.SelectedItem.Text & "'" Else incidentSTR(9) = "Urgency = Null" End If End If If Not IsNothing(Me.ServiceType.SelectedItem) Then If Trim(Me.ServiceType.SelectedItem.Text) <> "" Then incidentSTR(10) = "ServiceType = '" & Me.ServiceType.SelectedItem.Text & "'" Else incidentSTR(10) = "ServiceType = Null" End If End If If Not IsNothing(Me.Status.SelectedItem) Then incidentSTR(11) = "Status = '" & Replace(Me.Status.SelectedItem.Text, "'", "''") & "'" End If If Not IsNothing(Me.BusinessUnit.SelectedItem) Then incidentSTR(12) = "BusinessUnit = '" & Replace(Me.BusinessUnit.SelectedItem.Text, "'", "''") & "'" End If If Not IsNothing(Me.SiteDropDownList.SelectedItem) Then incidentSTR(13) = "Site = '" & Replace(Me.SiteDropDownList.SelectedItem.Text, "'", "''") & "'" End If If Not IsNothing(Me.Organization.SelectedItem) Then incidentSTR(14) = "Organization = '" & Replace(Me.Organization.SelectedItem.Text, "'", "''") & "'" End If If Not IsNothing(Me.Department.SelectedItem) Then incidentSTR(15) = "Department = '" & Replace(Me.Department.SelectedItem.Text, "'", "''") & "'" End If If Not IsNothing(Me.Manager.SelectedItem) Then incidentSTR(16) = "Manager = '" & Replace(Me.Manager.SelectedItem.Text, "'", "''") & "'" End If If Not IsNothing(Me.VendorSLA.SelectedItem) Then incidentSTR(17) = "VendorSLA = '" & Replace(Me.VendorSLA.SelectedItem.Text, "'", "''") & "'" End If If Not IsNothing(Me.StatusReason.SelectedItem) Then incidentSTR(18) = "StatusReason = '" & Replace(Me.StatusReason.SelectedItem.Text, "'", "''") & "'" End If If Not IsNothing(Me.SLA.SelectedItem) Then incidentSTR(19) = "SLAName = '" & Replace(Me.SLA.SelectedItem.Text, "'", "''") & "'" Else incidentSTR(19) = "SLAName = 'Default SLA'" Me.SLA.Items(0).Text = "Default SLA" End If If Not IsNothing(Me.Product.SelectedItem) Then If Me.Product.SelectedItem.Value <> " " Then incidentSTR(20) = "Product = '" & Replace(Me.Product.SelectedItem.Value, "'", "''") & "'" Else incidentSTR(20) = "Product = ''" End If End If If Not IsNothing(Me.Version.SelectedItem) Then If Me.Version.SelectedItem.Value <> " " Then incidentSTR(21) = "Version = '" & Replace(Me.Version.SelectedItem.Value, "'", "''") & "'" Else incidentSTR(21) = "Version = ''" End If End If If Not IsNothing(Me.Platform.SelectedItem) Then If Me.Platform.SelectedItem.Value <> " " Then incidentSTR(22) = "Platform = '" & Replace(Me.Platform.SelectedItem.Value, "'", "''") & "'" Else incidentSTR(22) = "Platform = ''" End If End If If Not IsNothing(Me.Database.SelectedItem) Then If Me.Database.SelectedItem.Value <> " " Then incidentSTR(23) = "DB = '" & Replace(Me.Database.SelectedItem.Value, "'", "''") & "'" Else incidentSTR(23) = "DB = ''" End If End If incidentSTR(24) = "Summary = '" & Replace(Me.Summary.Text, "'", "''") & "'" incidentSTR(25) = "ContactPhone = '" & Replace(Me.Phone.Text, "'", "''") & "'" incidentSTR(26) = "VendorPhone = '" & Replace(Me.VendorPhone.Text, "'", "''") & "'" incidentSTR(27) = "VendorEmail = '" & Replace(Me.VendorEmail.Text, "'", "''") & "'" incidentSTR(28) = "VendorContact = '" & Replace(Me.VendorContact.SelectedItem.Text, "'", "''") & "'" incidentSTR(30) = "Ticket = '" & Replace(Me.Ticket.Text, "'", "''") & "'" incidentSTR(31) = "ContactEMail = '" & Replace(Me.EMail.Text, "'", "''") & "'" If Not IsNothing(Me.AssignedTo.SelectedItem) Then If Trim(Me.AssignedTo.SelectedItem.Text) <> "" Then incidentSTR(32) = "AssignedTo = '" & Replace(Me.AssignedTo.SelectedItem.Text, "'", "''") & "'" Else incidentSTR(32) = "AssignedTo = ''" End If End If If Not IsNothing(Me.AssignedToGroup.SelectedItem) Then If Trim(Me.AssignedToGroup.SelectedItem.Text) <> "" Then incidentSTR(33) = "AssignedToGroup = '" & Replace(Me.AssignedToGroup.SelectedItem.Text, "'", "''") & "'" Else incidentSTR(33) = "AssignedToGroup = ''" End If End If If Not IsNothing(Me.AssetDropDownList.SelectedItem) Then If Trim(Me.AssetDropDownList.SelectedItem.Text) <> "" Then incidentSTR(37) = "IncidentAssetID = '" & Replace(Me.AssetDropDownList.SelectedItem.Value, "'", "''") & "'" Else incidentSTR(37) = "IncidentAssetID = ''" End If End If If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then If Trim(Me.CompanyDropDownList.SelectedItem.Text) <> "" Then incidentSTR(38) = "CompanyName = '" & Replace(Me.CompanyDropDownList.SelectedItem.Text, "'", "''") & "'" Else incidentSTR(38) = "CompanyName = ''" End If Else incidentSTR(38) = "CompanyName = ''" End If If Trim(Me.Sequence.Text) <> "" And Not IsNothing(Me.Sequence) Then incidentSTR(39) = "Sequence = " & Replace(Me.Sequence.Text, "'", "''") Else incidentSTR(39) = "Sequence = NULL" End If If Trim(Me.AssignedDate.Text).Length <> 0 And IsDate(Me.AssignedDate.Text) Then USCurrentTime = "" USCurrentTime = Year(Me.AssignedDate.Text) & "-" & Month(Me.AssignedDate.Text) & "-" & Day(Me.AssignedDate.Text) & " " & Hour(Me.AssignedDate.Text) & ":" & Minute(Me.AssignedDate.Text) & ":" & Second(Me.AssignedDate.Text) incidentSTR(40) = "AssignedDate = '" & Trim(USCurrentTime) & "'" Else incidentSTR(40) = "AssignedDate = NULL" End If If Trim(Me.StartDate.Text).Length <> 0 And IsDate(Me.StartDate.Text) Then USCurrentTime = "" USCurrentTime = Year(Me.StartDate.Text) & "-" & Month(Me.StartDate.Text) & "-" & Day(Me.StartDate.Text) & " " & Hour(Me.StartDate.Text) & ":" & Minute(Me.StartDate.Text) & ":" & Second(Me.StartDate.Text) incidentSTR(41) = "StartDate = '" & Trim(USCurrentTime) & "'" Else Me.StartDate.Text = Now() incidentSTR(41) = "StartDate = '" & Year(Me.StartDate.Text) & "-" & Month(Me.StartDate.Text) & "-" & Day(Me.StartDate.Text) & " " & Hour(Me.StartDate.Text) & ":" & Minute(Me.StartDate.Text) & ":" & Second(Me.StartDate.Text) & "'" End If If Me.Status.SelectedItem.Text = "Closed" Or Me.Status.SelectedItem.Text = "Resolved" Then If Trim(Me.ResolutionDate.Text) = "" Then Me.ResolutionDate.Text = Now() End If End If If Trim(Me.ResolutionDate.Text).Length <> 0 And IsDate(Me.ResolutionDate.Text) Then USCurrentTime = "" USCurrentTime = Year(Me.ResolutionDate.Text) & "-" & Month(Me.ResolutionDate.Text) & "-" & Day(Me.ResolutionDate.Text) & " " & Hour(Me.ResolutionDate.Text) & ":" & Minute(Me.ResolutionDate.Text) & ":" & Second(Me.ResolutionDate.Text) incidentSTR(42) = "ResolutionDate = '" & Trim(USCurrentTime) & "'" Else incidentSTR(42) = "ResolutionDate = NULL" End If If Not IsNothing(Session.Item("IncidentResolution")) Then incidentSTR(49) = "ResolutionSummary = '" & Replace(Session.Item("IncidentResolution"), "'", "''") & "'" End If 'Calculate the Call Duration if the Incident is Resolved or Closed If Me.Status.SelectedItem.Value = "Closed" Or Me.Status.SelectedItem.Value = "Resolved" Then If Me.StartDate.Text <> "" And Not IsNothing(Me.StartDate.Text) And Me.ResolutionDate.Text <> "" And Not IsNothing(Me.ResolutionDate.Text) Then Dim CurrentStartDate As Date Dim CurrentEndDate As Date Dim objcmd Dim CurrentDuration As Double Dim CurrentSLA As String CurrentStartDate = Me.StartDate.Text CurrentEndDate = Me.ResolutionDate.Text CurrentSLA = Me.SLA.SelectedItem.Value If CurrentSLA = " " Then CurrentSLA = "Default SLA" End If objcmd = CreateObject("BizClass.NET") CurrentDuration = objcmd.CalculateOutage(CurrentStartDate, CurrentEndDate, CurrentSLA) objcmd = Nothing Me.Duration.Text = CurrentDuration / 60 incidentSTR(43) = "CallDuration = " & Replace(Me.Duration.Text, ",", ".") End If End If incidentSTR(44) = "VendorName = '" & Replace(Me.Vendor.SelectedItem.Text, "'", "''") & "'" Me.Submitter.Text = Session.Item("LoginID") Agent = Session.Item("LoginID") If Me.IncidentID.Text = "" Then If Trim(System.DateTime.Now).Length <> 0 And IsDate(System.DateTime.Now) Then USCurrentTime = "" USCurrentTime = Year(System.DateTime.Now) & "-" & Month(System.DateTime.Now) & "-" & Day(System.DateTime.Now) & " " & Hour(System.DateTime.Now) & ":" & Minute(System.DateTime.Now) & ":" & Second(System.DateTime.Now) incidentSTR(45) = "CreateDate = '" & Trim(USCurrentTime) & "'" End If USCurrentTime = "" USCurrentTime = Year(System.DateTime.Now) & "-" & Month(System.DateTime.Now) & "-" & Day(System.DateTime.Now) & " " & Hour(System.DateTime.Now) & ":" & Minute(System.DateTime.Now) & ":" & Second(System.DateTime.Now) incidentSTR(46) = "Submitter = '" & Replace(Session.Item("LoginID"), "'", "''") & "'" incidentSTR(47) = "LastModifiedBy = '" & Replace(Session.Item("LoginID"), "'", "''") & "'" incidentSTR(48) = "LastModifiedDate = '" & Trim(USCurrentTime) & "'" objCommand = CreateObject("BizClass.NET") cmd = objCommand.EASave("Incident", "IncidentID", incidentSTR, Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objCommand = Nothing Me.IncidentID.Text = cmd Me.IncidentLabel.Text = Application(Session.Item("Language") & " Incident") & " " & cmd Session.Add("RecordLockIncidentIDTryAndGetLock", cmd) Session.Add("RecordLockIncidentID", cmd) Else USCurrentTime = "" USCurrentTime = Year(System.DateTime.Now) & "-" & Month(System.DateTime.Now) & "-" & Day(System.DateTime.Now) & " " & Hour(System.DateTime.Now) & ":" & Minute(System.DateTime.Now) & ":" & Second(System.DateTime.Now) incidentSTR(47) = "LastModifiedBy = '" & Replace(Session.Item("LoginID"), "'", "''") & "'" incidentSTR(48) = "LastModifiedDate = '" & Trim(USCurrentTime) & "'" updateCriteria = "IncidentID = " & Me.IncidentID.Text Dim UniqueID As VariantType UniqueID = Me.IncidentID.Text objrs = CreateObject("BizClass.NET") cmd = objrs.EAUpdate(UniqueID, "Incident", updateCriteria, Agent, incidentSTR, Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objrs = Nothing End If 'Set Application Variable indicating the database has been updated, expiring any existing rendered Search Results Application("IncidentDBTimestamp") = Now() Application("IncidentSubmitterSessionID") = Request("ASP.NET_SessionID") If cmd = -1 Then Me.ErrorMessage.Text = "" Exit Sub End If Dim objrc Dim rc As Boolean Dim AssignmentCount As Boolean Dim AgentID As String Dim IncidentIDLong As VariantType IncidentIDLong = Me.IncidentID.Text AgentID = Session.Item("LoginID") objrc = CreateObject("BizClass.NET") rc = objrc.CheckNotificationCriteria(IncidentIDLong, AgentID, "Incident", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objrc = Nothing objrc = CreateObject("BizClass.NET") cmd = objrc.checkSLA(IncidentIDLong, "Incident", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objrc = Nothing 'Now add any predefined Approvals that Qualify objrc = CreateObject("BizClass.NET") cmd = objrc.checkPreDefinedApprovals(IncidentIDLong, "Incident", AgentID, Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objrc = Nothing 'If Agent Assignments are enabled, and the Incident is not assigned, Assign it to a member of the group if it qualifies If Trim(Me.AssignedTo.SelectedItem.Text) = "" And Session.Item("AgentAssignments") = "Enabled" And Not IsNothing(Me.AssignedToGroup.SelectedItem.Text) And Trim(Me.AssignedToGroup.SelectedItem.Text) <> "" Then Dim Group As String Dim AssignToAgent As String Group = Me.AssignedToGroup.SelectedItem.Text objrc = CreateObject("BizClass.NET") AssignToAgent = objrc.AssignToAgent("Incident", IncidentIDLong, Group, Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objrc = Nothing End If If Session.Item("AgentAssignments") = "Enabled" Then objrc = CreateObject("BizClass.NET") AssignmentCount = objrc.checkAssignmentCount(Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) objrc = Nothing End If 'change the text on the buttons Me.SaveIncident.Text = Application(Session.Item("Language") & " Modify Incident") Me.DeleteIncident.Enabled = True Me.CreateProblem.Enabled = True Me.RelateToProblem.Enabled = True Me.PrintIncident.Enabled = True 'Me.CreateKB.Enabled = True Me.Worklogs.Enabled = True Me.IncidentAssociations.Enabled = True Me.Attach.Enabled = True Me.Audit.Enabled = True 'If the contact does not exist, and they are not getting the info via LDAP, create it If Session.Item("ContactViaLDAP") = "Disabled" Then Call AutoSaveContact() End If Call ClearDirtyData() 'Special code for Duration and Resolution Date which appears on the IncidenResolution.aspx page as well Session.Remove("IncidentWorklogDate") Session.Add("IncidentWorklogDate", Me.ResolutionDate.Text) Session.Remove("IncidentProblemDuration") Session.Add("IncidentProblemDuration", Me.Duration.Text) 'Refresh the record to get the worklog Session.Remove("RecordLockIncidentID") Session.Add("RecordLockIncidentID", Me.IncidentID.Text) Session.Remove("RecordLockIncidentIDTryAndGetLock") Session.Add("RecordLockIncidentIDTryAndGetLock", Me.IncidentID.Text) Response.Redirect("Incident.aspx") exit_here: End Sub Private Sub Product_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Product.SelectedIndexChanged 'Populate the Version Listbox If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If If Session.Item("LoggedIn") Is Nothing Then Response.Redirect("Login.aspx?SessionTimeout=True") End If Dim Objrs Dim SelectedProduct As String Dim CurrentVersion As String Dim sdata(4) As Object Dim BizDataSet As DataSet Dim TableRow As DataRow SelectedProduct = Me.Product.SelectedItem.Value Me.Version.Items.Clear() Me.Version.Items.Add(" ") Me.Platform.Items.Clear() Me.Platform.Items.Add(" ") Me.Database.Items.Clear() Me.Database.Items.Add(" ") 'Populate the Version Dropdown of only valid Entries for the Contact If Not IsNothing(Me.Product.SelectedItem) Then Dim UniqueValue As String Me.Version.Items.Clear() Me.Version.Items.Add(" ") UniqueValue = "" Objrs = Server.CreateObject("BizClass.NET") If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then BizDataSet = Objrs.EAGet("Categorizations", "Version", "(EAModule='Incident' or EAModule = '' or EAModule is Null) and (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And (Company = '" & Trim(Replace(Me.CompanyDropDownList.SelectedItem.Text, "'", "''")) & "' or Company is NULL or Company = '') or ( Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "'))))", 9999, "Version Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Else BizDataSet = Objrs.EAGet("Categorizations", "Version", "(EAModule='Incident' or EAModule = '' or EAModule is Null) and (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And (Company is NULL or Company = '') or ( Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "'))))", 9999, "Version Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) End If For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("Version").ToString) Then If UniqueValue <> TableRow("Version").ToString Then Me.Version.Items.Add(TableRow("Version").ToString) End If UniqueValue = TableRow("Version").ToString End If Next BizDataSet.Dispose() Objrs = Nothing End If 'Do the group assignments If Session.Item("GroupAssignments") = "Enabled" Then If Me.Product.SelectedItem.Value <> " " And Not IsNothing(Me.Product.SelectedItem) Then sdata(0) = Me.Product.SelectedItem.Value Else sdata(0) = "" End If If Me.Version.SelectedItem.Value <> " " And Not IsNothing(Me.Version.SelectedItem) Then sdata(1) = Me.Version.SelectedItem.Value Else sdata(1) = "" End If If Me.Platform.SelectedItem.Value <> " " And Not IsNothing(Me.Platform.SelectedItem) Then sdata(2) = Me.Platform.SelectedItem.Value Else sdata(2) = "" End If If Me.Database.SelectedItem.Value <> " " And Not IsNothing(Me.Database.SelectedItem) Then sdata(3) = Me.Database.SelectedItem.Value Else sdata(3) = "" End If Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.getAssignToGroup("Incident", sdata, Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Me.AssignedToGroup.Items.Clear() Me.AssignedToGroup.Items.Add(" ") For Each TableRow In BizDataSet.Tables(0).Rows Me.AssignedToGroup.Items.Add(TableRow("GroupName").ToString) Next BizDataSet.Dispose() Objrs = Nothing 'If only one group is found, automatically assign it. If Me.AssignedToGroup.Items.Count = 2 Then Me.AssignedToGroup.SelectedIndex = 1 'Populate the AssignTo dropdown Dim CurrentAgent As String Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("GroupMembers, Groups, Agents", "GroupMembers.AgentID, Agents.AssignedIncidents, Agents.Name", "GroupName='" & Me.AssignedToGroup.SelectedItem.Value & "' And Agents.AgentStatus = 'Available' And GroupMembers.GroupID = Groups.GroupID And GroupMembers.AgentID = Agents.AgentID ", 200, "GroupMembers.AgentID", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If Me.AssignedTo.SelectedItem.Text <> " " Then CurrentAgent = Me.AssignedTo.SelectedItem.Text Else CurrentAgent = "" End If Me.AssignedTo.Items.Clear() If CurrentAgent <> "" Then Me.AssignedTo.Items.Add(CurrentAgent) End If Me.AssignedTo.Items.Add(" ") For Each TableRow In BizDataSet.Tables(0).Rows If TableRow("AgentID").ToString <> CurrentAgent Then Me.AssignedTo.Items.Add(TableRow("AgentID").ToString) End If Next BizDataSet.Dispose() Objrs = Nothing End If End If 'If Agent Assignments enabled, assign it to an agent If Session.Item("AgentAssignments") = "Enabled" Then If Me.AssignedTo.Items.Count = 2 Then Me.AssignedTo.SelectedIndex = 1 End If End If SetFocus(Me.Version) exit_here: End Sub Private Sub Version_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Version.SelectedIndexChanged If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If If Session.Item("LoggedIn") Is Nothing Then Response.Redirect("Login.aspx?SessionTimeout=True") End If Dim Objrs Dim sdata(4) As Object Dim BizDataSet As DataSet Dim TableRow As DataRow Me.Platform.Items.Clear() Me.Platform.Items.Add(" ") Me.Database.Items.Clear() Me.Database.Items.Add(" ") 'Populate the Platform Dropdown of only valid Entries for the Contact If Not IsNothing(Me.Product.SelectedItem) And Not IsNothing(Me.Version.SelectedItem) Then Dim UniqueValue As String UniqueValue = "" Objrs = Server.CreateObject("BizClass.NET") If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then BizDataSet = Objrs.EAGet("Categorizations", "Platform", "(EAModule='Incident' or EAModule = '' or EAModule is Null) and (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Version = '" & Replace(Me.Version.SelectedItem.Text, "'", "''") & "' And (Company = '" & Trim(Replace(Me.CompanyDropDownList.SelectedItem.Text, "'", "''")) & "' or Company is NULL or Company = '') or (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Version = '" & Replace(Me.Version.SelectedItem.Text, "'", "''") & "' And Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "'))))", 9999, "Platform Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Else BizDataSet = Objrs.EAGet("Categorizations", "Platform", "(EAModule='Incident' or EAModule = '' or EAModule is Null) and (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Version = '" & Replace(Me.Version.SelectedItem.Text, "'", "''") & "' And (Company is NULL or Company = '') or (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Version = '" & Replace(Me.Version.SelectedItem.Text, "'", "''") & "' And Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "'))))", 9999, "Platform Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) End If For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("Platform").ToString) Then If UniqueValue <> TableRow("Platform").ToString Then Me.Platform.Items.Add(TableRow("Platform").ToString) End If UniqueValue = TableRow("Platform").ToString End If Next BizDataSet.Dispose() Objrs = Nothing End If 'Do the Group Assignments If Session.Item("GroupAssignments") = "Enabled" Then If Me.Product.SelectedItem.Value <> " " And Not IsNothing(Me.Product.SelectedItem) Then sdata(0) = Me.Product.SelectedItem.Value Else sdata(0) = "" End If If Me.Version.SelectedItem.Value <> " " And Not IsNothing(Me.Version.SelectedItem) Then sdata(1) = Me.Version.SelectedItem.Value Else sdata(1) = "" End If If Me.Platform.SelectedItem.Value <> " " And Not IsNothing(Me.Platform.SelectedItem) Then sdata(2) = Me.Platform.SelectedItem.Value Else sdata(2) = "" End If If Me.Database.SelectedItem.Value <> " " And Not IsNothing(Me.Database.SelectedItem) Then sdata(3) = Me.Database.SelectedItem.Value Else sdata(3) = "" End If Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.getAssignToGroup("Incident", sdata, Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If BizDataSet.Tables(0).Rows.Count < 1 Then Me.AssignedToGroup.Items.Clear() Me.AssignedTo.Items.Clear() BizDataSet.Dispose() Objrs = Nothing Exit Sub End If Me.AssignedToGroup.Items.Clear() Me.AssignedToGroup.Items.Add(" ") For Each TableRow In BizDataSet.Tables(0).Rows Me.AssignedToGroup.Items.Add(TableRow("GroupName").ToString) Next BizDataSet.Dispose() Objrs = Nothing 'If only one group is found, automatically assign it. If Me.AssignedToGroup.Items.Count = 2 Then Me.AssignedToGroup.SelectedIndex = 1 'Populate the AssignTo dropdown Dim CurrentAgent As String Objrs = CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("GroupMembers, Groups, Agents", "GroupMembers.AgentID, Agents.AssignedIncidents, Agents.Name", "GroupName='" & Me.AssignedToGroup.SelectedItem.Value & "' And Agents.AgentStatus = 'Available' And GroupMembers.GroupID = Groups.GroupID And GroupMembers.AgentID = Agents.AgentID ", 200, "GroupMembers.AgentID", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If Me.AssignedTo.SelectedItem.Text <> " " Then CurrentAgent = Me.AssignedTo.SelectedItem.Text Else CurrentAgent = "" End If Me.AssignedTo.Items.Clear() If CurrentAgent <> "" Then Me.AssignedTo.Items.Add(CurrentAgent) End If Me.AssignedTo.Items.Add(" ") If BizDataSet.Tables(0).Rows.Count < 1 Then BizDataSet.Dispose() Objrs = Nothing Exit Sub End If For Each TableRow In BizDataSet.Tables(0).Rows If TableRow("AgentID").ToString <> CurrentAgent Then Me.AssignedTo.Items.Add(TableRow("AgentID").ToString) End If Next BizDataSet.Dispose() Objrs = Nothing End If End If 'If Agent Assignments enabled, assign it to an agent If Session.Item("AgentAssignments") = "Enabled" Then If Me.AssignedTo.Items.Count = 2 Then Me.AssignedTo.SelectedIndex = 1 End If End If SetFocus(Me.Platform) exit_here: End Sub Private Sub Platform_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Platform.SelectedIndexChanged If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If If Session.Item("LoggedIn") Is Nothing Then Response.Redirect("Login.aspx?SessionTimeout=True") End If Dim sdata(4) As Object Dim Objrs Dim Bizdataset As DataSet Dim Tablerow As DataRow 'Populate the Database Dropdown of only valid Entries for the Contact If Not IsNothing(Me.Product.SelectedItem) And Not IsNothing(Me.Version.SelectedItem) And Not IsNothing(Me.Platform.SelectedItem) Then Dim UniqueValue As String UniqueValue = "" Objrs = Server.CreateObject("BizClass.NET") If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then Bizdataset = Objrs.EAGet("Categorizations", "DB", "(EAModule='Incident' or EAModule = '' or EAModule Is Null) and (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Version = '" & Replace(Me.Version.SelectedItem.Text, "'", "''") & "' And Platform = '" & Replace(Me.Platform.SelectedItem.Text, "'", "''") & "' And (Company = '" & Trim(Replace(Me.CompanyDropDownList.SelectedItem.Text, "'", "''")) & "' or Company is NULL or Company = '') or (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Version = '" & Replace(Me.Version.SelectedItem.Text, "'", "''") & "' And Platform = '" & Replace(Me.Platform.SelectedItem.Text, "'", "''") & "' And Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "'))))", 9999, "DB Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) Else Bizdataset = Objrs.EAGet("Categorizations", "DB", "(EAModule='Incident' or EAModule = '' or EAModule Is Null) and (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Version = '" & Replace(Me.Version.SelectedItem.Text, "'", "''") & "' And Platform = '" & Replace(Me.Platform.SelectedItem.Text, "'", "''") & "' And (Company is NULL or Company = '') or (Product = '" & Replace(Me.Product.SelectedItem.Text, "'", "''") & "' And Version = '" & Replace(Me.Version.SelectedItem.Text, "'", "''") & "' And Platform = '" & Replace(Me.Platform.SelectedItem.Text, "'", "''") & "' And Company in (select GroupName from Groups where GroupID in (select GroupID from GroupMembers where AgentID = '" & Replace(Session.Item("LoginID"), "'", "''") & "'))))", 9999, "DB Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) End If For Each Tablerow In Bizdataset.Tables(0).Rows If Not IsDBNull(Tablerow("DB").ToString) Then If UniqueValue <> Tablerow("DB").ToString Then Me.Database.Items.Add(Tablerow("DB").ToString) End If UniqueValue = Tablerow("DB").ToString End If Next Bizdataset.Dispose() Objrs = Nothing End If 'Do the Group Assignment If Session.Item("GroupAssignments") = "Enabled" Then If Me.Platform.SelectedItem.Value <> " " And Not IsNothing(Me.Platform.SelectedItem) Then sdata(0) = Me.Product.SelectedItem.Value Else sdata(0) = "" End If If Me.Version.SelectedItem.Value <> " " And Not IsNothing(Me.Version.SelectedItem) Then sdata(1) = Me.Version.SelectedItem.Value Else sdata(1) = "" End If If Me.Platform.SelectedItem.Value <> " " And Not IsNothing(Me.Platform.SelectedItem) Then sdata(2) = Me.Platform.SelectedItem.Value Else sdata(2) = "" End If If Me.Database.SelectedItem.Value <> " " And Not IsNothing(Me.Database.SelectedItem) Then sdata(3) = Me.Database.SelectedItem.Value Else sdata(3) = "" End If Objrs = CreateObject("BizClass.NET") Bizdataset = Objrs.getAssignToGroup("Incident", sdata, Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If Bizdataset.Tables(0).Rows.Count < 1 Then Me.AssignedToGroup.Items.Clear() Me.AssignedTo.Items.Clear() Bizdataset.Dispose() Objrs = Nothing Exit Sub End If Me.AssignedToGroup.Items.Clear() Me.AssignedToGroup.Items.Add(" ") For Each Tablerow In Bizdataset.Tables(0).Rows Me.AssignedToGroup.Items.Add(Tablerow("GroupName").ToString) Next Bizdataset.Dispose() Objrs = Nothing 'If only one group is found, automatically assign it. If Me.AssignedToGroup.Items.Count = 2 Then Me.AssignedToGroup.SelectedIndex = 1 'Populate the AssignTo dropdown Dim CurrentAgent As String Objrs = CreateObject("BizClass.NET") Bizdataset = Objrs.EAGet("GroupMembers, Groups, Agents", "GroupMembers.AgentID, Agents.AssignedIncidents, Agents.Name", "GroupName='" & Me.AssignedToGroup.SelectedItem.Value & "' And Agents.AgentStatus = 'Available' And GroupMembers.GroupID = Groups.GroupID And GroupMembers.AgentID = Agents.AgentID ", 200, "GroupMembers.AgentID", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If Me.AssignedTo.SelectedItem.Text <> " " Then CurrentAgent = Me.AssignedTo.SelectedItem.Text Else CurrentAgent = "" End If Me.AssignedTo.Items.Clear() If CurrentAgent <> "" Then Me.AssignedTo.Items.Add(CurrentAgent) End If Me.AssignedTo.Items.Add(" ") If Bizdataset.Tables(0).Rows.Count < 1 Then Bizdataset.Dispose() Objrs = Nothing Exit Sub End If For Each Tablerow In Bizdataset.Tables(0).Rows If Tablerow("AgentID").ToString <> CurrentAgent Then Me.AssignedTo.Items.Add(Tablerow("AgentID").ToString) End If Next Bizdataset.Dispose() Objrs = Nothing End If 'If Agent Assignments enabled, assign it to an agent If Session.Item("AgentAssignments") = "Enabled" Then If Me.AssignedTo.Items.Count = 2 Then Me.AssignedTo.SelectedIndex = 1 End If End If End If SetFocus(Me.Database) exit_here: End Sub Private Sub AssignedToGroup_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AssignedToGroup.SelectedIndexChanged If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If If Session.Item("LoggedIn") Is Nothing Then Response.Redirect("Login.aspx?SessionTimeout=True") End If Dim objrs Dim CurrentAgent As String Dim BizDataSet As DataSet Dim TableRow As DataRow objrs = CreateObject("BizClass.NET") BizDataSet = objrs.EAGet("GroupMembers, Groups, Agents", "GroupMembers.AgentID, Agents.AssignedIncidents, Agents.Name", "GroupName='" & Me.AssignedToGroup.SelectedItem.Value & "' And Agents.AgentStatus = 'Available' And GroupMembers.GroupID = Groups.GroupID And GroupMembers.AgentID = Agents.AgentID ", 200, "GroupMembers.AgentID", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If Not IsNothing(Me.AssignedTo.SelectedItem) Then If Trim(Me.AssignedTo.SelectedItem.Text) <> "" Then CurrentAgent = Me.AssignedTo.SelectedItem.Text Else CurrentAgent = "" End If Else CurrentAgent = "" End If Me.AssignedTo.Items.Clear() Me.AssignedTo.Items.Add(CurrentAgent) Me.AssignedTo.Items.Add("") If BizDataSet.Tables(0).Rows.Count < 1 Then BizDataSet.Dispose() objrs = Nothing Exit Sub End If For Each TableRow In BizDataSet.Tables(0).Rows If TableRow("AgentID").ToString <> CurrentAgent Then Me.AssignedTo.Items.Add(TableRow("AgentID").ToString) End If Next BizDataSet.Dispose() objrs = Nothing SetFocus(Me.AssignedTo) exit_here: End Sub Private Sub CompanyDropDownList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CompanyDropDownList.SelectedIndexChanged If Session.Item("Tracing") = "False" Then On Error GoTo exit_here End If If Session.Item("LoggedIn") Is Nothing Then Session.Abandon() Response.Redirect("Login.aspx?SessionTimeout=True") End If Dim Objrs Dim BizDataSet As DataSet Dim TableRow As DataRow Dim SelectedCompanyID As String Dim i = 0 'Used as a counter Dim UniqueValue As String = "" Dim SearchCriteria As String If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then If Trim(Me.CompanyDropDownList.SelectedItem.Text) = "" Then SearchCriteria = "(CompanyID = 0 or CompanyID is Null) " Else SearchCriteria = "CompanyName = '" & Replace(Me.CompanyDropDownList.SelectedItem.Text, "'", "''") & "'" End If End If 'Populate the Business Unit Dropdown of only valid Entries for the Company Me.BusinessUnit.Items.Clear() Me.BusinessUnit.Items.Add(" ") Me.BusinessUnit.Items(0).Text = " " Me.BusinessUnit.Items(0).Value = 0 i = 0 Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("BusinessUnit", "BusinessUnitID, BusinessUnitName", SearchCriteria, 9999, "BusinessUnitName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If Not BizDataSet.Tables(0).Rows.Count < 1 Then For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("BusinessUnitName").ToString) Then i = i + 1 Me.BusinessUnit.Items.Add(TableRow("BusinessUnitName").ToString) Me.BusinessUnit.Items(i).Text = TableRow("BusinessUnitName").ToString Me.BusinessUnit.Items(i).Value = TableRow("BusinessUnitID").ToString End If Next End If BizDataSet.Dispose() Objrs = Nothing If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then If Trim(Me.CompanyDropDownList.SelectedItem.Text) = "" Then SearchCriteria = SearchCriteria & " and (BusinessUnitID = 0 or BusinessUnitID is Null) " End If End If Me.SiteDropDownList.Items.Clear() Me.SiteDropDownList.Items.Add(" ") Me.SiteDropDownList.Items(0).Text = " " Me.SiteDropDownList.Items(0).Value = 0 i = 0 Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Site", "SiteID, SiteName", SearchCriteria, 9999, "SiteName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If BizDataSet.Tables(0).Rows.Count > 0 Then For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("SiteName").ToString) Then i = i + 1 Me.SiteDropDownList.Items.Add(TableRow("SiteName").ToString) Me.SiteDropDownList.Items(i).Text = TableRow("SiteName").ToString Me.SiteDropDownList.Items(i).Value = TableRow("SiteID").ToString End If Next End If BizDataSet.Dispose() Objrs = Nothing If Me.SiteDropDownList.Items.Count < 1 Then Me.SiteDropDownList.Items.Add(New ListItem(" ", 0)) End If If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then If Trim(Me.CompanyDropDownList.SelectedItem.Text) = "" Then SearchCriteria = SearchCriteria & " and (SiteID = 0 or SiteID is Null) " End If End If Me.Organization.Items.Clear() Me.Organization.Items.Add(" ") Me.Organization.Items(0).Text = " " Me.Organization.Items(0).Value = 0 i = 0 Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Organization", "OrganizationID, OrganizationName", SearchCriteria, 9999, "OrganizationName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If BizDataSet.Tables(0).Rows.Count > 0 Then For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("OrganizationName").ToString) Then i = i + 1 Me.Organization.Items.Add(TableRow("OrganizationName").ToString) Me.Organization.Items(i).Text = TableRow("OrganizationName").ToString Me.Organization.Items(i).Value = TableRow("OrganizationID").ToString End If Next End If BizDataSet.Dispose() Objrs = Nothing If Me.Organization.Items.Count < 1 Then Me.Organization.Items.Add(New ListItem(" ", 0)) End If If Not IsNothing(Me.CompanyDropDownList.SelectedItem) Then If Trim(Me.CompanyDropDownList.SelectedItem.Text) = "" Then SearchCriteria = SearchCriteria & " and (OrganizationID = 0 or OrganizationID is Null) " End If End If Me.Department.Items.Clear() Me.Department.Items.Add(" ") Me.Department.Items(0).Text = " " Me.Department.Items(0).Value = 0 i = 0 Objrs = Server.CreateObject("BizClass.NET") BizDataSet = Objrs.EAGet("Department", "DepartmentID, DepartmentName", SearchCriteria, 9999, "DepartmentName Asc", Session.Item("LoginType"), Session.Item("LoginID"), Session.SessionID) If BizDataSet.Tables(0).Rows.Count > 0 Then For Each TableRow In BizDataSet.Tables(0).Rows If Not IsDBNull(TableRow("DepartmentName").ToString) Then i = i + 1 Me.Department.Items.Add(TableRow("DepartmentName").ToString) Me.Department.Items(i).Text = TableRow("DepartmentName").ToString Me.Department.Items(i).Value = TableRow("DepartmentID").ToString End If Next End If BizDataSet.Dispose() Objrs = Nothing 'Populate the Tier1 Dropdown of only valid Entries for the Company Dim OldProductValue As String Dim OriginalContactID As String If