private void assignHardwareToPeople() { String strNameAD = grvRequests.SelectedDataKey["nameAD"].ToString(); String strInternalNr = grvRequests.SelectedDataKey["internalNr"].ToString(); String strSerialNr = grvRequests.SelectedDataKey["serialNr"].ToString(); Models.User getIndex = new Models.User(strNameAD); int userIndex = getIndex.ReturnEventID(); var request = new Hardware(userIndex, strInternalNr); request.BindEventID(); Hardware requestedHardware = new Hardware(); requestedHardware.ArchiveAssignedHardware(strSerialNr, strInternalNr, userIndex); //Archive the assigned hardware String strModelNr = ""; String strManufacturer = ""; requestedHardware.CreateXML("AssignedHardware", strSerialNr, strInternalNr, strManufacturer, strNameAD, strNameAD, strModelNr); //Temporary }
protected void assignHardwarePeople_Click(object sender, EventArgs e) { if (grvHardwarePoolUnassigned.SelectedRow != null && grvPeopleAD.SelectedRow != null) { String strSerialNr = grvHardwarePoolUnassigned.SelectedDataKey["serialNr"].ToString(); String strInternalNr = grvHardwarePoolUnassigned.SelectedDataKey["internalNr"].ToString(); String strNameAD = grvPeopleAD.SelectedRow.Cells[2].Text.ToString(); Models.User getUserID = new Models.User(strNameAD); int maxIndex = getUserID.ReturnEventID(); mysqlConnectie.Open(); assignHardware(maxIndex, strInternalNr); mysqlConnectie.Close(); getUnassignedHardware(); String strManufacturer = ""; String strModelNr = ""; Hardware assignedHardware = new Hardware(); assignedHardware.ArchiveAssignedHardware(strSerialNr, strInternalNr, maxIndex); //Archive the assigned hardware assignedHardware.CreateXML("AssignedHardware", strSerialNr, strInternalNr, strManufacturer, strNameAD, strNameAD, strModelNr); //Temporary } else { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Please select a hardware or people to continue!');", true); } }