예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                browseContentPanel.SetTableID("browseContentPanel");
                Master.Page.Header.Controls.Add(ControlGenerator.GetScriptControl("/Scripts/ResizeBrowseUtils.js"));
                ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload",
                                                                  "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);");
                ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize",
                                                                  "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);");

                main.SetPageType(Main.PageType.Content);
            }

            if ((Request.QueryString["titleid"] != null ||
                 Request.QueryString["pid"] != null || Request.QueryString["title"] != null ||
                 Request.QueryString["stitle"] != null) &&
                ((Request.QueryString["volume"] != null) || (Request.QueryString["issue"] != null) ||
                 (Request.QueryString["year"] != null) || (Request.QueryString["startpage"] != null) ||
                 (Request.QueryString["spage"] != null) || (Request.QueryString["date"] != null)))
            {
                string volume    = "";
                string issue     = "";
                string year      = "";
                string startpage = "";

                if (Request.QueryString["volume"] != null)
                {
                    volume = Request.QueryString["volume"].ToString();
                }
                if (Request.QueryString["issue"] != null)
                {
                    issue = Request.QueryString["issue"].ToString();
                }
                if (Request.QueryString["year"] != null)
                {
                    year = Request.QueryString["year"].ToString();
                }
                if (Request.QueryString["startpage"] != null)
                {
                    startpage = Request.QueryString["startpage"].ToString();
                }
                if (Request.QueryString["spage"] != null)
                {
                    startpage = Request.QueryString["spage"].ToString();
                }
                if (Request.QueryString["date"] != null)
                {
                    year = Request.QueryString["date"].ToString();
                }

                //see if this is a valid date value...if so, only use the year portion
                DateTime date;
                if (DateTime.TryParse(year, out date))
                {
                    year = date.Year.ToString();
                }

                if (volume.Trim().Length == 0)
                {
                    volumeLiteral.Text = "not supplied";
                }
                else
                {
                    volumeLiteral.Text = volume;
                }

                if (issue.Trim().Length == 0)
                {
                    issueLiteral.Text = "not supplied";
                }
                else
                {
                    issueLiteral.Text = issue;
                }

                if (year.Trim().Length == 0)
                {
                    yearLiteral.Text = "not supplied";
                }
                else
                {
                    yearLiteral.Text = year;
                }

                if (startpage.Trim().Length == 0)
                {
                    startPageLiteral.Text = "not supplied";
                }
                else
                {
                    startPageLiteral.Text = startpage;
                }

                int    titleId      = 0;
                string fullTitle    = "";
                string abbreviation = "";

                if (Request.QueryString["titleid"] != null)
                {
                    int.TryParse(Request.QueryString["titleid"], out titleId);
                }

                if (Request.QueryString["pid"] != null)
                {
                    int.TryParse(Request.QueryString["pid"], out titleId);
                }

                if (Request.QueryString["title"] != null)
                {
                    fullTitle = Request.QueryString["title"];
                }
                if (Request.QueryString["stitle"] != null)
                {
                    abbreviation = Request.QueryString["stitle"];
                }

                MOBOT.BHL.DataObjects.Title title = null;
                if (titleId > 0)
                {
                    title = bhlProvider.TitleSelectAuto(titleId);
                }
                else if (fullTitle != null && fullTitle.Trim().Length > 0)
                {
                    CustomGenericList <MOBOT.BHL.DataObjects.Title> titleList = bhlProvider.TitleSelectByFullTitle(fullTitle);
                    if (titleList.Count == 1)
                    {
                        titleId = titleList[0].TitleID;
                    }
                }
                else if (abbreviation != null && abbreviation.Trim().Length > 0)
                {
                    CustomGenericList <MOBOT.BHL.DataObjects.Title> titleList = bhlProvider.TitleSelectByAbbreviation(abbreviation);
                    if (titleList.Count == 1)
                    {
                        titleId = titleList[0].TitleID;
                    }
                }

                PageSummaryView ps = null;

                if (titleId > 0)
                {
                    ps = bhlProvider.PageTitleSummarySelectByTitleId(titleId);
                }

                if (ps == null)
                {
                    resultMessageLiteral.Text = "We're sorry, but we were not able to map your request to a particular title.";
                }
                else
                {
                    titleLiteral.Text         = ps.FullTitle;
                    resultMessageLiteral.Text = "Title found...move on to the next step...";
                    CustomGenericList <CustomDataRow> list = bhlProvider.PageResolve(ps.TitleID, volume, issue, year, startpage);
                    if (!UniqueItemFound(list))
                    {
                        // Couldn't narrow down to a single item/volume, therefore, redirect to the bibliography page and let them choose
                        // from there
                        resultMessageLiteral.Text = "We're sorry, but we were unable to resolve the page you requested to a unique " +
                                                    "item. Please visit the <a href=\"/bibliography/" + ps.TitleID.ToString() + "\">bibliography</a> page for " +
                                                    "this title to browse for the requested page.";
                    }
                    else if (list.Count > 1 || !IsResultAnExactMatch(list[0]))
                    {
                        // Multiple results so show the results and let the user pick
                        resultMessageLiteral.Text = "We're sorry, but we were not able to find an exact match based on the above " +
                                                    "criteria. However, we did find options that are close. Please select one of the pages below or visit the " +
                                                    "<a href=\"/bibliography/" + ps.TitleID.ToString() + "\">bibliography</a> page for this title to browse " +
                                                    "for the requested page.<br />";

                        // Kind of kludgy, but since we don't have a typed object to work with, we can't bind to a repeater.
                        foreach (CustomDataRow row in list)
                        {
                            string singleResut = "<br /><a href=\"page/" + row["PageID"].Value.ToString() + "\">";
                            if (row["Year"].Value != null)
                            {
                                singleResut += "Year: " + row["Year"].Value.ToString() + "; ";
                            }

                            if (row["Issue"].Value != null)
                            {
                                singleResut += "Issue: " + row["Issue"].Value.ToString() + "; ";
                            }

                            if (row["Volume"].Value != null)
                            {
                                singleResut += "Volume: " + row["Volume"].Value.ToString() + "; ";
                            }

                            if (row["PagePrefix"].Value != null && row["PageNumber"].Value != null)
                            {
                                singleResut += "Start Page: " + row["PagePrefix"].Value.ToString() + " " +
                                               row["PageNumber"].Value.ToString() + "; ";
                            }

                            singleResut += "(ID: " + row["PageID"].Value.ToString() + ")</a><br />";

                            similarResultsLiteral.Text += singleResut;
                        }
                    }
                    else
                    {
                        // Narrowed it down to one potential page. If all criteria matches exactly, redirect to title page.
                        // Otherwise display the single result and acknowledge that it is not an exact match
                        Response.Redirect("/page/" + list[0]["PageID"].Value.ToString());
                    }
                }
            }
            else
            {
                resultMessageLiteral.Text = "We're sorry, but we were not able to map your request to a particular title.";
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            main.SetPageType(Main.PageType.Content);
            ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js");
            ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/jquery-1.2.6.min.js");
            ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload",
                                                              "ResizeContentPanel('browseContentPanel', 258);ResizeBrowseDivs();");
            ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize",
                                                              "ResizeContentPanel('browseContentPanel', 258);ResizeBrowseDivs();");

            Data.PageSummaryView              ps        = null;
            CustomGenericList <Data.Item>     items     = null;
            CustomGenericList <Data.Creator>  creators  = null;
            CustomGenericList <Data.TitleTag> titleTags = null;
            CustomGenericList <Data.Title_TitleIdentifier> titleIdentifiers  = null;
            CustomGenericList <Data.TitleAssociation>      titleAssociations = null;

            Data.Title title    = null;
            bool       showData = false;
            int        titleId  = 0;

            if (Request["titleid"] != null)
            {
                if (!int.TryParse(Request.QueryString["titleid"], out titleId))
                {
                    // Request seems to have included a MARCBibID instead of a TitleId
                    Data.PageSummaryView psBib = bhlProvider.PageTitleSummarySelectByBibID(Request.QueryString["titleid"].ToString());
                    if (psBib != null)
                    {
                        titleId = psBib.TitleID;
                    }
                }
                showData = true;
            }

            if (!showData && Request.QueryString["oclc"] != null)
            {
                // Get the title id associated with the OCLC identifier
                Data.Title_TitleIdentifier titleTitleId = bhlProvider.Title_TitleIdentifierSelectByIdentifierValue(Request.QueryString["oclc"].ToString());
                if (titleTitleId != null)
                {
                    titleId = titleTitleId.TitleID;
                }
                showData = true;
            }

            if (showData)
            {
                hidTitleID.Value = titleId.ToString();

                // Check to make sure this title hasn't been replaced.  If it has, redirect
                // to the appropriate titleid.
                title = bhlProvider.TitleSelect(titleId);
                if (title.RedirectTitleID != null)
                {
                    Response.Redirect("/bibliography/" + title.RedirectTitleID.ToString());
                    Response.End();
                }

                // Set the title for the COinS
                COinSControl1.TitleID = titleId;

                ps = bhlProvider.PageTitleSummarySelectByTitleId(titleId);
                if (ps == null)
                {
                    Response.Redirect("/TitleNotFound.aspx");
                    Response.End();
                }
                Barcode           = ps.BarCode;
                creators          = bhlProvider.CreatorSelectByTitleId(titleId);
                items             = bhlProvider.ItemSelectByTitleId(titleId);
                titleTags         = bhlProvider.TitleTagSelectTagTextByTitleId(titleId);
                titleIdentifiers  = bhlProvider.Title_TitleIdentifierSelectByTitleID(titleId);
                titleAssociations = bhlProvider.TitleAssociationSelectByTitleId(titleId, true);

                if (titleAssociations.Count == 0)
                {
                    associationsDiv.Visible = false;
                }
                else
                {
                    associationsDiv.Visible         = true;
                    associationsRepeater.DataSource = titleAssociations;
                    associationsRepeater.DataBind();
                }

                foreach (Data.Item item in items)
                {
                    // Populate empty volume descriptions with default text
                    if (item.Volume == String.Empty || item.Volume == null)
                    {
                        if (items.Count == 1)
                        {
                            item.Volume = "View Book";
                        }
                        if (items.Count > 1)
                        {
                            item.Volume = "(no volume description)";
                        }
                    }

                    // Make sure all Botanicus PDFs actually exist.  Remove the DownloadUrl for any that do not.
                    if (item.DownloadUrl != String.Empty && item.ItemSourceID == 2)
                    {
                        // This is kludgy... should find a better way to do this
                        String pdfLocation = item.DownloadUrl.Replace("http://www.botanicus.org/", "\\\\server\\").Replace('/', '\\');
                        if (new BHLProvider().GetFileAccessProvider(ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true").FileExists(pdfLocation))
                        {
                            item.DownloadUrl = ConfigurationManager.AppSettings["PdfAuthUrl"] != null?String.Format(ConfigurationManager.AppSettings["PdfAuthUrl"], item.BarCode) : String.Empty;
                        }
                        else
                        {
                            item.DownloadUrl = String.Empty;
                        }
                    }
                }

                // Look for an OCLC identifier (use the first one... might need to account for multiple at some point)
                bool oclcFound = false;
                foreach (Data.Title_TitleIdentifier titleIdentifier in titleIdentifiers)
                {
                    if (String.Compare(titleIdentifier.IdentifierName, "OCLC", StringComparison.CurrentCultureIgnoreCase) == 0)
                    {
                        localLibraryLink.NavigateUrl += "wcpa/oclc/";
                        if (titleIdentifier.IdentifierValue.ToLower().StartsWith("ocm"))
                        {
                            //strip the "ocm" from the beginning of the value.
                            localLibraryLink.NavigateUrl += titleIdentifier.IdentifierValue.Substring(3);
                        }
                        else
                        {
                            localLibraryLink.NavigateUrl += titleIdentifier.IdentifierValue;
                        }
                        oclcFound = true;
                        break;
                    }
                }

                if (!oclcFound)
                {
                    string truncatedTitle = "";
                    if (title.FullTitle.Length > 220)
                    {
                        truncatedTitle = title.FullTitle.Substring(0, 220);
                        truncatedTitle = truncatedTitle.Substring(0, truncatedTitle.LastIndexOf(" "));
                    }
                    else
                    {
                        truncatedTitle = title.FullTitle;
                    }
                    localLibraryLink.NavigateUrl += "search?q=" + truncatedTitle.Replace(" ", "+") + "&qt=owc_search";
                }

                Master.Page.Title = "Biodiversity Heritage Library: Information about '" + ps.FullTitle + "'";
                //descriptionLiteral.Text = title.TitleDescription;
                publicationInfoLiteral.Text = title.PublicationDetails;
                fullTitleLiteral.Text       = title.FullTitle + " " + (title.PartNumber ?? "") + " " + (title.PartName ?? "");
                if (title.CallNumber == null || title.CallNumber.Length == 0)
                {
                    callNumberPanel.Visible = false;
                }
                else
                {
                    callNumberLiteral.Text = title.CallNumber;
                }

                if (titleTags == null || titleTags.Count == 0)
                {
                    subjectPanel.Visible = false;
                }
                else
                {
                    int           k  = titleTags.Count - 1;
                    int           i  = 0;
                    StringBuilder sb = new StringBuilder();
                    foreach (Data.TitleTag titleTag in titleTags)
                    {
                        sb.Append("<a href='/subject/");
                        sb.Append(Server.UrlEncode(titleTag.TagText));
                        sb.Append("'>");
                        sb.Append(titleTag.TagText);
                        sb.Append("</a>");

                        if (i + 1 <= k)
                        {
                            sb.Append(", ");
                        }
                        i++;
                    }
                    subjectLiteral.Text = sb.ToString();
                }

                itemRepeater.DataSource = items;
                itemRepeater.DataBind();

                CustomGenericList <Data.Creator> authors           = new CustomGenericList <Data.Creator>();
                CustomGenericList <Data.Creator> additionalAuthors = new CustomGenericList <Data.Creator>();
                foreach (Data.Creator creator in creators)
                {
                    if (creator.CreatorRoleTypeForTitle >= 1 && creator.CreatorRoleTypeForTitle <= 3)
                    {
                        authors.Add(creator);
                    }
                    else
                    {
                        additionalAuthors.Add(creator);
                    }
                }
                authorsRepeater.DataSource = authors;
                authorsRepeater.DataBind();
                additionalAuthorsRepeater.DataSource = additionalAuthors;
                additionalAuthorsRepeater.DataBind();

                //Data.Institution institution = bhlProvider.InstitutionSelectByItemID( ps.ItemID );
                //if ( institution != null )
                //{
                //    if ( institution.InstitutionUrl != null && institution.InstitutionUrl.Trim().Length > 0 )
                //    {
                //        HyperLink link = new HyperLink();
                //        link.Text = institution.InstitutionName;
                //        link.NavigateUrl = institution.InstitutionUrl;
                //        link.Target = "_blank";
                //        attributionPlaceHolder.Controls.Add( link );
                //    }
                //    else
                //    {
                //        Literal literal = new Literal();
                //        literal.Text = institution.InstitutionName;
                //        attributionPlaceHolder.Controls.Add( literal );
                //    }
                //}

                if (Helper.IsAdmin(Request))
                {
                    editTitleLink.NavigateUrl = "/Admin/TitleEdit.aspx?id=" + titleId.ToString();
                }
                else
                {
                    editTitleLink.Visible = false;
                }

                // Get the full MARC details
                bool   marcFound = false;
                String filepath  = ps.MarcXmlLocation;
                bool   test      = (ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true");
                if (new BHLProvider().GetFileAccessProvider(ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true").FileExists(filepath))
                {
                    marcFound = true;
                }
                else
                {
                    // File not found in primary location, so look in alternate location (Botanicus files in alt location)
                    filepath = ps.MarcXmlAltLocation;
                    if (new BHLProvider().GetFileAccessProvider(ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true").FileExists(filepath))
                    {
                        marcFound = true;
                    }
                }

                if (marcFound)
                {
                    string marcXML = new BHLProvider().GetFileAccessProvider(ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true").GetFileText(filepath);

                    XmlDocument  xml    = new XmlDocument();
                    StringReader reader = new StringReader(marcXML);
                    xml.Load(reader);

                    // Set up the XSL resolver that we'll use to extract the text from the xml
                    XmlUrlResolver resolver = new XmlUrlResolver();
                    resolver.Credentials = System.Net.CredentialCache.DefaultCredentials;
                    System.Xml.Xsl.XslTransform xslTransform = new System.Xml.Xsl.XslTransform();

                    // Format the MARC XML into a "readable" format
                    xslTransform.Load(Request.PhysicalApplicationPath + "xsl\\MARC21transformEnglish.xsl", resolver);
                    StringWriter output = new StringWriter();
                    xslTransform.Transform(xml, null, output, resolver);
                    litExpanded.Text = output.ToString();

                    // Format the MARC XML into a "flat" MARC format
                    xslTransform.Load(Request.PhysicalApplicationPath + "xsl\\MARC21transformMARC.xsl", resolver);
                    output = new StringWriter();
                    xslTransform.Transform(xml, null, output, resolver);
                    litMarc.Text = output.ToString();

                    viewcontrol.Visible = true;
                }
                else
                {
                    viewcontrolnomarc.Visible = true;
                }

                // Get the BibTex citations for this title
                try
                {
                    hypBibTex.NavigateUrl += title.TitleID.ToString();
                    litBibTeX.Text         = bhlProvider.TitleBibTeXGetCitationStringForTitleID(title.TitleID).Replace("\n", "<br>").Replace("\r", "<br>");
                }
                catch
                {
                    hypBibTex.Visible = false;
                    litBibTeX.Text    = "Error retrieving BibTex citations for this title.";
                }

                // Get the EndNote citation for this title
                try
                {
                    hypEndNote.NavigateUrl += title.TitleID.ToString();
                    litEndNote.Text         = bhlProvider.TitleEndNoteGetCitationStringForTitleID(title.TitleID,
                                                                                                  ConfigurationManager.AppSettings["ItemPageUrl"].ToString()).Replace("\n", "<br>").Replace("\r", "<br>");
                }
                catch
                {
                    hypEndNote.Visible = false;
                    litEndNote.Text    = "Error retrieving EndNote citations for this title.";
                }
            }
        }
예제 #3
0
        public static void Save(SqlConnection sqlConnection, SqlTransaction sqlTransaction, Title title, int userId)
        {
            SqlConnection connection = sqlConnection;
            SqlTransaction transaction = sqlTransaction;

            if ( connection == null )
            {
                connection =
                    CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ) );
            }

            bool isTransactionCoordinator = CustomSqlHelper.IsTransactionCoordinator( transaction );

            try
            {
                transaction = CustomSqlHelper.BeginTransaction( connection, transaction, isTransactionCoordinator );

                CustomDataAccessStatus<Title> updatedTitle =
                    new TitleDAL().TitleManageAuto( connection, transaction, title, userId );

                if ( title.TitleCreators.Count > 0 )
                {
                    Title_CreatorDAL titleCreatorDAL = new Title_CreatorDAL();
                    foreach ( Title_Creator titleCreator in title.TitleCreators )
                    {
                        if (titleCreator.TitleID == 0) titleCreator.TitleID = updatedTitle.ReturnObject.TitleID;
                        titleCreatorDAL.Title_CreatorManageAuto( connection, transaction, titleCreator, userId );
                    }
                }

                if (title.TitleTags.Count > 0)
                {
                    TitleTagDAL titleTagDAL = new TitleTagDAL();
                    foreach (TitleTag titleTag in title.TitleTags)
                    {
                        if (titleTag.TitleID == 0) titleTag.TitleID = updatedTitle.ReturnObject.TitleID;
                        titleTagDAL.TitleTagManageAuto(connection, transaction, titleTag);
                    }
                }

                if (title.TitleIdentifiers.Count > 0)
                {
                    Title_TitleIdentifierDAL titleTitleIdentifierDAL = new Title_TitleIdentifierDAL();
                    foreach (Title_TitleIdentifier titleTitleIdentifier in title.TitleIdentifiers)
                    {
                        if (titleTitleIdentifier.TitleID == 0) titleTitleIdentifier.TitleID = updatedTitle.ReturnObject.TitleID;
                        titleTitleIdentifierDAL.Title_TitleIdentifierManageAuto(connection, transaction, titleTitleIdentifier);
                    }
                }

                if (title.TitleAssociations.Count > 0)
                {
                    TitleAssociationDAL titleAssociationDAL = new TitleAssociationDAL();
                    foreach (TitleAssociation titleAssociation in title.TitleAssociations)
                    {
                        if (titleAssociation.TitleID == 0) titleAssociation.TitleID = updatedTitle.ReturnObject.TitleID;
                        TitleAssociationDAL.Save(connection, transaction, titleAssociation);
                    }
                }

                if (title.TitleLanguages.Count > 0)
                {
                    TitleLanguageDAL titleLanguageDAL = new TitleLanguageDAL();
                    foreach (TitleLanguage titleLanguage in title.TitleLanguages)
                    {
                        if (titleLanguage.TitleID == 0) titleLanguage.TitleID = updatedTitle.ReturnObject.TitleID;
                        titleLanguageDAL.TitleLanguageManageAuto(connection, transaction, titleLanguage);
                    }
                }

                if ( title.TitleTypes.Count > 0 )
                {
                    Title_TitleTypeDAL titleTypeDAL = new Title_TitleTypeDAL();
                    foreach ( Title_TitleType titleType in title.TitleTypes )
                    {
                        if (titleType.TitleID == 0) titleType.TitleID = updatedTitle.ReturnObject.TitleID;
                        titleTypeDAL.Title_TitleTypeManageAuto( connection, transaction, titleType );
                    }
                }

                if ( title.TitleItems.Count > 0 )
                {
                    ItemDAL itemDAL = new ItemDAL();
                    TitleItemDAL titleItemDAL = new TitleItemDAL();
                    foreach ( TitleItem titleItem in title.TitleItems )
                    {
                        // Update the item
                        if (titleItem.TitleID == 0) titleItem.TitleID = updatedTitle.ReturnObject.TitleID;
                        titleItemDAL.TitleItemManageAuto( connection, transaction, titleItem );
                        // Update the primary title id (stored on the Item table)
                        itemDAL.ItemUpdatePrimaryTitleID(connection, transaction, titleItem.ItemID, titleItem.PrimaryTitleID);
                    }
                }

                CustomSqlHelper.CommitTransaction( transaction, isTransactionCoordinator );
            }
            catch ( Exception ex )
            {
                CustomSqlHelper.RollbackTransaction( transaction, isTransactionCoordinator );

                throw new Exception( "Exception in Save", ex );
            }
            finally
            {
                CustomSqlHelper.CloseConnection( connection, isTransactionCoordinator );
            }
        }
예제 #4
0
 /// <summary>
 /// Update values in Title. Returns an object of type Title.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="connectionKeyName">Connection key name located in config file.</param>
 /// <param name="value">Object of type Title.</param>
 /// <returns>Object of type Title.</returns>
 public Title TitleUpdateAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     string connectionKeyName,
     Title value)
 {
     return TitleUpdateAuto(sqlConnection, sqlTransaction, connectionKeyName,
         value.TitleID,
         value.MARCBibID,
         value.MARCLeader,
         value.TropicosTitleID,
         value.RedirectTitleID,
         value.FullTitle,
         value.ShortTitle,
         value.UniformTitle,
         value.SortTitle,
         value.PartNumber,
         value.PartName,
         value.CallNumber,
         value.PublicationDetails,
         value.StartYear,
         value.EndYear,
         value.Datafield_260_a,
         value.Datafield_260_b,
         value.Datafield_260_c,
         value.InstitutionCode,
         value.LanguageCode,
         value.TitleDescription,
         value.TL2Author,
         value.PublishReady,
         value.RareBooks,
         value.Note,
         value.LastModifiedUserID,
         value.OriginalCatalogingSource,
         value.EditionStatement,
         value.CurrentPublicationFrequency);
 }
예제 #5
0
 /// <summary>
 /// Update values in Title. Returns an object of type Title.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="value">Object of type Title.</param>
 /// <returns>Object of type Title.</returns>
 public Title TitleUpdateAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     Title value)
 {
     return TitleUpdateAuto(sqlConnection, sqlTransaction, "BHL", value );
 }
예제 #6
0
        /// <summary>
        /// Manage Title object.
        /// If the object is of type CustomObjectBase, 
        /// then either insert values into, delete values from, or update values in Title.
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="connectionKeyName">Connection key name located in config file.</param>
        /// <param name="value">Object of type Title.</param>
        /// <returns>Object of type CustomDataAccessStatus<Title>.</returns>
        public CustomDataAccessStatus<Title> TitleManageAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string connectionKeyName,
            Title value , int userId)
        {
            if (value.IsNew && !value.IsDeleted)
            {
                value.CreationUserID = userId;
                value.LastModifiedUserID = userId;
                Title returnValue = TitleInsertAuto(sqlConnection, sqlTransaction, connectionKeyName,
                    value.MARCBibID,
                        value.MARCLeader,
                        value.TropicosTitleID,
                        value.RedirectTitleID,
                        value.FullTitle,
                        value.ShortTitle,
                        value.UniformTitle,
                        value.SortTitle,
                        value.PartNumber,
                        value.PartName,
                        value.CallNumber,
                        value.PublicationDetails,
                        value.StartYear,
                        value.EndYear,
                        value.Datafield_260_a,
                        value.Datafield_260_b,
                        value.Datafield_260_c,
                        value.InstitutionCode,
                        value.LanguageCode,
                        value.TitleDescription,
                        value.TL2Author,
                        value.PublishReady,
                        value.RareBooks,
                        value.Note,
                        value.CreationUserID,
                        value.LastModifiedUserID,
                        value.OriginalCatalogingSource,
                        value.EditionStatement,
                        value.CurrentPublicationFrequency);

                return new CustomDataAccessStatus<Title>(
                    CustomDataAccessContext.Insert,
                    true, returnValue);
            }
            else if (!value.IsNew && value.IsDeleted)
            {
                if (TitleDeleteAuto(sqlConnection, sqlTransaction, connectionKeyName,
                    value.TitleID))
                {
                return new CustomDataAccessStatus<Title>(
                    CustomDataAccessContext.Delete,
                    true, value);
                }
                else
                {
                return new CustomDataAccessStatus<Title>(
                    CustomDataAccessContext.Delete,
                    false, value);
                }
            }
            else if (value.IsDirty && !value.IsDeleted)
            {
                value.LastModifiedUserID = userId;
                Title returnValue = TitleUpdateAuto(sqlConnection, sqlTransaction, connectionKeyName,
                    value.TitleID,
                        value.MARCBibID,
                        value.MARCLeader,
                        value.TropicosTitleID,
                        value.RedirectTitleID,
                        value.FullTitle,
                        value.ShortTitle,
                        value.UniformTitle,
                        value.SortTitle,
                        value.PartNumber,
                        value.PartName,
                        value.CallNumber,
                        value.PublicationDetails,
                        value.StartYear,
                        value.EndYear,
                        value.Datafield_260_a,
                        value.Datafield_260_b,
                        value.Datafield_260_c,
                        value.InstitutionCode,
                        value.LanguageCode,
                        value.TitleDescription,
                        value.TL2Author,
                        value.PublishReady,
                        value.RareBooks,
                        value.Note,
                        value.LastModifiedUserID,
                        value.OriginalCatalogingSource,
                        value.EditionStatement,
                        value.CurrentPublicationFrequency);

                return new CustomDataAccessStatus<Title>(
                    CustomDataAccessContext.Update,
                    true, returnValue);
            }
            else
            {
                return new CustomDataAccessStatus<Title>(
                    CustomDataAccessContext.NA,
                    false, value);
            }
        }
예제 #7
0
 /// <summary>
 /// Manage Title object.
 /// If the object is of type CustomObjectBase, 
 /// then either insert values into, delete values from, or update values in Title.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="value">Object of type Title.</param>
 /// <returns>Object of type CustomDataAccessStatus<Title>.</returns>
 public CustomDataAccessStatus<Title> TitleManageAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     Title value , int userId)
 {
     return TitleManageAuto( sqlConnection, sqlTransaction, "BHL", value , userId );
 }