コード例 #1
0
        /// <summary> Builds an item group object, from a METS file </summary>
        /// <param name="BibID"> Bibliographic identifier for the item group to retrieve </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <param name="Item_Group_Object"> [OUT] Fully built item group object </param>
        /// <param name="Items_In_Title"> [OUT] List of all the items in this title </param>
        public void Build_Item_Group(string BibID, Custom_Tracer Tracer, out SobekCM_Items_In_Title Items_In_Title, out SobekCM_Item Item_Group_Object )
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Item_Group", "Create the requested item group");
            }

            // Set to NULL by default
            Item_Group_Object = null;
            Items_In_Title = null;

            // Get the basic information about this item
            DataSet itemDetails = Engine_Database.Get_Item_Group_Details(BibID, Tracer);

            // If this is NULL then there was an error
            if (itemDetails == null)
                return;

            // Get the location for the METS file from the returned value
            DataRow mainItemRow = itemDetails.Tables[0].Rows[0];
            string metsLocation = mainItemRow["File_Location"].ToString();

            // Get the response object for this METS file
            string metsFile = metsLocation.Replace("\\", "/") + "/" + BibID + ".xml";
            if (metsFile.IndexOf("http:") < 0)
            {
                metsFile = Engine_ApplicationCache_Gateway.Settings.Servers.Image_Server_Network + metsFile;
            }

            // Try to read this METS file
            bool pulledFromMETSFile = true;
            Item_Group_Object = Build_Item_From_METS(metsFile, BibID + ".xml", Tracer);

            // If this failed, just create an item from scratch
            if (Item_Group_Object == null)
            {
                Item_Group_Object = new SobekCM_Item();
                Item_Group_Object.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Serial;
                Item_Group_Object.BibID = BibID;
                pulledFromMETSFile = false;
            }

            // Set some default and add the management view
            Item_Group_Object.METS_Header.RecordStatus_Enum = METS_Record_Status.BIB_LEVEL;
            Item_Group_Object.Behaviors.Add_View(View_Enum.MANAGE);

            // Pull values from the database
            Item_Group_Object.Behaviors.GroupTitle = String.Empty;
            Item_Group_Object.Behaviors.Set_Primary_Identifier(mainItemRow["Primary_Identifier_Type"].ToString(), mainItemRow["Primary_Identifier"].ToString());
            Item_Group_Object.Behaviors.Text_Searchable = false;

            Item_Group_Object.Web.File_Root = String.Empty;
            Item_Group_Object.Web.Image_Root = Engine_ApplicationCache_Gateway.Settings.Servers.Image_URL;
            Item_Group_Object.Web.Siblings = 2;
            Item_Group_Object.Web.Static_PageCount = 0;
            Item_Group_Object.Web.Static_Division_Count = 0;
            Item_Group_Object.Web.AssocFilePath = "/" + BibID.Substring(0, 2) + "/" + BibID[2] + BibID[6] + "/" + BibID[4] + BibID[8] + "/" + BibID[3] + BibID[7] + "/" + BibID[5] + BibID[9] + "/";
            Item_Group_Object.Web.GroupID = Convert.ToInt32(mainItemRow["GroupID"]);

            // Add the full citation view and google map if pulled from the METS file
            if (pulledFromMETSFile)
            {
                // GEt the geospatial metadata module
                GeoSpatial_Information geoInfo = Item_Group_Object.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
                if ((geoInfo != null) && (geoInfo.hasData))
                {
                    // In addition, if there is a latitude or longitude listed, add the Google Maps
                    if ((geoInfo.Point_Count > 0) || (geoInfo.Polygon_Count > 0))
                    {
                        Item_Group_Object.Behaviors.Insert_View(0, View_Enum.GOOGLE_MAP);
                    }
                }

                Item_Group_Object.Behaviors.Insert_View(0, View_Enum.CITATION);
            }

            // If this has more than 1 sibling (this count includes itself), add the multi-volumes viewer
            Item_Group_Object.Behaviors.Insert_View(0, View_Enum.ALL_VOLUMES, String.Empty, Item_Group_Object.Bib_Info.SobekCM_Type_String);

            // Pull the data from the database
            Item_Group_Object.Behaviors.GroupType = mainItemRow["Type"].ToString();
            Item_Group_Object.Behaviors.GroupTitle = mainItemRow["GroupTitle"].ToString();
            Item_Group_Object.Web.File_Root = mainItemRow["File_Location"].ToString();

            // Create the list of items in this title
            Items_In_Title = new SobekCM_Items_In_Title(itemDetails.Tables[1]);

            // Add the database information to the icons now
            Item_Group_Object.Behaviors.Clear_Wordmarks();
            foreach (DataRow thisIconRow in itemDetails.Tables[2].Rows)
            {
                Wordmark_Info newIcon = new Wordmark_Info();
                if ( thisIconRow["Link"].ToString().Length == 0)
                {
                    newIcon.Title = thisIconRow["Icon_Name"].ToString();
                    newIcon.Link = thisIconRow["Link"].ToString();
                    newIcon.HTML = "<img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + thisIconRow["Icon_URL"].ToString().Replace("&","&amp;") + "\" alt=\"" + newIcon.Title.Replace("&", "&amp;").Replace("\"", "&quot;") + "\" />";
                }
                else
                {
                    newIcon.Title = thisIconRow["Icon_Name"].ToString();
                    newIcon.Link = thisIconRow["Link"].ToString();
                    newIcon.HTML = "<a href=\"" + newIcon.Link + "\" target=\"_blank\"><img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + thisIconRow["Icon_URL"].ToString().Replace("&", "&amp;").Replace("\"", "&quot;") + "\" alt=\"" + newIcon.Title.Replace("&", "&amp;").Replace("\"", "&quot;") + "\" /></a>";
                }
                Item_Group_Object.Behaviors.Add_Wordmark(newIcon);
            }

            // Add the web skin codes to this bib-level item as well
            Item_Group_Object.Behaviors.Clear_Web_Skins();
            foreach (DataRow thisRow in itemDetails.Tables[3].Rows)
            {
                Item_Group_Object.Behaviors.Add_Web_Skin(thisRow[0].ToString().ToUpper());
            }

            // Set the aggregationPermissions in the package to the aggregation links from the database
            if (itemDetails.Tables.Count == 6)
            {
                Item_Group_Object.Behaviors.Clear_Aggregations();
                DataTable aggrTable = itemDetails.Tables[4];
                foreach (DataRow thisRow in aggrTable.Rows)
                {
                    Item_Group_Object.Behaviors.Add_Aggregation(thisRow[0].ToString());
                }

                // Add the related titles, if there are some
                foreach (DataRow thisRow in itemDetails.Tables[5].Rows)
                {
                    string relationship = thisRow["Relationship"].ToString();
                    string title = thisRow["GroupTitle"].ToString();
                    string bibid = thisRow["BibID"].ToString();
                    string link_and_title = "<a href=\"<%BASEURL%>" + bibid + "<%URL_OPTS%>\">" + title + "</a>";
                    Item_Group_Object.Web.All_Related_Titles.Add(new Related_Titles(relationship, link_and_title));
                }
            }
        }
