public override void Render_Template_HTML(System.IO.TextWriter Output, Resource_Object.SobekCM_Item Bib, string Skin_Code, bool IsMozilla, StringBuilder PopupFormBuilder, Users.User_Object Current_User, Configuration.Web_Language_Enum CurrentLanguage, Application_State.Language_Support_Info Translator, string Base_URL) { Output.WriteLine(" <!-- Literal Element -->"); Output.WriteLine(" <tr>"); Output.WriteLine(" <td style=\"width:" + LEFT_MARGIN + "px\"> </td>"); Output.WriteLine(" <td colspan=\"2\">" + html_text + "</td>"); Output.WriteLine(" </tr>"); }
/// <summary> Prepares the bib object for the save, by clearing any existing data in this element's related field(s) </summary> /// <param name="Bib"> Existing digital resource object which may already have values for this element's data field(s) </param> /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param> /// <remarks> This does nothing </remarks> public override void Prepare_For_Save(Resource_Object.SobekCM_Item Bib, Users.User_Object Current_User) { // do nothing }
/// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary> /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param> public override void Save_To_Bib(Resource_Object.SobekCM_Item Bib) { // do nothing }
protected bool Check_For_Existence_And_Save(SobekCM_Item bibPackage, DataRow currentRow, string related_file, string message, string importer_bib_source, bool preview_mode) { // reset local variables Matching_Record_Choice_Enum matching_record_dialog_form_selected_value = Matching_Record_Choice_Enum.Undefined; item_import_comments = String.Empty; bool try_to_fetch_existing_division_information = false; // clear the message collection if (currentRow != null) { currentRow["Messages"] = String.Empty; } // Does this Bibliographic record already exist in the tracking database? DataRow[] selected = null; DataTable matchingRows = SobekCM.Resource_Object.Database.SobekCM_Database.Check_For_Record_Existence(bibPackage.BibID, bibPackage.VID, bibPackage.Bib_Info.OCLC_Record, bibPackage.Bib_Info.ALEPH_Record); if ((matchingRows != null) && (matchingRows.Rows.Count > 0)) { // check if the BibID already exists if (bibPackage.BibID.Trim().Length > 0) { if (Provided_Bib_To_New_Bib.ContainsKey(bibPackage.BibID)) { bibPackage.BibID = Provided_Bib_To_New_Bib[bibPackage.BibID]; matching_record_dialog_form_selected_value = Matching_Record_Choice_Enum.Create_New_Record; } else { string vid = bibPackage.VID.PadLeft(5, '0'); selected = matchingRows.Select("BibID ='" + bibPackage.BibID.Replace("'", "''") + "' and vid = '" + vid.Replace("'", "") + "'"); // Search for an existing record that matches the provided BibID. if ((bibPackage.VID.Length > 0) && (selected.Length > 0)) { matching_record_dialog_form_selected_value = Matching_Record_Choice_Enum.Skip; } } } // Don't bother if there was already a BibID:VID match if ((matching_record_dialog_form_selected_value == Matching_Record_Choice_Enum.Undefined) && (matchingRows.Rows.Count > 0)) { // Check for both existing ALEPH and existing OCLC here in one piece of logic if (!New_Bib_IDs.Contains(matchingRows.Rows[0]["bibid"].ToString().ToUpper())) { matching_record_dialog_form_selected_value = get_matching_record_choice(message, "Aleph # " + bibPackage.Bib_Info.ALEPH_Record, matchingRows.Rows[0]["bibid"].ToString()); if (matching_record_dialog_form_selected_value == Matching_Record_Choice_Enum.Skip) { bibPackage.BibID = "(" + matchingRows.Rows[0]["bibid"].ToString() + ")"; } else if (matching_record_dialog_form_selected_value == Matching_Record_Choice_Enum.Overlay_Bib_Record) { if (bibPackage.BibID.Length == 0) { bibPackage.BibID = matchingRows.Rows[0]["bibid"].ToString().ToUpper(); } if (bibPackage.VID.Length == 0) { bibPackage.VID = matchingRows.Rows[0]["vid"].ToString().ToUpper(); } try_to_fetch_existing_division_information = true; } } else if (Importer_Type == Importer_Type_Enum.MARC) { if (bibPackage.BibID.Length == 0) { bibPackage.BibID = matchingRows.Rows[0]["bibid"].ToString().ToUpper(); } if (bibPackage.VID.Length == 0) { bibPackage.VID = matchingRows.Rows[0]["vid"].ToString().ToUpper(); } try_to_fetch_existing_division_information = true; } } } // Clear the errors this.errors.Clear(); this.warnings.Clear(); // determine how to process this row from the dialog result switch (matching_record_dialog_form_selected_value) { case Matching_Record_Choice_Enum.Overlay_Bib_Record: if ((try_to_fetch_existing_division_information)) { Resource_Object.SobekCM_Item fromTracking = SobekCM_METS_Finder.Find_UFDC_METS(bibPackage.BibID, bibPackage.VID, String.Empty, null); if (fromTracking != null) { // Copy serial hierarchy information if ((fromTracking.Bib_Info.Series_Part_Info.Enum1.Length > 0) && (bibPackage.Bib_Info.Series_Part_Info.Enum1.Length == 0)) { bibPackage.Bib_Info.Series_Part_Info.Enum1 = fromTracking.Bib_Info.Series_Part_Info.Enum1; } if ((fromTracking.Bib_Info.Series_Part_Info.Enum2.Length > 0) && (bibPackage.Bib_Info.Series_Part_Info.Enum2.Length == 0)) { bibPackage.Bib_Info.Series_Part_Info.Enum2 = fromTracking.Bib_Info.Series_Part_Info.Enum2; } if ((fromTracking.Bib_Info.Series_Part_Info.Enum3.Length > 0) && (bibPackage.Bib_Info.Series_Part_Info.Enum3.Length == 0)) { bibPackage.Bib_Info.Series_Part_Info.Enum3 = fromTracking.Bib_Info.Series_Part_Info.Enum3; } if ((fromTracking.Bib_Info.Series_Part_Info.Year.Length > 0) && (bibPackage.Bib_Info.Series_Part_Info.Year.Length == 0)) { bibPackage.Bib_Info.Series_Part_Info.Year = fromTracking.Bib_Info.Series_Part_Info.Year; } if ((fromTracking.Bib_Info.Series_Part_Info.Month.Length > 0) && (bibPackage.Bib_Info.Series_Part_Info.Month.Length == 0)) { bibPackage.Bib_Info.Series_Part_Info.Month = fromTracking.Bib_Info.Series_Part_Info.Month; } if ((fromTracking.Bib_Info.Series_Part_Info.Day.Length > 0) && (bibPackage.Bib_Info.Series_Part_Info.Day.Length == 0)) { bibPackage.Bib_Info.Series_Part_Info.Day = fromTracking.Bib_Info.Series_Part_Info.Day; } // Copy origin date if ((fromTracking.Bib_Info.Origin_Info.Date_Issued.Length > 0) && (bibPackage.Bib_Info.Origin_Info.Date_Issued.Length == 0)) { bibPackage.Bib_Info.Origin_Info.Date_Issued = fromTracking.Bib_Info.Origin_Info.Date_Issued; } // Check for donor if ((bibPackage.Bib_Info.Donor.ToString().ToUpper().Replace("UNKNOWN", "").Length == 0) && (fromTracking.Bib_Info.Donor.Full_Name.ToUpper().Replace("UNKNOWN", "").Length > 0)) { bibPackage.Bib_Info.Donor.Full_Name = fromTracking.Bib_Info.Donor.Full_Name; } // Check for ALEPH number if ((bibPackage.Bib_Info.ALEPH_Record.Length == 0) && (fromTracking.Bib_Info.ALEPH_Record.Length > 0)) { bibPackage.Bib_Info.Add_Identifier(fromTracking.Bib_Info.ALEPH_Record, "Aleph"); } // Copy the source and holding information bibPackage.Bib_Info.Source.Code = fromTracking.Bib_Info.Source.Code; bibPackage.Bib_Info.Source.Statement = fromTracking.Bib_Info.Source.Statement; bibPackage.Bib_Info.Location.Holding_Code = fromTracking.Bib_Info.Location.Holding_Code; bibPackage.Bib_Info.Location.Holding_Name = fromTracking.Bib_Info.Location.Holding_Name; // Copy any EAD information bibPackage.Bib_Info.Location.EAD_Name = fromTracking.Bib_Info.Location.EAD_Name; bibPackage.Bib_Info.Location.EAD_URL = fromTracking.Bib_Info.Location.EAD_URL; // Finally copy over the divisions, which also includes the files bibPackage.Divisions = fromTracking.Divisions; } } bibPackage.METS_Header.RecordStatus_Enum = METS_Record_Status.METADATA_UPDATE; add_to_database(bibPackage, importer_bib_source, preview_mode, true); if (this.errors.Count == 0) { if (preview_mode) { item_import_comments += "Existing record would have been overlayed. " + Tracking_Warnings; } else { item_import_comments += "Existing record overlayed. " + Tracking_Warnings; } report.Add_Item(bibPackage, related_file, item_import_comments.Trim()); if (currentRow != null) { currentRow["Messages"] = item_import_comments; currentRow["New Bib ID"] = bibPackage.BibID; currentRow["New VID ID"] = bibPackage.VID; } return(true); } else { item_import_comments = Error_Message; report.Add_Item(bibPackage, related_file, item_import_comments.Trim()); if (currentRow != null) { currentRow["Messages"] = Error_Message; bibPackage.VID = String.Empty; bibPackage.BibID = String.Empty; } return(false); } break; case Matching_Record_Choice_Enum.Create_New_Record: // add new bib record add_to_database(bibPackage, importer_bib_source, preview_mode, false); if (this.errors.Count == 0) { if (preview_mode) { item_import_comments += "New record would have been created. " + Tracking_Warnings; } else { item_import_comments += "New record created. " + Tracking_Warnings; } report.Add_Item(bibPackage, related_file, item_import_comments.Trim()); if (currentRow != null) { currentRow["Messages"] = item_import_comments; currentRow["New Bib ID"] = bibPackage.BibID; currentRow["New VID ID"] = bibPackage.VID; } return(true); } else { item_import_comments = Error_Message; report.Add_Item(bibPackage, related_file, item_import_comments.Trim()); if (currentRow != null) { currentRow["Messages"] = Error_Message; bibPackage.VID = String.Empty; bibPackage.BibID = String.Empty; } return(false); } break; case Matching_Record_Choice_Enum.Skip: // stop processing this record and continue to the next record if (errors.Count == 0) { item_import_comments += " Record skipped."; if (currentRow != null) { currentRow["Messages"] = "Record skipped."; } } else { item_import_comments = Error_Message; if (currentRow != null) { currentRow["Messages"] = Error_Message; } } // Add this to the result table being built report.Add_Item(bibPackage, related_file, item_import_comments.Trim()); recordsProcessed++; recordsSkipped++; return(false); case Matching_Record_Choice_Enum.Undefined: // add this record to the database since it did not match any existing records if (!add_to_database(bibPackage, importer_bib_source, preview_mode, false)) { this.errors.Add("Unable to save to tracking"); } if (this.errors.Count == 0) { if (preview_mode) { item_import_comments += "New record would have been created. " + Tracking_Warnings; } else { item_import_comments += "New record created. " + Tracking_Warnings; } report.Add_Item(bibPackage, related_file, item_import_comments.Trim()); if (currentRow != null) { currentRow["Messages"] = item_import_comments; currentRow["New Bib ID"] = bibPackage.BibID; currentRow["New VID ID"] = bibPackage.VID; } return(true); } else { item_import_comments = Error_Message; report.Add_Item(bibPackage, related_file, item_import_comments.Trim()); if (currentRow != null) { currentRow["Messages"] = Error_Message; bibPackage.VID = String.Empty; bibPackage.BibID = String.Empty; } return(false); } break; } return(false); }