<% theme = Request.Cookies("theme") IF theme = "" THEN theme="bg-theme1" END IF ' Get and validate machineid parameter (Phase 2: PCs are in machines table) Dim machineid, machineData, strSQL machineid = Request.QueryString("machineid") ' Security validation - ensure pcid is numeric If NOT IsNumeric(machineid) OR machineid = "" Then Response.Redirect("./displaypcs.asp") Response.End End If ' Load PC data (pctypeid IS NOT NULL identifies PCs) strSQL = "SELECT m.*, m.machinetypeid AS pcmachinetypeid, " &_ "mo.modelnumber, mo.vendorid AS modelvendorid, mo.machinetypeid AS modelmachinetypeid, mo.image AS modelimage, " &_ "v.vendor, " &_ "bu.businessunit, " &_ "mt.machinetype " &_ "FROM machines m " &_ "LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " &_ "LEFT JOIN vendors v ON mo.vendorid = v.vendorid " &_ "LEFT JOIN businessunits bu ON m.businessunitid = bu.businessunitid " &_ "LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " &_ "WHERE m.machineid = ? AND m.pctypeid IS NOT NULL" Dim cmd, rsMachine Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Set rsMachine = cmd.Execute If rsMachine.EOF Then rsMachine.Close Set rsMachine = Nothing Set cmd = Nothing objConn.Close Response.Redirect("./displaypcs.asp") Response.End End If ' Store machine data Dim serialnumber, hostname, machinenumber, modelid, businessunitid, alias, machinenotes, mapleft, maptop, pcMachineTypeId, currentMachineStatusId, currentPcTypeId serialnumber = "" : If NOT IsNull(rsMachine("serialnumber")) Then serialnumber = rsMachine("serialnumber") & "" hostname = "" : If NOT IsNull(rsMachine("hostname")) Then hostname = rsMachine("hostname") & "" machinenumber = "" : If NOT IsNull(rsMachine("machinenumber")) Then machinenumber = rsMachine("machinenumber") & "" modelid = "" : If NOT IsNull(rsMachine("modelnumberid")) Then modelid = rsMachine("modelnumberid") businessunitid = "" : If NOT IsNull(rsMachine("businessunitid")) Then businessunitid = rsMachine("businessunitid") alias = "" : If NOT IsNull(rsMachine("alias")) Then alias = rsMachine("alias") & "" machinenotes = "" : If NOT IsNull(rsMachine("machinenotes")) Then machinenotes = rsMachine("machinenotes") & "" mapleft = "" : If NOT IsNull(rsMachine("mapleft")) Then mapleft = rsMachine("mapleft") maptop = "" : If NOT IsNull(rsMachine("maptop")) Then maptop = rsMachine("maptop") pcMachineTypeId = 0 : If NOT IsNull(rsMachine("pcmachinetypeid")) Then pcMachineTypeId = CLng(rsMachine("pcmachinetypeid")) currentPcTypeId = 0 : If NOT IsNull(rsMachine("pctypeid")) Then currentPcTypeId = CLng(rsMachine("pctypeid")) currentMachineStatusId = "" : If NOT IsNull(rsMachine("machinestatusid")) Then currentMachineStatusId = rsMachine("machinestatusid") rsMachine.Close Set rsMachine = Nothing Set cmd = Nothing ' Load network interfaces from communications table Dim ip1, mac1, ip2, mac2, ip3, mac3 ip1 = "" : mac1 = "" : ip2 = "" : mac2 = "" : ip3 = "" : mac3 = "" strSQL = "SELECT address, macaddress FROM communications WHERE machineid = ? AND isactive = 1 ORDER BY isprimary DESC" Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Dim rsComms Set rsComms = cmd.Execute Dim interfaceCount interfaceCount = 0 While NOT rsComms.EOF AND interfaceCount < 3 interfaceCount = interfaceCount + 1 If interfaceCount = 1 Then If NOT IsNull(rsComms("address")) Then ip1 = rsComms("address") If NOT IsNull(rsComms("macaddress")) Then mac1 = rsComms("macaddress") ElseIf interfaceCount = 2 Then If NOT IsNull(rsComms("address")) Then ip2 = rsComms("address") If NOT IsNull(rsComms("macaddress")) Then mac2 = rsComms("macaddress") ElseIf interfaceCount = 3 Then If NOT IsNull(rsComms("address")) Then ip3 = rsComms("address") If NOT IsNull(rsComms("macaddress")) Then mac3 = rsComms("macaddress") End If rsComms.MoveNext Wend rsComms.Close Set rsComms = Nothing Set cmd = Nothing ' Load controlled machines from machinerelationships (for PC edit page) ' Note: Controls relationship is PC → Equipment, so we show machines where machineid is THIS PC Dim controllingpcid controllingpcid = "" strSQL = "SELECT mr.related_machineid AS controlpcid FROM machinerelationships mr " &_ "JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " &_ "WHERE mr.machineid = ? AND rt.relationshiptype = 'Controls' AND mr.isactive = 1" Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Dim rsControlPC Set rsControlPC = cmd.Execute If NOT rsControlPC.EOF Then If NOT IsNull(rsControlPC("controlpcid")) Then controllingpcid = rsControlPC("controlpcid") End If rsControlPC.Close Set rsControlPC = Nothing Set cmd = Nothing ' Load dualpath from machinerelationships Dim dualpathid dualpathid = "" strSQL = "SELECT related_machineid FROM machinerelationships mr " &_ "JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " &_ "WHERE mr.machineid = ? AND rt.relationshiptype = 'Dualpath' AND mr.isactive = 1" Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Dim rsDualpath Set rsDualpath = cmd.Execute If NOT rsDualpath.EOF Then If NOT IsNull(rsDualpath("related_machineid")) Then dualpathid = rsDualpath("related_machineid") End If rsDualpath.Close Set rsDualpath = Nothing Set cmd = Nothing ' Load compliance data Dim thirdpartymanaged, thirdpartymanager, otassetsystem, dodassettype thirdpartymanaged = "NA" : thirdpartymanager = "" : otassetsystem = "" : dodassettype = "" strSQL = "SELECT * FROM compliance WHERE machineid = ?" Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Dim rsCompliance Set rsCompliance = cmd.Execute If NOT rsCompliance.EOF Then If NOT IsNull(rsCompliance("isthirdpartymanaged")) Then thirdpartymanaged = rsCompliance("isthirdpartymanaged") If NOT IsNull(rsCompliance("thirdpartymanager")) Then thirdpartymanager = rsCompliance("thirdpartymanager") If NOT IsNull(rsCompliance("otassetdevicetype")) Then dodassettype = rsCompliance("otassetdevicetype") End If rsCompliance.Close Set rsCompliance = Nothing Set cmd = Nothing %>