コード例 #2
0
        /// <summary> Constructor for a new instance of the MySobek_HtmlSubwriter class </summary>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        public MySobek_HtmlSubwriter(RequestCache RequestSpecificValues)
            : base(RequestSpecificValues)
        {
            RequestSpecificValues.Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Saving values and geting user object back from the session");

            if (RequestSpecificValues.Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Log_Out)
            {
                RequestSpecificValues.Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Performing logout");

                HttpContext.Current.Session["user"] = null;
                HttpContext.Current.Response.Redirect("?", false);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                RequestSpecificValues.Current_Mode.Request_Completed = true;
                return;
            }

            if ((RequestSpecificValues.Current_Mode.My_Sobek_Type != My_Sobek_Type_Enum.Logon) && (RequestSpecificValues.Current_User != null) && (RequestSpecificValues.Current_User.Is_Temporary_Password))
            {
                RequestSpecificValues.Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.New_Password;
            }

            if (RequestSpecificValues.Current_Mode.Logon_Required)
                RequestSpecificValues.Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Logon;

            RequestSpecificValues.Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Building the my sobek viewer object");
            switch (RequestSpecificValues.Current_Mode.My_Sobek_Type)
            {
                case My_Sobek_Type_Enum.Home:
                    mySobekViewer = new Home_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.New_Item:
                    mySobekViewer = new New_Group_And_Item_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Folder_Management:
                    mySobekViewer = new Folder_Mgmt_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Saved_Searches:
                    mySobekViewer = new Saved_Searches_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Preferences:
                    mySobekViewer = new Preferences_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Logon:
                    mySobekViewer = new Logon_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.New_Password:
                    mySobekViewer = new NewPassword_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Delete_Item:
                    mySobekViewer = new Delete_Item_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Edit_Item_Behaviors:
                    mySobekViewer = new Edit_Item_Behaviors_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Edit_Item_Metadata:
                    mySobekViewer = new Edit_Item_Metadata_MySobekViewer( RequestSpecificValues.Current_Item, RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Edit_Item_Permissions:
                    mySobekViewer = new Edit_Item_Permissions_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.File_Management:
                    mySobekViewer = new File_Management_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Edit_Group_Behaviors:
                    mySobekViewer = new Edit_Group_Behaviors_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Edit_Group_Serial_Hierarchy:
                    mySobekViewer = new Edit_Serial_Hierarchy_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Item_Tracking:
                    mySobekViewer = new Track_Item_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Group_Add_Volume:
                    // Pull the list of items tied to this group
                    SobekCM_Items_In_Title itemsInTitle = CachedDataManager.Retrieve_Items_In_Title(RequestSpecificValues.Current_Item.BibID, RequestSpecificValues.Tracer);
                    if (itemsInTitle == null)
                    {
                        // Get list of information about this item group and save the item list
                        DataSet itemDetails = Engine_Database.Get_Item_Group_Details(RequestSpecificValues.Current_Item.BibID, RequestSpecificValues.Tracer);
                        itemsInTitle = new SobekCM_Items_In_Title(itemDetails.Tables[1]);

                        // Store in cache if retrieved
                        CachedDataManager.Store_Items_In_Title(RequestSpecificValues.Current_Item.BibID, itemsInTitle, RequestSpecificValues.Tracer);
                    }
                    mySobekViewer = new Group_Add_Volume_MySobekViewer(RequestSpecificValues, itemsInTitle );
                    break;

                case My_Sobek_Type_Enum.Group_AutoFill_Volumes:
                    mySobekViewer = new Group_AutoFill_Volume_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Group_Mass_Update_Items:
                    mySobekViewer = new Mass_Update_Items_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.Page_Images_Management:
                    mySobekViewer = new Page_Image_Upload_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.User_Tags:
                    mySobekViewer = new User_Tags_MySobekViewer(RequestSpecificValues);
                    break;

                case My_Sobek_Type_Enum.User_Usage_Stats:
                    mySobekViewer = new User_Usage_Stats_MySobekViewer(RequestSpecificValues);
                    break;
            }
        }
コード例 #3
0
        /// <summary> Builds a title-level digital resource object for the given BibID </summary>
        /// <param name="BibID"> Bibliographic identifier for the digital resource to build </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <param name="Item_Group_Object"> [OUT] Fully built item group object </param>
        /// <param name="Items_In_Title"> [OUT] List of all the items in this title </param>
        /// <remarks> This method relies heavily upon the <see cref="SobekCM_METS_Based_ItemBuilder"/> class to actually
        /// read the METS files and build the items. </remarks>
        public static void Get_Item_Group(string BibID, Custom_Tracer Tracer, out SobekCM_Items_In_Title Items_In_Title, out SobekCM_Item Item_Group_Object)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("SobekCM_Item_Factory.Get_Item_Group", "Build this item group");
            }

            // Get the METS based item builder
            SobekCM_METS_Based_ItemBuilder builder = new SobekCM_METS_Based_ItemBuilder();

            // Allow the builder to build the item
            builder.Build_Item_Group(BibID, Tracer, out Items_In_Title, out Item_Group_Object );
        }
        /// <summary> Stores the list of items for a single bibid to the cache  </summary>
        /// <param name="BibID"> Bibliographic identifier for the list of items </param>
        /// <param name="StoreObject"> List of items within the single title </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        public void Store_Items_In_Title(string BibID, SobekCM_Items_In_Title StoreObject, Custom_Tracer Tracer)
        {
            // If the cache is disabled, just return before even tracing
            if (settings.Disabled)
                return;

            if (Tracer != null)
            {
                Tracer.Add_Trace("CachedDataManager_ItemServices.Store_Items_In_Title", "");
            }

            // Store this on the local cache, if not there and storing on the cache server failed
            string key = "ITEMLIST_" + BibID.ToUpper();
            if (HttpContext.Current.Cache[key] == null)
            {
                if (Tracer != null)
                {
                    Tracer.Add_Trace("CachedDataManager_ItemServices.Store_Items_In_Title", "Adding object '" + key + "' to the local cache with expiration of 1 minutes");
                }

                HttpContext.Current.Cache.Insert(key, StoreObject, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(1));
            }
        }
