private void Create_ForensicProcess_Shown(object sender, EventArgs e) { Dictionary <Computer, string> displayComputers = SelectableAssociatedComputers.ToDictionary(comp => comp, comp => comp.Make + " | " + comp.Model); Dictionary <HardDrive, string> displayHardDrives = SelectableAssociatedHardDrives.ToDictionary(hd => hd, hd => hd.Make + " | " + hd.Model); if (displayComputers.Any()) { checkedListBoxAssociatedcomputers.DataSource = new BindingSource(displayComputers, null); checkedListBoxAssociatedcomputers.DisplayMember = "Value"; checkedListBoxAssociatedcomputers.ValueMember = "Key"; } if (displayHardDrives.Any()) { checkedListBoxAssociatedhardDrives.DataSource = new BindingSource(displayHardDrives, null); checkedListBoxAssociatedhardDrives.DisplayMember = "Value"; checkedListBoxAssociatedhardDrives.ValueMember = "Key"; } }
private void MakeForensicProcess() { IList <HardDrive> selectedHardDrives = new List <HardDrive>(); IList <Computer> selectedComputers = new List <Computer>(); foreach (object item in checkedListBoxAssociatedhardDrives.CheckedItems) { int i = checkedListBoxAssociatedhardDrives.Items.IndexOf(item); selectedHardDrives.Add(SelectableAssociatedHardDrives.ElementAt(i)); } foreach (object item in checkedListBoxAssociatedcomputers.CheckedItems) { int i = checkedListBoxAssociatedcomputers.Items.IndexOf(item); selectedComputers.Add(SelectableAssociatedComputers.ElementAt(i)); } NewForensicProcess = new ForensicProcess { //collection onformation CollectionLocation = textBoxCollectionLocation.Text, RoomNumber = textBoxRoomNumber.Text, CustodianOrUser = textBoxCustodianUser.Text, PhotoWasTaken = checkBoxPhotosWereTaken.Checked, WasImageOnly = checkBoxOnlyImageWasReceived.Checked, WasHardDriveOnly = checkBoxOnlyHardDriveWasReceived.Checked, ProcessingPerformed = comboBoxProcessPerformed.Text, ForensicDeviceUsed = comboBoxDeviceUsed.Text, Software = comboBoxSoftwareProcessing.Text, ImagesMade = comboBoxImagesMade.Text, ImagesVerifiedBy = comboBoxImagesVerifiedBy.Text, CdfInfo = new CdfInfo { IsFinishDate = true, Cdfdate = dateTimePickerFPFinishDateTime.Value, TechExaminer = SelectSingleEntityById.SelectEmployeeById( new Guid(comboBoxCDFInfoTech.SelectedValue.ToString())) }, DestinationMediae = ForensicProcessDestinationMediae, ReferenceHardDrives = selectedHardDrives, ReferenceComputers = selectedComputers, }; ForensicProcessDestinationMediae.ToList().ForEach(dm => dm.SerialNumber = NewForensicProcess.ToString()); }