private void SaveButton_Click(object sender, EventArgs e) { // Get every checked row (SampleStorageDuos) that are okey, // update database for each of them try { var doublets = GetDoublets(); if (IsNotEmpty(doublets)) { var doubletsDialog = new DoubletsDialog(doublets); doubletsDialog.ShowDialog(); SampleStorageListView.Select(); return; } foreach (DuoViewItem duoView in SampleStorageListView.Items) { if (duoView.Checked) { MoveContainer(duoView.GetSampleContainer(), duoView.GetStorageContainer(), UserManager.GetCurrentUser().GetId()); } } MessageBox.Show(this, "Update is completed!", Config.GetDialogTitleStandard(), MessageBoxButtons.OK, MessageBoxIcon.Information); Reset(); } catch (Exception exception) { HandleError("Could not update locations of sample containers", exception); } SampleStorageListView.Select(); }
private void HandleReceivedBarCode(string barCode) { var genericContainer = GenericContainerManager.GetGenericContainerByBarCode(barCode); if (!CheckContainerType(genericContainer)) { throw new DataException("This bar code neither represent a sample container nor a deposit"); } var sampleListDialog = new SampleListDialog(genericContainer); _barCodeController = null; if (sampleListDialog.ShowDialog() == DialogResult.OK) { var depositContainer = sampleListDialog.GetSelectedDeposit(); var selectedContainers = sampleListDialog.GetSelectedContainers(); var doublets = GetDoublets(selectedContainers, out var uniqueList); if (doublets.Count > 0) { var doubletsDialog = new DoubletsDialog(doublets, "These duplicates are sorted out from the list!"); doubletsDialog.ShowDialog(); selectedContainers = uniqueList; } UpdateListView(selectedContainers, depositContainer); printToolStripMenuItem.Enabled = true; exportToolStripMenuItem.Enabled = true; } }