コード例 #5
0
        /// <summary> Get a digital resource for display or for editing </summary>
        /// <param name="Collection_Code"> Collection code to which this item must belong </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="All_Items_Lookup"> Lookup object used to pull basic information about any item loaded into this library </param>
        /// <param name="Base_URL"> Base URL for all the digital resource files for items to display </param>
        /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param>
        /// <param name="Current_User"> Currently logged on user information (used when editing an item)</param>
        /// <param name="Item_Viewer_Priority"> List of the globally defined item viewer priorities </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <param name="Current_Item"> [OUT] Built single digital resource ready for displaying or editing </param>
        /// <param name="Current_Page"> [OUT] Build current page for display </param>
        /// <param name="Items_In_Title"> [OUT] List of all the items in this title </param>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        /// <remarks> This attempts to pull the objects from the cache.  If unsuccessful, it builds the objects from the
        /// database and hands off to the <see cref="CachedDataManager" /> to store in the cache.  If the item must be 
        /// built from scratch, the <see cref="SobekCM_Item_Factory"/> class is utilized. </remarks>
        public bool Get_Item(string Collection_Code, 
                             Navigation_Object Current_Mode, 
                             Item_Lookup_Object All_Items_Lookup, 
                             string Base_URL, 
                             Dictionary<string, Wordmark_Icon> Icon_Table, 
							 List<string> Item_Viewer_Priority,
							 Custom_Tracer Tracer, 
                             User_Object Current_User,
                             out SobekCM_Item Current_Item,
                             out Page_TreeNode Current_Page,
                             out SobekCM_Items_In_Title Items_In_Title)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("SobekCM_Assistant.Get_Item", String.Empty);
            }

            // Initially assign nulls
            Current_Item = null;
            Current_Page = null;
            Items_In_Title = null;

            // Check for legacy reference by itemid
            if ((Current_Mode.BibID.Length == 0) && (Current_Mode.ItemID_DEPRECATED.HasValue))
            {
                DataRow thisRowInfo = SobekCM_Database.Lookup_Item_By_ItemID(Current_Mode.ItemID_DEPRECATED.Value, Tracer);
                if (thisRowInfo == null)
                {
                    Current_Mode.Invalid_Item = true;
                    return false;
                }

                Current_Mode.Mode = Display_Mode_Enum.Legacy_URL;
                Current_Mode.Error_Message = Current_Mode.Base_URL + thisRowInfo["BibID"] + "/" + thisRowInfo["VID"];
                return false;
            }

            // Must at least have a bib id of the proper length
            if (Current_Mode.BibID.Length < 10)
            {
                Current_Mode.Invalid_Item = true;
                return false;
            }

            // Get the title object for this
            bool item_group_display = false;
            Multiple_Volume_Item dbTitle = All_Items_Lookup.Title_By_Bib(Current_Mode.BibID);
            if (dbTitle == null)
            {
                Current_Mode.Invalid_Item = true;
                return false;
            }

            // Try to get the very basic information about this item, to determine if the
            // bib / vid combination is valid
            Single_Item selected_item = null;

            // Certain mySobek modes only need the item group
            if (( Current_Mode.Mode == Display_Mode_Enum.My_Sobek ) && (( Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Edit_Group_Behaviors ) || ( Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Edit_Group_Serial_Hierarchy ) || ( Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Group_Add_Volume ) || ( Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Group_AutoFill_Volumes ) || ( Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Group_Mass_Update_Items )))
            {
                item_group_display = true;
            }

            // If this is not a mode that is only item group display, try to pull the item
            if (!item_group_display)
            {
                if (( !String.IsNullOrEmpty(Current_Mode.VID)) && (Current_Mode.VID != "00000"))
                {
                    selected_item = All_Items_Lookup.Item_By_Bib_VID(Current_Mode.BibID, Current_Mode.VID, Tracer);
                }
                else
                {
                    if ((dbTitle.Item_Count == 1) && (( String.IsNullOrEmpty(Current_Mode.VID)) || ( Current_Mode.VID != "00000")))
                    {
                        selected_item = All_Items_Lookup.Item_By_Bib_Only(Current_Mode.BibID);
                    }
                    else
                    {
                        item_group_display = true;
                    }
                }
            }

            // If no valid item and not a valid item group display either, return
            if ((selected_item == null) && (!item_group_display))
            {
                Current_Mode.Invalid_Item = true;
                return false;
            }

            // If this is for a single item, return that
            if (selected_item != null)
            {
                // Make sure the VID is set
                Current_Mode.VID = selected_item.VID;

                // Try to get this from the cache
                if ((Current_Mode.Mode == Display_Mode_Enum.My_Sobek) && ( Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Edit_Item_Metadata ) && (Current_User != null))
                    Current_Item = CachedDataManager.Retrieve_Digital_Resource_Object(Current_User.UserID, Current_Mode.BibID, Current_Mode.VID, Tracer);
                else
                    Current_Item = CachedDataManager.Retrieve_Digital_Resource_Object( Current_Mode.BibID, Current_Mode.VID, Tracer);

                // If not pulled from the cache, then we will have to build the item
                if (Current_Item == null)
                {
                    if (Tracer != null)
                    {
                        Tracer.Add_Trace("SobekCM_Assistant.Get_Item", "Build the item");
                    }

                    Current_Item = SobekCM_Item_Factory.Get_Item(Current_Mode.BibID, Current_Mode.VID, Icon_Table, Item_Viewer_Priority, Tracer);
                    if (Current_Item != null)
                    {
                        if ((Current_Mode.Mode == Display_Mode_Enum.My_Sobek) && (Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Edit_Item_Metadata) && (Current_User != null))
                        {
                            string note_to_add = "Online edit by " + Current_User.Full_Name + " ( " + DateTime.Now.ToShortDateString() + " )";
                            Current_Item.METS_Header.Add_Creator_Individual_Notes( note_to_add );
                            CachedDataManager.Store_Digital_Resource_Object(Current_User.UserID, Current_Mode.BibID, Current_Mode.VID, Current_Item, Tracer);
                        }
                        else
                            CachedDataManager.Store_Digital_Resource_Object(Current_Mode.BibID, Current_Mode.VID, Current_Item, Tracer);
                    }
                }
                else
                {
                    if (Tracer != null)
                    {
                        Tracer.Add_Trace("SobekCM_Assistant.Get_Item", "Item found in the cache");
                    }
                }

                // If an item was requested and none was found, go to the current home
                if ((Current_Item == null))
                {
                    if (Tracer != null && !Tracer.Enabled)
                    {
                        Current_Mode.Mode = Display_Mode_Enum.Aggregation;
                        Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Home;
                        return false;
                    }
                    return false;
                }

                // Get the page to display (printing has its own specification of page(s) to display)
                if (Current_Mode.Mode != Display_Mode_Enum.Item_Print)
                {
                    if (Tracer != null)
                    {
                        Tracer.Add_Trace("SobekCM_Assistant.Get_Item", "Get the current page");
                    }

                    // Get the page count in the results
                    int current_page_index = Current_Mode.Page.HasValue ? Math.Max(Current_Mode.Page.Value, ((ushort)1)) : 1;
                    Current_Page = SobekCM_Item_Factory.Get_Current_Page(Current_Item, current_page_index, Tracer);
                }
            }
            else
            {
                // Try to get this from the cache
                Current_Item = CachedDataManager.Retrieve_Digital_Resource_Object(Current_Mode.BibID, Tracer);

                // Have to build this item group information then
                if (Current_Item == null)
                {
                    string bibID = Current_Mode.BibID;
                    SobekCM_Item_Factory.Get_Item_Group(bibID, Tracer, out Items_In_Title, out Current_Item );
                    if (Tracer != null)
                    {
                        Tracer.Add_Trace("SobekCM_Assistant.Get_Item", "TEST LOG ENTRY");
                    }

                    if (Current_Item == null)
                    {
                        Exception ee = SobekCM_Database.Last_Exception;
                        if (Tracer != null)
                            Tracer.Add_Trace("SobekCM_Assistant.Get_Item", ee != null ? ee.Message : "NO DATABASE EXCEPTION", Custom_Trace_Type_Enum.Error);

                        Current_Mode.Invalid_Item = true;
                        return false;
                    }

                    // Put this back on the cache
                    Current_Item.METS_Header.RecordStatus_Enum = METS_Record_Status.BIB_LEVEL;
                    CachedDataManager.Store_Digital_Resource_Object(bibID, Current_Item, Tracer);
                    CachedDataManager.Store_Items_In_Title(bibID, Items_In_Title, Tracer);
                }
            }

            return true;
        }