##### Edit PC

Back to PCs
Serial Number PC serial number for asset tracking
Hostname Network hostname for this PC
Machine Status
Model *

###### New Model

Model Number *
Vendor *

###### New Vendor

Vendor Name *
Machine Type *

###### New Machine Type

Machine Type Name *
Description (Optional)
Functional Account *

###### New Functional Account

Account Name *
Description (Optional)
Image Filename (Optional) Filename of image in images/machines/
Business Unit *

###### New Business Unit

Business Unit Name *
Alias (Optional)
Notes (Optional) <%=Server.HTMLEncode(machinenotes)%>

##### Network Communications

Configure network interfaces for this equipment. You can add up to 3 interfaces.

Interface 1 (Primary)
IP Address Example: 192.168.1.100
MAC Address Example: 00:1A:2B:3C:4D:5E
Interface 2 (Optional)
IP Address
MAC Address
Interface 3 (Optional)
IP Address
MAC Address

##### Machine Relationships

Define relationships between this PC and machines it controls.

Controlled Machine
<% ' Show filter info for specialized PCs If filterDescription <> "" Then Response.Write(" Filtered to " & filterDescription & " equipment only") Else Response.Write("Select a machine that this PC controls") End If %>

##### Compliance & Security

Track compliance and security information for this equipment.

Third Party Managed
Is this equipment managed by a third party?
Third Party Vendor
Select the vendor managing this equipment

###### New Third Party Vendor

Vendor Name * This vendor will be added to the system
OT Asset System Operational Technology asset classification
DoD Asset Device Type Department of Defense asset classification

##### Location

Set the physical location of this equipment on the shop floor map.

Map X Coordinate:
Map Y Coordinate:

Cancel

##### Select Location on Map

<% objConn.Close %>