protected void pageNameList_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = pageNameList.Rows[e.RowIndex]; if (row != null) { CheckBox activeCheckBox = row.FindControl("activeCheckBox") as CheckBox; TextBox nameFoundTextBox = row.FindControl("nameFoundTextBox") as TextBox; if (activeCheckBox != null && nameFoundTextBox != null) { CustomGenericList <PageName> pageNames = (CustomGenericList <PageName>)Session["PageNames" + pageIdTextBox.Text]; bool active = activeCheckBox.Checked; string nameFound = nameFoundTextBox.Text.Trim(); int? i = null; PageName pageName = findPageName(pageNames, (int)pageNameList.DataKeys[e.RowIndex].Values[0], (string)pageNameList.DataKeys[e.RowIndex].Values[1], (pageNameList.DataKeys[e.RowIndex].Values[2] == null ? null : (string)pageNameList.DataKeys[e.RowIndex].Values[2]), (pageNameList.DataKeys[e.RowIndex].Values[3] == null ? i : (int)pageNameList.DataKeys[e.RowIndex].Values[3]), (bool)pageNameList.DataKeys[e.RowIndex].Values[4]); pageName.Active = active; pageName.NameFound = nameFound; } } pageNameList.EditIndex = -1; bindPageNameData(true); }
/// <summary> /// Select values from Institution by primary key(s). /// </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="institutionCode">Code for Institution providing assistance.</param> /// <returns>Object of type Institution.</returns> public Institution InstitutionSelectAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, string institutionCode) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("InstitutionSelectAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("InstitutionCode", SqlDbType.NVarChar, 10, false, institutionCode))) { using (CustomSqlHelper <Institution> helper = new CustomSqlHelper <Institution>()) { CustomGenericList <Institution> list = helper.ExecuteReader(command); if (list.Count > 0) { Institution o = list[0]; list = null; return(o); } else { return(null); } } } }
public static int PageNameCountUniqueConfirmedBetweenDates(SqlConnection sqlConnection, SqlTransaction sqlTransaction, DateTime startDate, DateTime endDate) { SqlConnection connection = sqlConnection; SqlTransaction transaction = sqlTransaction; if (connection == null) { connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL")); } using (SqlCommand command = CustomSqlHelper.CreateCommand("PageNameCountUniqueConfirmedBetweenDates", connection, transaction, CustomSqlHelper.CreateInputParameter("StartDate", SqlDbType.DateTime, null, false, startDate), CustomSqlHelper.CreateInputParameter("EndDate", SqlDbType.DateTime, null, false, endDate))) { using (CustomSqlHelper <int> helper = new CustomSqlHelper <int>()) { CustomGenericList <int> list = helper.ExecuteReader(command); if (list.Count == 0) { return(default(int)); } else { return(list[0]); } } } }
/// <summary> /// Update values in MarcSubField. Returns an object of type MarcSubField. /// </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="marcSubFieldID"></param> /// <param name="marcDataFieldID"></param> /// <param name="code"></param> /// <param name="value"></param> /// <returns>Object of type MarcSubField.</returns> public MarcSubField MarcSubFieldUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int marcSubFieldID, int marcDataFieldID, string code, string value) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("MarcSubFieldUpdateAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("MarcSubFieldID", SqlDbType.Int, null, false, marcSubFieldID), CustomSqlHelper.CreateInputParameter("MarcDataFieldID", SqlDbType.Int, null, false, marcDataFieldID), CustomSqlHelper.CreateInputParameter("Code", SqlDbType.NChar, 1, false, code), CustomSqlHelper.CreateInputParameter("Value", SqlDbType.NVarChar, 200, false, value), CustomSqlHelper.CreateReturnValueParameter("ReturnCode", SqlDbType.Int, null, false))) { using (CustomSqlHelper <MarcSubField> helper = new CustomSqlHelper <MarcSubField>()) { CustomGenericList <MarcSubField> list = helper.ExecuteReader(command); if (list.Count > 0) { MarcSubField o = list[0]; list = null; return(o); } else { return(null); } } } }
/// <summary> /// Select values from PageSummaryView by Barcode. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="barcode"></param> /// <returns>Object of type Title.</returns> public PageSummaryView PageSummarySelectByBarcode( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string barcode) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("PageSummarySelectByBarcode", connection, transaction, CustomSqlHelper.CreateInputParameter("Barcode", SqlDbType.VarChar, 40, false, barcode))) { using (CustomSqlHelper <PageSummaryView> helper = new CustomSqlHelper <PageSummaryView>()) { CustomGenericList <PageSummaryView> list = helper.ExecuteReader(command); if (list.Count > 0) { return(list[0]); } else { return(null); } } } }
/// <summary> /// Insert values into TitleType. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="titleTypeID">Unique identifier for each Title Type record.</param> /// <param name="titleType">A Type to be associated with a Title.</param> /// <param name="titleTypeDescription">Description of a Title Type.</param> /// <returns>Object of type TitleType.</returns> public TitleType TitleTypeInsertAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, int titleTypeID, string titleType, string titleTypeDescription) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleTypeInsertAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("TitleTypeID", SqlDbType.Int, null, false, titleTypeID), CustomSqlHelper.CreateInputParameter("TitleType", SqlDbType.NVarChar, 25, false, titleType), CustomSqlHelper.CreateInputParameter("TitleTypeDescription", SqlDbType.NVarChar, 80, true, titleTypeDescription), CustomSqlHelper.CreateReturnValueParameter("ReturnCode", SqlDbType.Int, null, false))) { using (CustomSqlHelper <TitleType> helper = new CustomSqlHelper <TitleType>()) { CustomGenericList <TitleType> list = helper.ExecuteReader(command); if (list.Count > 0) { TitleType o = list[0]; list = null; return(o); } else { return(null); } } } }
/// <summary> /// Select values from MonthlyStats by primary key(s). /// </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="year"></param> /// <param name="month"></param> /// <param name="institutionName"></param> /// <param name="statType"></param> /// <returns>Object of type MonthlyStats.</returns> public MonthlyStats MonthlyStatsSelectAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int year, int month, string institutionName, string statType) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("MonthlyStatsSelectAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("Year", SqlDbType.Int, null, false, year), CustomSqlHelper.CreateInputParameter("Month", SqlDbType.Int, null, false, month), CustomSqlHelper.CreateInputParameter("InstitutionName", SqlDbType.NVarChar, 255, false, institutionName), CustomSqlHelper.CreateInputParameter("StatType", SqlDbType.NVarChar, 100, false, statType))) { using (CustomSqlHelper <MonthlyStats> helper = new CustomSqlHelper <MonthlyStats>()) { CustomGenericList <MonthlyStats> list = helper.ExecuteReader(command); if (list.Count > 0) { MonthlyStats o = list[0]; list = null; return(o); } else { return(null); } } } }
private void bindTitleData() { CustomGenericList <ItemTitle> itemTitles = (CustomGenericList <ItemTitle>)Session["ItemTitleList" + itemIdTextBox.Text]; titleList.DataSource = itemTitles; titleList.DataBind(); }
/// <summary> /// Select values from MarcDataField by primary key(s). /// </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="marcDataFieldID"></param> /// <returns>Object of type MarcDataField.</returns> public MarcDataField MarcDataFieldSelectAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int marcDataFieldID) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("MarcDataFieldSelectAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("MarcDataFieldID", SqlDbType.Int, null, false, marcDataFieldID))) { using (CustomSqlHelper <MarcDataField> helper = new CustomSqlHelper <MarcDataField>()) { CustomGenericList <MarcDataField> list = helper.ExecuteReader(command); if (list.Count > 0) { MarcDataField o = list[0]; list = null; return(o); } else { return(null); } } } }
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();"); if (!IsPostBack) { // Retrieve the pages for the item String itemIDString = Request.QueryString["ItemID"] as String; int itemID; if (itemIDString != null) { if (Int32.TryParse(itemIDString, out itemID)) { BHLProvider provider = new BHLProvider(); // If this is a Botanicus item, make sure the PDF actually exists. // Remove the DownloadUrl if it does not. Data.Item item = provider.ItemSelectByBarcodeOrItemID(itemID, null); if (!String.IsNullOrEmpty(item.DownloadUrl) && 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 (provider.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; } } if (String.IsNullOrEmpty(item.DownloadUrl)) { litDownloadLink.Text = ConfigurationManager.AppSettings["PdfGenDownloadNone"].ToString(); } else if (item.ItemSourceID == 1) { litDownloadLink.Text = String.Format(ConfigurationManager.AppSettings["PdfGenDownloadIA"], item.BarCode, item.BarCode); } else { litDownloadLink.Text = String.Format(ConfigurationManager.AppSettings["PdfGenDownloadBotanicus"], item.DownloadUrl); } // Get the page information for this item CustomGenericList <Data.Page> pages = provider.PageMetadataSelectByItemID(itemID); dlPages.DataSource = pages; dlPages.DataBind(); } } } }
/// <summary> /// Update values in TitleLanguage. Returns an object of type TitleLanguage. /// </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="titleLanguageID"></param> /// <param name="titleID"></param> /// <param name="languageCode"></param> /// <returns>Object of type TitleLanguage.</returns> public TitleLanguage TitleLanguageUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int titleLanguageID, int titleID, string languageCode) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleLanguageUpdateAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("TitleLanguageID", SqlDbType.Int, null, false, titleLanguageID), CustomSqlHelper.CreateInputParameter("TitleID", SqlDbType.Int, null, false, titleID), CustomSqlHelper.CreateInputParameter("LanguageCode", SqlDbType.NVarChar, 10, false, languageCode), CustomSqlHelper.CreateReturnValueParameter("ReturnCode", SqlDbType.Int, null, false))) { using (CustomSqlHelper <TitleLanguage> helper = new CustomSqlHelper <TitleLanguage>()) { CustomGenericList <TitleLanguage> list = helper.ExecuteReader(command); if (list.Count > 0) { TitleLanguage o = list[0]; list = null; return(o); } else { return(null); } } } }
private void fillPageList(int itemId) { checkPaginationStatus(); CustomGenericList <Page> pages = bp.PageMetadataSelectByItemID(itemId); /* * if ( ( pages != null && pages.Count > 0 ) && * ( pages[ 0 ].RareBooks == false && * ( pages[ 0 ].ExternalURL == null || pages[ 0 ].ExternalURL.Trim().Length == 0 ) ) ) * { * thumbnailViewRadio.Visible = true; * thumbnailLabel.Visible = true; * thumbnailImg.Visible = true; * } * else * { * thumbnailViewRadio.Visible = false; * thumbnailLabel.Visible = false; * thumbnailImg.Visible = false; * detailViewRadio.Checked = true; * } */ detailGridView.DataSource = pages; detailGridView.DataBind(); clearAll(); }
/// <summary> /// Select values from TitleAssociation_TitleIdentifier by primary key(s). /// </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="titleAssociation_TitleIdentifierID"></param> /// <returns>Object of type TitleAssociation_TitleIdentifier.</returns> public TitleAssociation_TitleIdentifier TitleAssociation_TitleIdentifierSelectAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int titleAssociation_TitleIdentifierID) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleAssociation_TitleIdentifierSelectAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("TitleAssociation_TitleIdentifierID", SqlDbType.Int, null, false, titleAssociation_TitleIdentifierID))) { using (CustomSqlHelper <TitleAssociation_TitleIdentifier> helper = new CustomSqlHelper <TitleAssociation_TitleIdentifier>()) { CustomGenericList <TitleAssociation_TitleIdentifier> list = helper.ExecuteReader(command); if (list.Count > 0) { TitleAssociation_TitleIdentifier o = list[0]; list = null; return(o); } else { return(null); } } } }
private bool validate(CustomGenericList <PageName> pageNames) { bool flag = false; // Check that all edits were completed if (pageNameList.EditIndex != -1) { flag = true; errorControl.AddErrorText("Page names list has an edit pending"); } foreach (PageName pageName in pageNames) { if (pageName.NameFound.Trim().Length == 0 && pageName.IsDeleted == false) { flag = true; errorControl.AddErrorText( "One or more of the page names have an empty Name Found. Please fill in missing data"); break; } } errorControl.Visible = flag; Page.MaintainScrollPositionOnPostBack = !flag; return(!flag); }
/// <summary> /// Select values from CreatorRoleType by primary key(s). /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="creatorRoleTypeID">Unique identifier for each Creator Role Type.</param> /// <returns>Object of type CreatorRoleType.</returns> public CreatorRoleType CreatorRoleTypeSelectAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, int creatorRoleTypeID) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("CreatorRoleTypeSelectAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("CreatorRoleTypeID", SqlDbType.Int, null, false, creatorRoleTypeID))) { using (CustomSqlHelper <CreatorRoleType> helper = new CustomSqlHelper <CreatorRoleType>()) { CustomGenericList <CreatorRoleType> list = helper.ExecuteReader(command); if (list.Count > 0) { CreatorRoleType o = list[0]; list = null; return(o); } else { return(null); } } } }
public CustomGenericList <OpenUrlCitation> OpenUrlCitationSelectByTitleDetails( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string title, string authorLast, string authorFirst, string authorCorporation, string publisherName, string publisherPlace, string publisher) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("OpenUrlCitationSelectByTitleDetails", connection, transaction, CustomSqlHelper.CreateInputParameter("Title", SqlDbType.NVarChar, 2000, true, title), CustomSqlHelper.CreateInputParameter("AuthorLast", SqlDbType.NVarChar, 150, true, authorLast), CustomSqlHelper.CreateInputParameter("AuthorFirst", SqlDbType.NVarChar, 100, true, authorFirst), CustomSqlHelper.CreateInputParameter("AuthorCorporation", SqlDbType.NVarChar, 255, true, authorCorporation), CustomSqlHelper.CreateInputParameter("PublisherName", SqlDbType.NVarChar, 255, true, publisherName), CustomSqlHelper.CreateInputParameter("PublisherPlace", SqlDbType.NVarChar, 150, true, publisherPlace), CustomSqlHelper.CreateInputParameter("Publisher", SqlDbType.NVarChar, 255, true, publisher))) { CustomGenericList <CustomDataRow> list = CustomSqlHelper.ExecuteReaderAndReturnRows(command); return(this.GetOpenUrlCitationList(list)); } }
protected CustomGenericList<Language> GetLanguages() { BHLProvider bp = new BHLProvider(); _itemLanguages = bp.LanguageSelectAll(); return _itemLanguages; }
protected void titleList_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = titleList.Rows[e.RowIndex]; if (row != null) { CheckBox checkBox = row.FindControl("isPrimaryCheckBoxEdit") as CheckBox; if (checkBox != null) { CustomGenericList <ItemTitle> itemTitles = (CustomGenericList <ItemTitle>)Session["ItemTitleList" + itemIdTextBox.Text]; bool isPrimary = checkBox.Checked; String titleIdString = row.Cells[1].Text; int titleId = 0; int.TryParse(titleIdString, out titleId); if (titleId > 0) { // Update primary title foreach (ItemTitle itemTitle in itemTitles) { if (titleId == itemTitle.TitleID) { itemTitle.IsPrimary = isPrimary; break; } } } } } titleList.EditIndex = -1; bindTitleData(); }
/// <summary> /// Update values in CreatorRoleType. Returns an object of type CreatorRoleType. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="creatorRoleTypeID">Unique identifier for each Creator Role Type.</param> /// <param name="creatorRoleType">A type of Role performed by a Creator.</param> /// <param name="creatorRoleTypeDescription">Description of a Creator Role Type.</param> /// <param name="mARCDataFieldTag">Data Field Tag from MARC XML.</param> /// <returns>Object of type CreatorRoleType.</returns> public CreatorRoleType CreatorRoleTypeUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, int creatorRoleTypeID, string creatorRoleType, string creatorRoleTypeDescription, string mARCDataFieldTag) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("CreatorRoleTypeUpdateAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("CreatorRoleTypeID", SqlDbType.Int, null, false, creatorRoleTypeID), CustomSqlHelper.CreateInputParameter("CreatorRoleType", SqlDbType.NVarChar, 25, false, creatorRoleType), CustomSqlHelper.CreateInputParameter("CreatorRoleTypeDescription", SqlDbType.NVarChar, 255, true, creatorRoleTypeDescription), CustomSqlHelper.CreateInputParameter("MARCDataFieldTag", SqlDbType.NVarChar, 3, true, mARCDataFieldTag), CustomSqlHelper.CreateReturnValueParameter("ReturnCode", SqlDbType.Int, null, false))) { using (CustomSqlHelper <CreatorRoleType> helper = new CustomSqlHelper <CreatorRoleType>()) { CustomGenericList <CreatorRoleType> list = helper.ExecuteReader(command); if (list.Count > 0) { CreatorRoleType o = list[0]; list = null; return(o); } else { return(null); } } } }
/// <summary> /// Select values from PageSummaryView by Item and Sequence /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="itemID"></param> /// <param name="sequence"></param> /// <returns>Object of type Title.</returns> public PageSummaryView PageSummarySelectByItemAndSequence( SqlConnection sqlConnection, SqlTransaction sqlTransaction, int itemID, int sequence) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("PageSummarySelectByItemAndSequence", connection, transaction, CustomSqlHelper.CreateInputParameter("ItemID", SqlDbType.Int, null, false, itemID), CustomSqlHelper.CreateInputParameter("Sequence", SqlDbType.Int, null, false, sequence))) { using (CustomSqlHelper <PageSummaryView> helper = new CustomSqlHelper <PageSummaryView>()) { CustomGenericList <PageSummaryView> list = helper.ExecuteReader(command); if (list.Count > 0) { return(list[0]); } else { return(null); } } } }
/// <summary> /// Select values from PDFStatus by primary key(s). /// </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="pdfStatusID"></param> /// <returns>Object of type PDFStatus.</returns> public PDFStatus PDFStatusSelectAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int pdfStatusID) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("PDFStatusSelectAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("PdfStatusID", SqlDbType.Int, null, false, pdfStatusID))) { using (CustomSqlHelper <PDFStatus> helper = new CustomSqlHelper <PDFStatus>()) { CustomGenericList <PDFStatus> list = helper.ExecuteReader(command); if (list.Count > 0) { PDFStatus o = list[0]; list = null; return(o); } else { return(null); } } } }
public static int PageNameCountUniqueConfirmed(SqlConnection sqlConnection, SqlTransaction sqlTransaction) { SqlConnection connection = sqlConnection; SqlTransaction transaction = sqlTransaction; if (connection == null) { connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL")); } using (SqlCommand command = CustomSqlHelper.CreateCommand("PageNameCountUniqueConfirmed", connection, transaction)) { using (CustomSqlHelper <int> helper = new CustomSqlHelper <int>()) { CustomGenericList <int> list = helper.ExecuteReader(command); if (list.Count == 0) { return(default(int)); } else { return(list[0]); } } } }
public Title_TitleIdentifier Title_TitleIdentifierSelectByIdentifierValue( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string identifierValue) { SqlConnection connection = CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("Title_TitleIdentifierSelectByIdentifierValue", connection, transaction, CustomSqlHelper.CreateInputParameter("IdentifierValue", SqlDbType.NVarChar, 125, false, identifierValue))) { using (CustomSqlHelper <Title_TitleIdentifier> helper = new CustomSqlHelper <Title_TitleIdentifier>()) { CustomGenericList <Title_TitleIdentifier> list = helper.ExecuteReader(command); if (list.Count > 0) { return(list[0]); } else { return(null); } } } }
public CustomGenericList <Name> NameSearch(string name) { if (name == String.Empty) { throw new SoapException("Please supply a name for which to search.", SoapException.ClientFaultCode); } try { CustomGenericList <Name> names = new CustomGenericList <Name>(); // Use the existing name search functionality MOBOT.BHL.Server.BHLProvider provider = new MOBOT.BHL.Server.BHLProvider(); CustomGenericList <MOBOT.BHL.DataObjects.PageName> pageNames = provider.PageNameSelectByNameLike(name); foreach (MOBOT.BHL.DataObjects.PageName pageName in pageNames) { // Add names to the list to be returned Name nameResult = new Name(); nameResult.NameConfirmed = pageName.NameConfirmed; nameResult.NameBankID = (int)pageName.NameBankID; names.Add(nameResult); } return(names); } catch (Exception ex) { throw new SoapException(ex.Message, SoapException.ServerFaultCode); } }
/// <summary> /// Select values from IndicatedPage by primary key(s). /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="pageID">Unique identifier for each Page record.</param> /// <param name="sequence">A number to separately identify various series of Indicated Pages.</param> /// <returns>Object of type IndicatedPage.</returns> public IndicatedPage IndicatedPageSelectAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, int pageID, short sequence) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("IndicatedPageSelectAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("PageID", SqlDbType.Int, null, false, pageID), CustomSqlHelper.CreateInputParameter("Sequence", SqlDbType.SmallInt, null, false, sequence))) { using (CustomSqlHelper <IndicatedPage> helper = new CustomSqlHelper <IndicatedPage>()) { CustomGenericList <IndicatedPage> list = helper.ExecuteReader(command); if (list.Count > 0) { IndicatedPage o = list[0]; list = null; return(o); } else { return(null); } } } }
protected void saveButton_Click(object sender, EventArgs e) { PageSummaryView ps = (PageSummaryView)Session["Page" + pageIdTextBox.Text]; CustomGenericList <PageName> pageNames = (CustomGenericList <PageName>)Session["PageNames" + pageIdTextBox.Text]; if (validate(pageNames)) { BHLProvider bp = new BHLProvider(); try { foreach (PageName pageName in pageNames) { if (pageName.IsNew && pageName.Active) { PageName existingPageName = bp.PageNameSelectByPageIDAndNameFound(ps.PageID, pageName.NameFound); if (existingPageName == null) { pageName.PageID = ps.PageID; pageName.Source = "User Reported"; pageName.Active = true; // Get confirmed value and namebankid from uBio FindItItem uBioResult = ubioLookup(pageName.NameFound); if (uBioResult != null) { pageName.NameConfirmed = TypeHelper.NullIfEmpty(uBioResult.Name); pageName.NameBankID = TypeHelper.NullIfZero(uBioResult.NamebankID); } } } else { if (pageName.Active) { FindItItem uBioResult = ubioLookup(pageName.NameFound); if (uBioResult != null && uBioResult.NamebankID >= 0) { pageName.NameConfirmed = TypeHelper.NullIfEmpty(uBioResult.Name); pageName.NameBankID = TypeHelper.NullIfZero(uBioResult.NamebankID); } } } } bp.PageNameSaveList(pageNames); } catch (Exception ex) { Session["Exception"] = ex; Response.Redirect("/Error.aspx"); } } else { return; } Response.Redirect("/Admin/Dashboard.aspx"); }
/// <summary> /// Update values in ItemStatus. Returns an object of type ItemStatus. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="itemStatusID"></param> /// <param name="itemStatusName"></param> /// <returns>Object of type ItemStatus.</returns> public ItemStatus ItemStatusUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, int itemStatusID, string itemStatusName) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("ItemStatusUpdateAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("ItemStatusID", SqlDbType.Int, null, false, itemStatusID), CustomSqlHelper.CreateInputParameter("ItemStatusName", SqlDbType.NVarChar, 50, false, itemStatusName), CustomSqlHelper.CreateReturnValueParameter("ReturnCode", SqlDbType.Int, null, false))) { using (CustomSqlHelper <ItemStatus> helper = new CustomSqlHelper <ItemStatus>()) { CustomGenericList <ItemStatus> list = helper.ExecuteReader(command); if (list.Count > 0) { ItemStatus o = list[0]; list = null; return(o); } else { return(null); } } } }
/// <summary> /// Update values in TitleIdentifier. Returns an object of type TitleIdentifier. /// </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="titleIdentifierID"></param> /// <param name="identifierName"></param> /// <param name="marcDataFieldTag"></param> /// <param name="marcSubFieldCode"></param> /// <returns>Object of type TitleIdentifier.</returns> public TitleIdentifier TitleIdentifierUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int titleIdentifierID, string identifierName, string marcDataFieldTag, string marcSubFieldCode) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleIdentifierUpdateAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("TitleIdentifierID", SqlDbType.Int, null, false, titleIdentifierID), CustomSqlHelper.CreateInputParameter("IdentifierName", SqlDbType.NVarChar, 40, false, identifierName), CustomSqlHelper.CreateInputParameter("MarcDataFieldTag", SqlDbType.NVarChar, 50, false, marcDataFieldTag), CustomSqlHelper.CreateInputParameter("MarcSubFieldCode", SqlDbType.NVarChar, 50, false, marcSubFieldCode), CustomSqlHelper.CreateReturnValueParameter("ReturnCode", SqlDbType.Int, null, false))) { using (CustomSqlHelper <TitleIdentifier> helper = new CustomSqlHelper <TitleIdentifier>()) { CustomGenericList <TitleIdentifier> list = helper.ExecuteReader(command); if (list.Count > 0) { TitleIdentifier o = list[0]; list = null; return(o); } else { return(null); } } } }
/// <summary> /// Reads the specified list of generic data rows into a list of OpenUrlCitations /// </summary> /// <param name="list"></param> /// <returns></returns> private CustomGenericList <OpenUrlCitation> GetOpenUrlCitationList(CustomGenericList <CustomDataRow> list) { CustomGenericList <OpenUrlCitation> citations = new CustomGenericList <OpenUrlCitation>(); foreach (CustomDataRow row in list) { OpenUrlCitation citation = new OpenUrlCitation(); citation.PageID = Utility.ZeroIfNull(row["PageID"].Value); citation.ItemID = Utility.ZeroIfNull(row["ItemID"].Value); citation.TitleID = Utility.ZeroIfNull(row["TitleID"].Value); citation.FullTitle = row["FullTitle"].Value.ToString(); citation.PublisherPlace = row["PublisherPlace"].Value.ToString(); citation.PublisherName = row["PublisherName"].Value.ToString(); citation.Date = row["Date"].Value.ToString(); citation.LanguageName = row["LanguageName"].Value.ToString(); citation.Volume = row["Volume"].Value.ToString(); citation.EditionStatement = row["EditionStatement"].Value.ToString(); citation.CurrentPublicationFrequency = row["CurrentPublicationFrequency"].Value.ToString(); citation.Genre = row["Genre"].Value.ToString(); citation.Authors = row["Authors"].Value.ToString(); citation.Subjects = row["Subjects"].Value.ToString(); citation.StartPage = row["StartPage"].Value.ToString(); citation.EndPage = row["EndPage"].Value.ToString(); citation.Pages = row["Pages"].Value.ToString(); citation.Issn = row["ISSN"].Value.ToString(); citation.Isbn = row["ISBN"].Value.ToString(); citation.Lccn = row["LCCN"].Value.ToString(); citation.Oclc = row["OCLC"].Value.ToString(); citation.Abbreviation = row["Abbreviation"].Value.ToString(); citations.Add(citation); } return(citations); }
/// <summary> /// Update the ItemSequence for the specified TitleItem. /// </summary> /// <param name="sqlConnection">Sql connection or null</param> /// <param name="sqlTransaction">Sql transaction or null</param> /// <param name="titleID">Identifier of a specific title</param> /// <param name="itemID">Identifier of a specific item</param> /// <param name="itemSequence">ItemSequence value</param> /// <returns>The updated titleitem</returns> public TitleItem TitleItemUpdateItemSequence(SqlConnection sqlConnection, SqlTransaction sqlTransaction, int titleID, int itemID, short?itemSequence) { SqlConnection connection = CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleItemUpdateItemSequence", connection, transaction, CustomSqlHelper.CreateInputParameter("TitleID", SqlDbType.Int, null, false, titleID), CustomSqlHelper.CreateInputParameter("ItemID", SqlDbType.Int, null, false, itemID), CustomSqlHelper.CreateInputParameter("ItemSequence", SqlDbType.SmallInt, null, true, itemSequence))) { using (CustomSqlHelper <TitleItem> helper = new CustomSqlHelper <TitleItem>()) { CustomGenericList <TitleItem> list = helper.ExecuteReader(command); if (list.Count > 0) { return(list[0]); } else { return(null); } } } }
/// <summary> /// Select all Creators for a BibId. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <returns>Object of type Creator.</returns> private Stats StatsSelect( SqlConnection sqlConnection, SqlTransaction sqlTransaction, bool expanded, bool names) { SqlConnection connection = CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("StatsSelect", connection, transaction, CustomSqlHelper.CreateInputParameter("Expanded", SqlDbType.Bit, null, false, expanded), CustomSqlHelper.CreateInputParameter("Names", SqlDbType.Bit, null, false, names))) { CustomGenericList <CustomDataRow> list = CustomSqlHelper.ExecuteReaderAndReturnRows(command); CustomDataRow row = list[0]; Stats stats = new Stats(); stats.TitleCount = (int)row["TitleCount"].Value; stats.VolumeCount = (int)row["VolumeCount"].Value; stats.PageCount = (int)row["PageCount"].Value; stats.PageTotal = (int)row["PageTotal"].Value; stats.TitleTotal = (int)row["TitleTotal"].Value; stats.VolumeTotal = (int)row["VolumeTotal"].Value; stats.UniqueCount = (int)row["UniqueCount"].Value; stats.UniqueTotal = (int)row["UniqueTotal"].Value; return(stats); } }
private bool titleCreatorExists( CustomGenericList<Title_Creator> titleCreators, Title_Creator titleCreatorToCheckFor) { foreach ( Title_Creator tc in titleCreators ) { if ( ( tc.TitleID == titleCreatorToCheckFor.TitleID ) && ( tc.CreatorID == titleCreatorToCheckFor.CreatorID ) && ( tc.CreatorRoleTypeID == titleCreatorToCheckFor.CreatorRoleTypeID ) ) { return true; } } return false; }
protected void Page_Load(object sender, EventArgs e) { String institutionName = Request.QueryString["i"] as String; if (institutionName == null) institutionName = ""; Response.Clear(); Response.AppendHeader("Content-Type", "application/vnd.ms-excel"); Response.AppendHeader("Content-Disposition", "attachment; filename=BHLGrowthStats.xls"); CustomGenericList<MonthlyStats> titleStats = new CustomGenericList<MonthlyStats>(); CustomGenericList<MonthlyStats> itemStats = new CustomGenericList<MonthlyStats>(); CustomGenericList<MonthlyStats> pageStats = new CustomGenericList<MonthlyStats>(); CustomGenericList<MonthlyStats> nameStats = new CustomGenericList<MonthlyStats>(); BHLProvider provider = new BHLProvider(); CustomGenericList<MonthlyStats> stats = provider.MonthlyStatsSelectByDateAndInstitution(2000, 1, 2099, 12, institutionName); foreach(MonthlyStats stat in stats) { switch (stat.StatType) { case "Titles Created": titleStats.Add(stat); break; case "Items Created": itemStats.Add(stat); break; case "Pages Created": pageStats.Add(stat); break; case "PageNames Created": nameStats.Add(stat); break; } } litInstitution.Text = institutionName; gvTitles.DataSource = titleStats; gvItems.DataSource = itemStats; gvPages.DataSource = pageStats; gvNames.DataSource = nameStats; gvTitles.DataBind(); gvItems.DataBind(); gvPages.DataBind(); gvNames.DataBind(); }
public static void SaveList( SqlConnection sqlConnection, SqlTransaction sqlTransaction, CustomGenericList<PageName> pageNames) { 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 ); if ( pageNames.Count > 0 ) { PageNameDAL pageNameDAL = new PageNameDAL(); foreach ( PageName pageName in pageNames ) { pageNameDAL.PageNameManageAuto( connection, transaction, pageName ); } } CustomSqlHelper.CommitTransaction( transaction, isTransactionCoordinator ); } catch ( Exception ex ) { CustomSqlHelper.RollbackTransaction( transaction, isTransactionCoordinator ); throw new Exception( "Exception in Save", ex ); } finally { CustomSqlHelper.CloseConnection( connection, isTransactionCoordinator ); } }
public CustomGenericList<Name> NameSearch(string name) { if (name == String.Empty) { throw new SoapException("Please supply a name for which to search.", SoapException.ClientFaultCode); } try { CustomGenericList<Name> names = new CustomGenericList<Name>(); // Use the existing name search functionality MOBOT.BHL.Server.BHLProvider provider = new MOBOT.BHL.Server.BHLProvider(); CustomGenericList<MOBOT.BHL.DataObjects.PageName> pageNames = provider.PageNameSelectByNameLike(name); foreach (MOBOT.BHL.DataObjects.PageName pageName in pageNames) { // Add names to the list to be returned Name nameResult = new Name(); nameResult.NameConfirmed = pageName.NameConfirmed; nameResult.NameBankID = (int)pageName.NameBankID; names.Add(nameResult); } return names; } catch (Exception ex) { throw new SoapException(ex.Message, SoapException.ServerFaultCode); } }
public IOpenUrlResponse FindCitation(IOpenUrlQuery query) { IOpenUrlResponse response = new OpenUrlResponse(); try { if (query == null) throw new Exception("Query cannot be null."); if (query.ValidateQuery()) // Validate the query { bool foundCitation = false; OpenUrlCitationDAL ouDAL = new OpenUrlCitationDAL(); int pageID = 0; if (query.Version == "1.0") { pageID = this.GetBHLIDFromIdentifierList(query, "page"); } else { String pageIDString = this.GetIDFromIdentifierList(query, "page"); Int32.TryParse(pageIDString, out pageID); } // If we've got a page id, submit a query to database CustomGenericList<OpenUrlCitation> citations = new CustomGenericList<OpenUrlCitation>(); if (pageID > 0) citations = ouDAL.OpenUrlCitationSelectByPageID(null, null, pageID); if (citations.Count > 0) foundCitation = true; // If we haven't found a citation, try finding the title using title and page criteria if (!foundCitation) { // Get the title ID, if one was specified int titleID = 0; if (query.Version == "1.0") { titleID = this.GetBHLIDFromIdentifierList(query, "bibliography"); } else { String titleIDString = this.GetIDFromIdentifierList(query, "title"); Int32.TryParse(titleIDString, out titleID); } // Get OCLC and LCCN identifiers, if specified string oclc = this.GetIDFromIdentifierList(query, "oclcnum"); string lccn = this.GetIDFromIdentifierList(query, "lccn"); // Look for citations citations = ouDAL.OpenUrlCitationSelectByCitationDetails(null, null, titleID, oclc, lccn, query.Isbn, query.Issn, query.ShortTitle, query.Coden, (query.BookTitle != String.Empty ? query.BookTitle : query.JournalTitle), query.AuthorLast, query.AuthorFirst, query.AuthorCorporation, query.PublisherName, query.PublisherPlace, query.Publisher, query.Volume, query.Issue, query.Date.Year(), query.StartPage); if (citations.Count > 0) foundCitation = true; } if (foundCitation) { // For each citation we got back from the database, add a citation to the response foreach (OpenUrlCitation citation in citations) { OpenUrlResponseCitation responseCitation = new OpenUrlResponseCitation(); responseCitation.Title = citation.FullTitle; responseCitation.PublisherName = citation.PublisherName; responseCitation.PublisherPlace = citation.PublisherPlace; responseCitation.Date = citation.Date; responseCitation.Language = citation.LanguageName; responseCitation.Volume = citation.Volume; responseCitation.Genre = citation.Genre; if (citation.PageID > 0) responseCitation.Url = String.Format(UrlFormat, citation.PageID.ToString()); if (citation.ItemID > 0) responseCitation.ItemUrl = String.Format(ItemUrlFormat, citation.ItemID.ToString()); if (citation.TitleID > 0) responseCitation.TitleUrl = String.Format(TitleUrlFormat, citation.TitleID.ToString()); responseCitation.Oclc = citation.Oclc; responseCitation.Issn = citation.Issn; responseCitation.Isbn = citation.Isbn; responseCitation.Lccn = citation.Lccn; responseCitation.STitle = citation.Abbreviation; responseCitation.PublicationFrequency = citation.CurrentPublicationFrequency; responseCitation.Edition = citation.EditionStatement; responseCitation.SPage = citation.StartPage; responseCitation.EPage = citation.EndPage; responseCitation.Pages = citation.Pages; if (citation.Authors.Length > 0) { string[] authors = citation.Authors.Split('|'); foreach (string author in authors) { responseCitation.Authors.Add(author); } } if (citation.Subjects.Length > 0) { string[] subjects = citation.Subjects.Split('|'); foreach (string subject in subjects) { responseCitation.Subjects.Add(subject); } } response.citations.Add(responseCitation); } } // Data for testing //this.AddTestData(response); response.Status = ResponseStatus.Success; } else { response.Status = ResponseStatus.Error; response.Message = query.ValidationError; } } catch (Exception ex) { response.Status = ResponseStatus.Error; response.Message = ex.Message; } // Return the response return response; }
private void fillUI() { Item item = (Item)Session["Item" + itemIdTextBox.Text]; if (item != null) { itemIdLabel.Text = item.ItemID.ToString(); barcodeLabel.Text = item.BarCode; marcItemIDTextBox.Text = item.MARCItemID; callNumberTextBox.Text = item.CallNumber; volumeTextBox.Text = item.Volume; notesTextBox.Text = item.Note; yearTextBox.Text = item.Year; identifierBibTextBox.Text = item.IdentifierBib; zQueryTextBox.Text = item.ZQuery; sponsorTextBox.Text = item.Sponsor; licenseUrlTextBox.Text = item.LicenseUrl; rightsTextBox.Text = item.Rights; dueDiligenceTextBox.Text = item.DueDiligence; copyrightStatusTextBox.Text = item.CopyrightStatus; copyrightRegionTextBox.Text = item.CopyrightRegion; copyrightCommentTextBox.Text = item.CopyrightComment; copyrightEvidenceTextBox.Text = item.CopyrightEvidence; CustomGenericList<ItemTitle> itemTitles = new CustomGenericList<ItemTitle>(); foreach (TitleItem titleItem in item.TitleItems) { ItemTitle itemTitle = new ItemTitle(); itemTitle.TitleID = titleItem.TitleID; itemTitle.ShortTitle = titleItem.ShortTitle; itemTitle.IsPrimary = (item.PrimaryTitleID == titleItem.TitleID); itemTitles.Add(itemTitle); } Session["ItemTitleList" + itemIdTextBox.Text] = itemTitles; titleList.DataSource = itemTitles;// item.Titles; titleList.DataBind(); languagesList.DataSource = item.ItemLanguages; languagesList.DataBind(); scannedByLabel.Text = item.ScanningUser; scannedDateLabel.Text = (item.ScanningDate.HasValue ? item.ScanningDate.Value.ToShortDateString() : ""); creationDateLabel.Text = (item.CreationDate.HasValue ? item.CreationDate.Value.ToShortDateString() : ""); lastModifiedDateLabel.Text = (item.LastModifiedDate.HasValue ? item.LastModifiedDate.Value.ToShortDateString() : ""); if (item.InstitutionCode != null && item.InstitutionCode.Length > 0) { ddlInst.SelectedValue = item.InstitutionCode; } else { ddlInst.SelectedIndex = 0; } if (item.LanguageCode != null && item.LanguageCode.Length > 0) { ddlLang.SelectedValue = item.LanguageCode.ToUpper(); } else { ddlLang.SelectedIndex = 0; } if (item.VaultID.HasValue) { ddlVault.SelectedValue = item.VaultID.Value.ToString(); } else { ddlVault.SelectedIndex = 0; } if (item.ItemStatusID > 0) { ddlItemStatus.SelectedValue = item.ItemStatusID.ToString(); } else { ddlItemStatus.SelectedIndex = 0; } pageList.DataSource = item.Pages; pageList.DataBind(); } }
private void bindLanguageData() { Item item = (Item)Session["Item" + itemIdTextBox.Text]; // filter out deleted items CustomGenericList<ItemLanguage> itemLanguages = new CustomGenericList<ItemLanguage>(); foreach (ItemLanguage il in item.ItemLanguages) { if (il.IsDeleted == false) { itemLanguages.Add(il); } } languagesList.DataSource = itemLanguages; languagesList.DataBind(); }
/// <summary> /// Reads the specified list of generic data rows into a list of OpenUrlCitations /// </summary> /// <param name="list"></param> /// <returns></returns> private CustomGenericList<OpenUrlCitation> GetOpenUrlCitationList(CustomGenericList<CustomDataRow> list) { CustomGenericList<OpenUrlCitation> citations = new CustomGenericList<OpenUrlCitation>(); foreach (CustomDataRow row in list) { OpenUrlCitation citation = new OpenUrlCitation(); citation.PageID = Utility.ZeroIfNull(row["PageID"].Value); citation.ItemID = Utility.ZeroIfNull(row["ItemID"].Value); citation.TitleID = Utility.ZeroIfNull(row["TitleID"].Value); citation.FullTitle = row["FullTitle"].Value.ToString(); citation.PublisherPlace = row["PublisherPlace"].Value.ToString(); citation.PublisherName = row["PublisherName"].Value.ToString(); citation.Date = row["Date"].Value.ToString(); citation.LanguageName = row["LanguageName"].Value.ToString(); citation.Volume = row["Volume"].Value.ToString(); citation.EditionStatement = row["EditionStatement"].Value.ToString(); citation.CurrentPublicationFrequency = row["CurrentPublicationFrequency"].Value.ToString(); citation.Genre = row["Genre"].Value.ToString(); citation.Authors = row["Authors"].Value.ToString(); citation.Subjects = row["Subjects"].Value.ToString(); citation.StartPage = row["StartPage"].Value.ToString(); citation.EndPage = row["EndPage"].Value.ToString(); citation.Pages = row["Pages"].Value.ToString(); citation.Issn = row["ISSN"].Value.ToString(); citation.Isbn = row["ISBN"].Value.ToString(); citation.Lccn = row["LCCN"].Value.ToString(); citation.Oclc = row["OCLC"].Value.ToString(); citation.Abbreviation = row["Abbreviation"].Value.ToString(); citations.Add(citation); } return citations; }
private NameSearchResult GetPageNameSearchResult(CustomGenericList<CustomDataRow> data) { NameSearchResult result = new NameSearchResult(); result.QueryDate = DateTime.Now.ToString("dd MMM yyyy h:mmtt"); //loop through the results and create a list of NameSearchTitle objects int lastTitleID = -1; int lastItemID = -1; //List<NameSearchTitle> titleList = new List<NameSearchTitle>(); foreach (CustomDataRow row in data) { int currentTitleID = (int)row["TitleID"].Value; if (currentTitleID != lastTitleID) { NameSearchTitle title = new NameSearchTitle(); title.TitleID = (int)row["TitleID"].Value; title.ShortTitle = (string)row["ShortTitle"].Value; title.SortTitle = (string)row["SortTitle"].Value; title.MarcBibID = (string)row["MarcBibID"].Value; result.Titles.Add(title); } NameSearchTitle currentTitle = result.Titles[result.Titles.Count - 1]; int currentItemID = (int)row["ItemID"].Value; if (currentItemID != lastItemID) { NameSearchItem item = new NameSearchItem(); item.ItemID = (int)row["ItemID"].Value; item.ItemSequence = (short)row["ItemSequence"].Value; item.Volume = (string)row["ItemVolume"].Value; currentTitle.Items.Add(item); } NameSearchItem currentItem = currentTitle.Items[currentTitle.Items.Count - 1]; NameSearchPage page = new NameSearchPage(); page.PageID = (int)row["PageID"].Value; page.SequenceOrder = (int)row["SequenceOrder"].Value; page.IndicatedPages = (string)row["IndicatedPages"].Value; currentTitle.TotalPageCount++; currentItem.Pages.Add(page); lastTitleID = currentTitleID; lastItemID = currentItemID; } return result; }
private void bindTitleIdentifierData() { //int titleAssociationId = (int)Session["TitleAssociation"]; int titleAssociationId = Convert.ToInt32(hidTitleAssociationID.Value); TitleAssociation association = this.FindTitleAssociation(titleAssociationId); // filter out deleted items CustomGenericList<TitleAssociation_TitleIdentifier> titleIdentifiers = new CustomGenericList<TitleAssociation_TitleIdentifier>(); foreach (TitleAssociation_TitleIdentifier ti in association.TitleAssociationIdentifiers) { if (ti.IsDeleted == false) { titleIdentifiers.Add(ti); } } identifiersList.DataSource = titleIdentifiers; identifiersList.DataBind(); }
private bool UniqueItemFound( CustomGenericList<CustomDataRow> list ) { ArrayList uniqueItemIDs = new ArrayList(); foreach ( CustomDataRow row in list ) { if ( !ValuePresentInArray( uniqueItemIDs, (int)row[ "ItemID" ].Value ) ) { uniqueItemIDs.Add( (int)row[ "ItemID" ].Value ); } } return uniqueItemIDs.Count == 1; }
private TitleAssociation_TitleIdentifier FindTitleAssociation_TitleIdentifier( CustomGenericList<TitleAssociation_TitleIdentifier> titleTitleIdentifiers, int titleAssociationTitleIdentifierId, int titleIdentifierID, string identifierValue) { foreach (TitleAssociation_TitleIdentifier tati in titleTitleIdentifiers) { if (tati.IsDeleted) { continue; } if (titleAssociationTitleIdentifierId == 0 && tati.TitleAssociation_TitleIdentifierID == 0 && titleIdentifierID == tati.TitleIdentifierID && identifierValue == tati.IdentifierValue) { return tati; } else if (titleAssociationTitleIdentifierId > 0 && tati.TitleAssociation_TitleIdentifierID == titleAssociationTitleIdentifierId) { return tati; } } return null; }
protected CustomGenericList<TitleIdentifier> GetTitleIdentifiers() { BHLProvider bp = new BHLProvider(); _titleIdentifiers = bp.TitleIdentifierSelectAll(); return _titleIdentifiers; }
private PageName findPageName( CustomGenericList<PageName> pageNames, int pageNameId, string nameFound, string nameConfirmed, int? nameBankId, bool active) { foreach ( PageName pn in pageNames ) { if ( pageNameId == 0 && nameBankId == pn.NameBankID && nameFound.ToLower().Equals( pn.NameFound.ToLower() ) && TypeHelper.EmptyIfNull( nameConfirmed ).ToLower().Equals( TypeHelper.EmptyIfNull( pn.NameConfirmed ).ToLower() ) && active == pn.Active ) { return pn; } else if ( pageNameId > 0 && pageNameId == pn.PageNameID ) { return pn; } } return null; }
private bool validate( CustomGenericList<PageName> pageNames ) { bool flag = false; // Check that all edits were completed if ( pageNameList.EditIndex != -1 ) { flag = true; errorControl.AddErrorText( "Page names list has an edit pending" ); } foreach ( PageName pageName in pageNames ) { if ( pageName.NameFound.Trim().Length == 0 && pageName.IsDeleted == false ) { flag = true; errorControl.AddErrorText( "One or more of the page names have an empty Name Found. Please fill in missing data" ); break; } } errorControl.Visible = flag; Page.MaintainScrollPositionOnPostBack = !flag; return !flag; }
private ItemLanguage findItemLanguage(CustomGenericList<ItemLanguage> itemLanguages, int itemLanguageId, string languageCode) { foreach (ItemLanguage il in itemLanguages) { if (il.IsDeleted) { continue; } if (itemLanguageId == 0 && il.ItemLanguageID == 0 && languageCode == il.LanguageCode) { return il; } else if (itemLanguageId > 0 && il.ItemLanguageID == itemLanguageId) { return il; } } return null; }
private void bindPageNameData( bool sort ) { CustomGenericList<PageName> pageNames = (CustomGenericList<PageName>)Session["PageNames" + pageIdTextBox.Text]; // filter out deleted items CustomGenericList<PageName> pns = new CustomGenericList<PageName>(); foreach ( PageName pn in pageNames ) { if ( pn.IsDeleted == false ) { pns.Add( pn ); } } if ( sort ) { PageNameComparer comp = new PageNameComparer( (PageNameComparer.CompareEnum)_sortColumn, _sortOrder ); pns.Sort( comp ); } pageNameList.DataSource = pns; pageNameList.DataBind(); }
public void PageNameSaveList( CustomGenericList<PageName> pageNames ) { PageNameDAL.SaveList( null, null, pageNames ); }