コード例 #6
0
        /// <summary> Get a digital resource for display or for editing </summary>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="All_Items_Lookup"> Lookup object used to pull basic information about any item loaded into this library </param>
        /// <param name="Base_URL"> Base URL for all the digital resource files for items to display </param>
        /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param>
        /// <param name="Item_Viewer_Priority"> List of the globally defined item viewer priorities  </param>
        /// <param name="Current_User"> Currently logged on user information (used when editing an item)</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <param name="Current_Item"> [OUT] Built single digital resource ready for displaying or editing </param>
        /// <param name="Current_Page"> [OUT] Build current page for display </param>
        /// <param name="Items_In_Title"> [OUT] List of all the items in this title </param>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        /// <remarks> This attempts to pull the objects from the cache.  If unsuccessful, it builds the objects from the
        /// database and hands off to the <see cref="CachedDataManager" /> to store in the cache.  If the item must be 
        /// built from scratch, the <see cref="SobekCM_Item_Factory"/> class is utilized. </remarks>
        public bool Get_Item(Navigation_Object Current_Mode,
                             Item_Lookup_Object All_Items_Lookup,
                             string Base_URL, 
                             Dictionary<string, Wordmark_Icon> Icon_Table,
							 List<string> Item_Viewer_Priority,
							 User_Object Current_User,
                             Custom_Tracer Tracer, 
                             out SobekCM_Item Current_Item, 
                             out Page_TreeNode Current_Page,
                             out SobekCM_Items_In_Title Items_In_Title )
        {
            return Get_Item(String.Empty, Current_Mode, All_Items_Lookup, Base_URL, Icon_Table, Item_Viewer_Priority, Tracer, Current_User, out Current_Item, out Current_Page, out Items_In_Title);
        }
