public Name NameGetDetail(string nameBankID) { // Validate the input int nameBankIDValid; double nameBankIDDouble; if (!Double.TryParse(nameBankID, out nameBankIDDouble)) { throw new SoapException("nameBankID (" + nameBankID + ") must be a valid integer value.", SoapException.ClientFaultCode); } else { nameBankIDValid = (int)Math.Floor(nameBankIDDouble); } Name name = null; MOBOT.Services.NameServiceDataObjects.Title currentTitle = null; Item currentItem = null; Page currentPage = null; PageType pageType = null; try { CustomGenericList<PageDetail> pageDetails = NameServiceDAL.PageSelectByNameBankID(null, null, nameBankIDValid); if (pageDetails.Count > 0) { // Get the name information name = new Name(); name.NameBankID = pageDetails[0].NameBankID; name.NameConfirmed = pageDetails[0].NameConfirmed; name.Titles = new CustomGenericList<MOBOT.Services.NameServiceDataObjects.Title>(); currentTitle = new MOBOT.Services.NameServiceDataObjects.Title(); currentItem = new Item(); currentPage = new Page(); // Get the title, item, and page information foreach (PageDetail pageDetail in pageDetails) { if (pageDetail.TitleID != currentTitle.TitleID) { // Add a new title MOBOT.Services.NameServiceDataObjects.Title title = new MOBOT.Services.NameServiceDataObjects.Title(); title.TitleID = pageDetail.TitleID; title.MarcBibID = pageDetail.MarcBibID; title.PublicationTitle = pageDetail.PublicationTitle; title.PublicationDetails = pageDetail.PublicationDetails; title.Author = pageDetail.Author; title.BPH = pageDetail.BPH; title.TL2 = pageDetail.TL2; title.Abbreviation = pageDetail.Abbreviation; title.TitleUrl = pageDetail.TitleUrl; title.Items = new CustomGenericList<Item>(); name.Titles.Add(title); currentTitle = title; } if (pageDetail.ItemID != currentItem.ItemID) { // Add a new item Item item = new Item(); item.ItemID = pageDetail.ItemID; item.BarCode = pageDetail.BarCode; item.MarcItemID = pageDetail.MarcItemID; item.CallNumber = pageDetail.CallNumber; item.VolumeInfo = pageDetail.VolumeInfo; item.ItemUrl = pageDetail.ItemUrl; item.Pages = new CustomGenericList<Page>(); currentTitle.Items.Add(item); currentItem = item; } if (pageDetail.PageID != currentPage.PageID || pageDetail.Number != currentPage.Number) { // Add a new page Page page = new Page(); page.PageID = pageDetail.PageID; page.Year = pageDetail.Year; page.Volume = pageDetail.Volume; page.Issue = pageDetail.Issue; page.Prefix = pageDetail.Prefix; page.Number = pageDetail.Number; page.PageUrl = pageDetail.PageUrl; page.ThumbnailUrl = pageDetail.ThumbnailUrl; page.ImageUrl = pageDetail.ImageUrl; page.PageTypes = new CustomGenericList<PageType>(); currentItem.Pages.Add(page); currentPage = page; } if (pageDetail.PageTypeName != String.Empty) { // Add a new page type pageType = new PageType(); pageType.PageTypeName = pageDetail.PageTypeName; currentPage.PageTypes.Add(pageType); } } } return name; } catch (Exception ex) { throw new SoapException(ex.Message, SoapException.ServerFaultCode); } }
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); } }