private MARC_Record GetMarcRecord(String bNumber) { var normalised = WellcomeLibraryIdentifiers.GetNormalisedBNumber(bNumber, false); var identifier = WellcomeLibraryIdentifiers.GetShortBNumber(normalised).ToString(CultureInfo.InvariantCulture); string msg; var endpoint = new Z3950_Endpoint(Z3950Name, Z3950Host, Z3950Port, Z3950DbName); return(MARC_Record_Z3950_Retriever.Get_Record_By_Primary_Identifier(identifier, endpoint, out msg)); }
private void importButton_Button_Pressed(object sender, EventArgs e) { // Check the primary key is provided if (identifierTextBox.Text.Trim().Length == 0) { MessageBox.Show("Enter the primary identifier to import the Z39.50 records. ", "Missing Primary Identifier", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Check the Z39.50 endpoint if (endpoint == null) { Z3950_Endpoint_Form endpointForm = new Z3950_Endpoint_Form(); Hide(); endpointForm.ShowDialog(); Show(); endpoint = endpointForm.Endpoint; if (endpoint == null) { MessageBox.Show("Select a Z39.50 endpoint or enter information for a new or temporary endpoint. ", "Missing Endpoint", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // Since this was a VALID entry, save this as the last Z39.50 endpoint used if ((endpoint.Name != NEW) && (endpoint.Name != TEMP)) { MetaTemplate_UserSettings.Last_Z3950_Endpoint = endpoint.Name; MetaTemplate_UserSettings.Save(); } string identifier = identifierTextBox.Text.Trim(); string out_message = String.Empty; MARC_Record record_from_z3950 = MARC_Record_Z3950_Retriever.Get_Record_By_Primary_Identifier(identifier, endpoint, out out_message); if (record_from_z3950 == null) { if (out_message.Length > 0) { MessageBox.Show(out_message, "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Unknown error occurred during request", "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { //MessageBox.Show("Found!!\n\n" + record_from_z3950.To_Machine_Readable_Record()); Record = record_from_z3950; } Close(); }