コード例 #7
0
        /// <summary> Gets the list of all items within this item group, indicated by BibID, including additional information for the SMaRT tracking application </summary>
        /// <param name="BibID"> Bibliographic identifier for the title of interest </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <returns> Strongly typed dataset with information about the title (item group), including volumes, icons, and skins</returns>
        /// <remarks> This calls the 'Tracking_Get_Multiple_Volumes' stored procedure <br /><br />
        /// This is very similar to the <see cref="Engine_Database.Get_Multiple_Volumes" /> method, except it returns more information, since
        /// the tracking application does not have basic information about each item/title in its cache, unlike the
        /// web server application, which does cache this information. </remarks>
        public static SobekCM_Items_In_Title Tracking_Multiple_Volumes(string BibID, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Engine_Database.Tracking_Multiple_Volumes", "List of volumes for " + BibID + " pulled from database");
            }

            try
            {
                // Run the SQL and get back a dataset
                DataSet valueSet = EalDbAccess.ExecuteDataset(DatabaseType, Connection_String, CommandType.StoredProcedure, "Tracking_Get_Multiple_Volumes", new EalDbParameter[] { new EalDbParameter("@bibid", BibID) });

                // If there was either no match, or more than one, return null
                if ((valueSet.Tables.Count == 0) || (valueSet.Tables[0] == null) || (valueSet.Tables[0].Rows.Count == 0))
                {
                    return null;
                }

                // Create the object
                SobekCM_Items_In_Title returnValue = new SobekCM_Items_In_Title(valueSet.Tables[0]);

                // Return the fully built object
                return returnValue;
            }
            catch (Exception ee)
            {
                Last_Exception = ee;
                return null;
            }
        }
コード例 #8
0
 /// <summary> Constructor for a new instance of the RequestCache class </summary>
 /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
 /// <param name="Hierarchy_Object"> Current item aggregation object to display </param>
 /// <param name="Results_Statistics"> Information about the entire set of results for a search or browse </param>
 /// <param name="Paged_Results"> Single page of results for a search or browse, within the entire set </param>
 /// <param name="Browse_Object"> Object contains all the basic information about any browse or info display </param>
 /// <param name="Current_Item"> Current item to display </param>
 /// <param name="Current_Page"> Current page within the item</param>
 /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param>
 /// <param name="Current_User"> Currently logged on user </param>
 /// <param name="Public_Folder"> Object contains the information about the public folder to display </param>
 /// <param name="Site_Map"> Optional site map object used to render a navigational tree-view on left side of static web content pages </param>
 /// <param name="Items_In_Title"> List of items within the current title ( used for the Item Group display )</param>
 /// <param name="Static_Web_Content"> HTML content-based browse, info, or imple CMS-style web content objects.  These are objects which are read from a static HTML file and much of the head information must be maintained </param>
 /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
 public RequestCache(Navigation_Object Current_Mode,
     Item_Aggregation Hierarchy_Object,
     Search_Results_Statistics Results_Statistics,
     List<iSearch_Title_Result> Paged_Results,
     Item_Aggregation_Child_Page Browse_Object,
     SobekCM_Item Current_Item,
     Page_TreeNode Current_Page,
     Web_Skin_Object HTML_Skin,
     User_Object Current_User,
     Public_User_Folder Public_Folder,
     SobekCM_SiteMap Site_Map,
     SobekCM_Items_In_Title Items_In_Title,
     HTML_Based_Content Static_Web_Content,
     Custom_Tracer Tracer)
 {
     this.Current_Mode = Current_Mode;
     this.Hierarchy_Object = Hierarchy_Object;
     this.Results_Statistics = Results_Statistics;
     this.Paged_Results = Paged_Results;
     this.Browse_Object = Browse_Object;
     this.Current_Item = Current_Item;
     this.Current_Page = Current_Page;
     this.HTML_Skin = HTML_Skin;
     this.Current_User = Current_User;
     this.Public_Folder = Public_Folder;
     this.Site_Map = Site_Map;
     this.Items_In_Title = Items_In_Title;
     this.Static_Web_Content = Static_Web_Content;
     this.Tracer = Tracer;
 }
コード例 #9
0
        //// THIS HAS BEEN REPLACED BY ITEM GROUP DETAILS (WHICH IS VERY SIMILAR)
        ///// <summary> Gets the information about a title (item group) by BibID, including volumes, icons, and skins </summary>
        ///// <param name="BibID"> Bibliographic identifier for the title of interest </param>
        ///// <param name="tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        ///// <returns> Strongly typed dataset with information about the title (item group), including volumes, icons, and skins</returns>
        ///// <remarks> This calls the 'SobekCM_Get_Multiple_Volumes' stored procedure </remarks>
        //public static Group_Information Get_Multiple_Volumes(string BibID, Custom_Tracer tracer)
        //{
        //    if (tracer != null)
        //    {
        //        tracer.Add_Trace("SobekCM_Database.Get_Multiple_Volumes", "List of volumes for " + BibID + " pulled from database");
        //    }
        //    try
        //    {
        //        // Create the connection
        //        SqlConnection connect = new SqlConnection(connectionString);
        //        // Create the command
        //        SqlCommand executeCommand = new SqlCommand("SobekCM_Get_Multiple_Volumes", connect);
        //        executeCommand.CommandType = CommandType.StoredProcedure;
        //        executeCommand.Parameters.AddWithValue("@bibid", BibID);
        //        // Create the adapter
        //        SqlDataAdapter adapter = new SqlDataAdapter(executeCommand);
        //        // Add appropriate table mappings
        //        adapter.TableMappings.Add("Table", "Group");
        //        adapter.TableMappings.Add("Table1", "Item");
        //        adapter.TableMappings.Add("Table2", "Icon");
        //        // Fill the strongly typed dataset
        //        Group_Information thisGroup = new Group_Information();
        //        adapter.Fill(thisGroup);
        //        // If there was either no match, or more than one, return null
        //        if ((thisGroup == null) || (thisGroup.Tables.Count == 0) || (thisGroup.Tables[0] == null) || (thisGroup.Tables[0].Rows.Count == 0))
        //        {
        //            return null;
        //        }
        //        // Return the fully built object
        //        return thisGroup;
        //    }
        //    catch (Exception ee)
        //    {
        //        last_exception = ee;
        //        return null;
        //    }
        //}
        /// <summary> Gets the list of all items within this item group, indicated by BibID </summary>
        /// <param name="BibID"> Bibliographic identifier for the title of interest </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <returns> Strongly typed dataset with information about the title (item group), including volumes, icons, and skins</returns>
        /// <remarks> This calls the 'SobekCM_Get_Multiple_Volumes' stored procedure </remarks>
        public static SobekCM_Items_In_Title Get_Multiple_Volumes(string BibID, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("SobekCM_Database.Get_Multiple_Volumes", "List of volumes for " + BibID + " pulled from database");
            }

            try
            {
                DataSet valueSet = EalDbAccess.ExecuteDataset(DatabaseType, connectionString, CommandType.StoredProcedure, "SobekCM_Get_Multiple_Volumes", new List<EalDbParameter> { new EalDbParameter("@bibid", BibID) });

                // If there was either no match, or more than one, return null
                if ((valueSet.Tables.Count == 0) || (valueSet.Tables[0] == null) || (valueSet.Tables[0].Rows.Count == 0))
                {
                    return null;
                }

                // Create the object
                SobekCM_Items_In_Title returnValue = new SobekCM_Items_In_Title(valueSet.Tables[0]);

                // Return the fully built object
                return returnValue;
            }
            catch (Exception ee)
            {
                lastException = ee;
                if (Tracer != null)
                {
                    Tracer.Add_Trace("SobekCM_Database.Get_Multiple_Volumes", "Exception caught during database work", Custom_Trace_Type_Enum.Error);
                    Tracer.Add_Trace("SobekCM_Database.Get_Multiple_Volumes", ee.Message, Custom_Trace_Type_Enum.Error);
                    Tracer.Add_Trace("SobekCM_Database.Get_Multiple_Volumes", ee.StackTrace, Custom_Trace_Type_Enum.Error);
                }
                return null;
            }
        }