/// <summary> /// Check for existence of OCR files in the folder for the specified item /// </summary> /// <param name="itemID"></param> /// <param name="pageID"></param> /// <param name="ocrTextPath"></param> /// <returns></returns> public bool ItemCheckForOcrText(int itemID, string ocrTextPath) { try { PageSummaryView ps = new BHLProvider().PageSummarySelectByItemAndSequence(itemID, 1); if (ps != null) { string filepath = String.Format(ocrTextPath, ps.OCRFolderShare, ps.MARCBibID, ps.BarCode); string[] files = this.GetFileAccessProvider(true).GetFiles(filepath); if (files.Length == 0) { return(false); } else { return(true); } } else { return(false); } } catch (Exception ex) { throw new Exception("Error checking for OCR files for item " + itemID + ": " + ex.Message); } }
public void ProcessRequest(HttpContext context) { String pageIDString = context.Request.QueryString["PageID"] as String; if (pageIDString == null) return; String heightString = context.Request.QueryString["h"] as String; String widthString = context.Request.QueryString["w"] as String; int height; int width; if (!Int32.TryParse(heightString, out height)) height = 300; if (!Int32.TryParse(widthString, out width)) width = 200; int pageID; if (Int32.TryParse(pageIDString, out pageID)) { BHLProvider provider = new BHLProvider(); PageSummaryView ps = provider.PageSummarySelectByPageId(pageID); String imageUrl = String.Empty; if (ps.ExternalURL == null) { String cat = (ps.WebVirtualDirectory == String.Empty) ? "Researchimages" : ps.WebVirtualDirectory; String item = ps.MARCBibID + "/" + ps.BarCode + "/jp2/" + ps.FileNamePrefix + ".jp2"; imageUrl = String.Format("http://images.mobot.org/ImageWeb/GetImage.aspx?cat={0}&item={1}&wid=" + width.ToString() + "&hei= " + height.ToString() + "&rgn=0,0,1,1&method=scale", cat, item); } else { imageUrl = ps.ExternalURL; } System.Net.WebClient client = new System.Net.WebClient(); context.Response.ContentType = "image/jpeg"; context.Response.BinaryWrite(client.DownloadData(imageUrl)); } }
/// <summary> /// Check for existence of OCR files in the folder for the specified item /// </summary> /// <param name="itemID"></param> /// <param name="pageID"></param> /// <param name="ocrTextPath"></param> /// <returns></returns> public bool ItemCheckForOcrText( int itemID, string ocrTextPath ) { try { PageSummaryView ps = new BHLProvider().PageSummarySelectByItemAndSequence( itemID, 1 ); if ( ps != null ) { string filepath = String.Format( ocrTextPath, ps.OCRFolderShare, ps.MARCBibID, ps.BarCode ); string[] files = this.GetFileAccessProvider(true).GetFiles( filepath ); if ( files.Length == 0 ) return false; else return true; } else { return false; } } catch ( Exception ex ) { throw new Exception( "Error checking for OCR files for item " + itemID + ": " + ex.Message ); } }
protected CustomGenericList<Language> GetLanguages() { BHLProvider bp = new BHLProvider(); _itemLanguages = bp.LanguageSelectAll(); return _itemLanguages; }
public PDF PDFUpdateGenerationInfo(int pdfId, String fileLocation, String fileUrl, int numberImagesMissing, int numberOcrMissing) { BHLProvider bhlServer = new BHLProvider(); return bhlServer.PDFUpdateGenerationInfo(pdfId, fileLocation, fileUrl, numberImagesMissing, numberOcrMissing); }
protected void Page_Load( object sender, EventArgs e ) { if ( !IsPostBack ) { bioTextBox.ToolbarSet = "BHL"; BHLProvider bp = new BHLProvider(); CustomGenericList<Creator> creators = bp.CreatorSelectAll(); Creator emptyCreator = new Creator(); emptyCreator.CreatorID = -1; emptyCreator.CreatorName = ""; creators.Insert( 0, emptyCreator ); ddlAuthors.DataSource = creators; ddlAuthors.DataTextField = "CreatorName"; ddlAuthors.DataValueField = "CreatorId"; ddlAuthors.DataBind(); string idString = Request.QueryString["id"]; int id = 0; if (idString != null && int.TryParse(idString, out id)) { ddlAuthors.SelectedValue = idString; populateForm(); } } errorControl.Visible = false; }
protected void saveAsNewButton_Click( object sender, EventArgs e ) { if ( validate( true ) ) { int id = 0; if ( idTextBox.Text.Trim().Length > 0 ) { id = int.Parse( idTextBox.Text ); } Vault vault = new Vault( id, serverTextBox.Text.Trim(), folderShareTextBox.Text.Trim(), webVirtualFolderTextBox.Text.Trim(), OCRFolderShareTextBox.Text.Trim() ); vault.IsNew = true; BHLProvider bp = new BHLProvider(); bp.SaveVault( vault ); } else { return; } Response.Redirect( "/Admin/Dashboard.aspx" ); }
protected void saveButton_Click(object sender, EventArgs e) { PDF pdf = (PDF)Session["Pdf" + pdfIdLabel.Text]; // Gather up data on form pdf.ArticleTitle = articleTitleTextBox.Text; pdf.ArticleCreators = articleAuthorsTextBox.Text; pdf.ArticleTags = articleSubjectsTextBox.Text; pdf.Comment = commentTextBox.Text; pdf.PdfStatusID = int.Parse(ddlPdfStatus.SelectedValue); pdf.IsNew = false; BHLProvider bp = new BHLProvider(); try { bp.PDFSave(pdf); } catch (Exception ex) { Session["Exception"] = ex; Response.Redirect("/Error.aspx"); } Response.Redirect("/Admin/PdfWeeklyStats.aspx"); }
private void PopulateLanguageList() { BHLProvider provider = new BHLProvider(); CustomDataAccess.CustomGenericList<Language> languages = null; // Cache the results of the languages query for 24 hours String cacheKey = "LanguagesWithPubItems"; if (Cache[cacheKey] != null) { // Use cached version languages = (CustomDataAccess.CustomGenericList<Language>)Cache[cacheKey]; } else { // Refresh cache languages = provider.LanguageSelectWithPublishedItems(); Cache.Add(cacheKey, languages, null, DateTime.Now.AddMinutes( Convert.ToDouble(ConfigurationManager.AppSettings["LanguageListQueryCacheTime"])), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null); } ddlLanguage.DataSource = languages; ddlLanguage.DataBind(); ddlLanguage.Items.Insert(0, new ListItem("(Any Language)", "")); }
protected void ddlLocations_SelectedIndexChanged(object sender, EventArgs e) { clearForm(this.Controls); string name = ddlLocations.SelectedValue; if (name.Length > 0) { BHLProvider bp = new BHLProvider(); Location location = bp.LocationSelectAuto(name); if (location != null) { divAltLocations.Visible = true; nameLiteral.Text = location.LocationName; hidCode.Value = location.LocationName; latitudeTextBox.Text = location.Latitude; longitudeTextBox.Text = location.Longitude; nextAttemptLiteral.Text = location.NextAttemptDate.ToString(); includeInUICheckbox.Checked = location.IncludeInUI; ddlLocations.SelectedValue = location.LocationName; } } else { divAltLocations.Visible = false; } }
public void IndicatedPageSave(int[] pageIDs, string pagePrefix, int style, string start, int increment, bool implied, int userID) { IndicatedPageStyle indicatedPageStyle = (IndicatedPageStyle)style; BHLProvider bhlServer = new BHLProvider(); bhlServer.IndicatedPageSave(pageIDs, pagePrefix, indicatedPageStyle, start, increment, implied, userID); }
private void fillCombos() { BHLProvider bp = new BHLProvider(); CustomGenericList<PDFStatus> pdfStatuses = bp.PDFStatusSelectAll(); ddlPdfStatus.DataSource = pdfStatuses; ddlPdfStatus.DataTextField = "PdfStatusName"; ddlPdfStatus.DataValueField = "PdfStatusID"; ddlPdfStatus.DataBind(); }
/// <summary> /// Check for existence of an OCR file for the specified page /// </summary> /// <param name="pageID"></param> /// <param name="ocrTextLocation"></param> /// <returns></returns> public bool PageCheckForOcrText(int pageID) { try { PageSummaryView ps = new BHLProvider().PageSummarySelectByPageId(pageID); return(this.GetFileAccessProvider(true).FileExists(ps.OcrTextLocation)); } catch (Exception ex) { throw new Exception("Error checking for OCR file for page " + pageID + ": " + ex.Message); } }
public string[] FetchPageUrl( int pageID ) { string[] sa = new string[ 6 ]; PageSummaryView psv = new BHLProvider().PageSummarySelectByPageId( pageID ); sa[ 0 ] = new BHLProvider().GetPageUrl( psv ); sa[ 1 ] = GetTextUrl( psv ); sa[ 2 ] = psv.PageDescription; sa[ 3 ] = psv.PageID.ToString(); sa[ 4 ] = ReplaceReturnsWithBreaks( GetOcrText( psv ) ); sa[ 5 ] = String.Format( "http://names.ubio.org/webservices/service.php?function=findIT&url=http://www.botanicus.org/PrimeOcr/mbgserv14/{0}/{1}/{2}/{3}.txt&strict=1&keyCode=78bd024866f1df74125f194b764d80333e0d64aa", psv.WebVirtualDirectory, psv.MARCBibID, psv.BarCode, psv.FileNamePrefix ); return ( sa ); }
private void PopulatePlaceHolder( int numberOfSubjects ) { Main main = (Main)Page.Master; BHLProvider provider = new BHLProvider(); CustomGenericList<CustomDataRow> list = null; String institutionCode = String.Empty; if (this.Request.Cookies["ddlContributors"] != null) institutionCode = this.Request.Cookies["ddlContributors"].Value; String languageCode = String.Empty; if (this.Request.Cookies["ddlLanguage"] != null) languageCode = this.Request.Cookies["ddlLanguage"].Value; // Cache the results of the Subject queries for 24 hours String cacheKey = "TitleTagSelectCount" + numberOfSubjects.ToString() + institutionCode + languageCode; if ( Cache[ cacheKey ] != null ) { // Use cached version list = (CustomGenericList<CustomDataRow>)Cache[ cacheKey ]; } else { // Refresh cache list = provider.TitleTagSelectCountByInstitution( numberOfSubjects, institutionCode, languageCode ); Cache.Add( cacheKey, list, null, DateTime.Now.AddMinutes( Convert.ToDouble( ConfigurationManager.AppSettings[ "SubjectQueryCacheTime" ] ) ), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null ); } // Read the total number of titles from the first row in the result set if (list.Count > 0) totalCount = (int)list[0]["Count"].Value; else totalCount = main.TitlesOnlineCount; foreach ( CustomDataRow row in list ) { if ( row[ "TagText" ].Value != null ) { HyperLink link = new HyperLink(); link.NavigateUrl = "/subject/" + Server.UrlEncode( row[ "TagText" ].Value.ToString() ); link.Text = row[ "TagText" ].Value.ToString(); link.CssClass = GetCssClassForCount( (int)row[ "Count" ].Value ); titleTagCloudPlaceHolder.Controls.Add( link ); Image spacer = new Image(); spacer.ImageUrl = "/images/blank.gif"; spacer.Height = 1; spacer.Width = 4; titleTagCloudPlaceHolder.Controls.Add( spacer ); } } }
protected void saveAsNewButton_Click( object sender, EventArgs e ) { if ( validate() ) { if ( idTextBox.Text.Trim().Length == 0 ) { errorPanel.Controls.Add( new LiteralControl( "* Please include a unique ID before saving" ) ); errorPanel.Visible = true; return; } else { int id = 0; if ( int.TryParse( idTextBox.Text.Trim(), out id ) ) { BHLProvider bp = new BHLProvider(); CustomGenericList<ItemStatus> itemStatuses = bp.ItemStatusSelectAll(); foreach ( ItemStatus its in itemStatuses ) { if ( its.ItemStatusID == id ) { errorPanel.Controls.Add( new LiteralControl( "* The item status id " + id.ToString() + " is not a unique id, please use another one." ) ); errorPanel.Visible = true; return; } } ItemStatus itemStatus = new ItemStatus( id, statusTextBox.Text.Trim() ); itemStatus.IsNew = true; bp.SaveItemStatus( itemStatus ); } else { errorPanel.Controls.Add( new LiteralControl( "* The item status id " + idTextBox.Text.Trim() + " is not numeric, please use numbers only." ) ); errorPanel.Visible = true; return; } } } else { return; } Response.Redirect( "/Admin/Dashboard.aspx" ); }
private string SelectExpandedNames() { try { MOBOT.BHL.DataObjects.Stats stats = null; stats = new BHLProvider().StatsSelectExpandedNames(); JavaScriptSerializer js = new JavaScriptSerializer(); return js.Serialize(stats); } catch { return null; } }
protected void btnDone_Click(object sender, EventArgs e) { // Get the item to which this PDF is related int itemID; String itemIDString = Request.QueryString["ItemID"] as String; List<int> pageIDs = new List<int>(); // Get the page numbers being requested foreach (DataListItem dlItem in dlPages.Items) { HtmlInputCheckBox pageCheckbox = (HtmlInputCheckBox)dlItem.FindControl("chkPage"); if (pageCheckbox.Checked) pageIDs.Add(Int32.Parse(pageCheckbox.Value)); } String shareWith = txtShareWith.Text; String articleTitle = txtArticleTitle.Text; String articleCreators = txtAuthors.Text; String articleTags = txtSubjects.Text; String emailAddress = txtEmail.Text; bool imagesOnly = rdoImages.Checked; if (shareWith.StartsWith("Enter email addresses")) shareWith = String.Empty; if (articleCreators.StartsWith("Enter names")) articleCreators = String.Empty; if (articleTags.StartsWith("Enter subjects")) articleTags = String.Empty; // Validate submitted data if (this.ValidatePage(itemIDString, pageIDs, emailAddress, shareWith, out itemID)) { litError.Text = this._errMsg; // Save submitted data BHLProvider provider = new BHLProvider(); MOBOT.BHL.DataObjects.PDF pdf = provider.AddNewPdf(itemID, emailAddress, shareWith, imagesOnly, articleTitle, articleCreators, articleTags, pageIDs); this.SendEmail(emailAddress, pdf.PdfID); Response.Cookies["pdf"]["id"] = pdf.PdfID.ToString(); Response.Cookies["pdf"].Expires = DateTime.Now.AddDays(1); Response.Redirect("/PdfGenDone.aspx"); } else { // Return and give error message to user litError.Text = this._errMsg; } }
protected void ddlPageTypes_SelectedIndexChanged( object sender, EventArgs e ) { clearForm( this.Controls ); int pageTypeId = int.Parse( ddlPageTypes.SelectedValue ); if ( pageTypeId > 0 ) { BHLProvider bp = new BHLProvider(); PageType pageType = bp.PageTypeSelectAuto( pageTypeId ); if ( pageType != null ) { idLabel.Text = pageType.PageTypeID.ToString(); nameTextBox.Text = pageType.PageTypeName; descriptionTextBox.Text = TypeHelper.EmptyIfNull( pageType.PageTypeDescription ); ddlPageTypes.SelectedValue = pageType.PageTypeID.ToString(); } } }
protected void ddlItemStatuses_SelectedIndexChanged( object sender, EventArgs e ) { clearForm( this.Controls ); int itemStatusId = int.Parse( ddlItemStatuses.SelectedValue ); if ( itemStatusId > 0 ) { BHLProvider bp = new BHLProvider(); ItemStatus itemStatus = bp.ItemStatusSelectAuto( itemStatusId ); if ( itemStatus != null ) { idTextBox.Text = itemStatus.ItemStatusID.ToString(); hidId.Value = itemStatus.ItemStatusID.ToString(); statusTextBox.Text = itemStatus.ItemStatusName; ddlItemStatuses.SelectedValue = itemStatus.ItemStatusID.ToString(); } } }
private void populatePlaceHolder( int numberOfNames ) { Main main = (Main)Page.Master; BHLProvider provider = new BHLProvider(); CustomGenericList<NameCloud> list = null; // Cache the results of the Subject queries for 24 hours String cacheKey = "NameSelectTop" + numberOfNames.ToString(); if ( Cache[ cacheKey ] != null ) { // Use cached version list = (CustomGenericList<NameCloud>)Cache[ cacheKey ]; } else { // Refresh cache list = provider.PageNameSelectTop( numberOfNames ); Cache.Add( cacheKey, list, null, DateTime.Now.AddMinutes( Convert.ToDouble( ConfigurationManager.AppSettings[ "SubjectQueryCacheTime" ] ) ), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null ); } _totalCount = main.TitlesOnlineCount; list.Sort( SortOrder.Descending, "Qty" ); _maxCount = list[ 0 ].Qty; _minCount = list[ list.Count - 1 ].Qty; list.Sort( "NameConfirmed" ); foreach ( NameCloud nameCloud in list ) { if ( nameCloud.NameConfirmed != null ) { HyperLink link = new HyperLink(); link.NavigateUrl = "/name/" + Server.UrlEncode( nameCloud.NameConfirmed ); link.Text = nameCloud.NameConfirmed; link.CssClass = GetCssClassForCount( nameCloud.Qty ); titleTagCloudPlaceHolder.Controls.Add( link ); Image spacer = new Image(); spacer.ImageUrl = "/images/blank.gif"; spacer.Height = 1; spacer.Width = 4; titleTagCloudPlaceHolder.Controls.Add( spacer ); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BHLProvider provider = new BHLProvider(); // Show the citations that were found int id; string idList = Request.QueryString["id"] as String; if (idList != null) { string[] idStrings = idList.Split('|'); foreach (string idString in idStrings) { if (idString.Length > 1) { if (idString.Substring(0, 1) == "p") { if (Int32.TryParse(idString.Substring(1), out id)) { DataObjects.Page page = provider.PageMetadataSelectByPageID(id); this.AddPageToTable(page); } } else if (idString.Substring(0, 1) == "i") { if (Int32.TryParse(idString.Substring(1), out id)) { DataObjects.PageSummaryView psv = provider.PageSummarySelectByItemId(id); this.AddItemToTable(psv); } } else if (idString.Substring(0, 1) == "t") { if (Int32.TryParse(idString.Substring(1), out id)) { DataObjects.Title title = provider.TitleSelect(id); this.AddTitleToTable(title); } } } } } } }
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(); }
protected void Page_Load( object sender, EventArgs e ) { if ( !IsPostBack ) { BHLProvider bp = new BHLProvider(); CustomGenericList<Vault> vaults = bp.VaultSelectAll(); Vault emptyVault = new Vault(); vaults.Insert( 0, emptyVault ); ddlVaults.DataSource = vaults; ddlVaults.DataTextField = "Description"; ddlVaults.DataValueField = "VaultID"; ddlVaults.DataBind(); } errorControl.Visible = false; }
protected void saveAsNewButton_Click( object sender, EventArgs e ) { if ( validate() ) { PageType pageType = new PageType( 0, nameTextBox.Text.Trim(), descriptionTextBox.Text.Trim() ); pageType.IsNew = true; BHLProvider bp = new BHLProvider(); bp.SavePageType( pageType ); } else { return; } Response.Redirect( "/Admin/Dashboard.aspx" ); }
protected void ddlLanguages_SelectedIndexChanged( object sender, EventArgs e ) { clearForm( this.Controls ); string code = ddlLanguages.SelectedValue; if ( code.Length > 0 ) { BHLProvider bp = new BHLProvider(); Language language = bp.LanguageSelectAuto( code ); if ( language != null ) { codeTextBox.Text = language.LanguageCode; hidCode.Value = language.LanguageCode; nameTextBox.Text = language.LanguageName; noteTextBox.Text = TypeHelper.EmptyIfNull( language.Note ); ddlLanguages.SelectedValue = language.LanguageCode; } } }
private string GenerateDateList(int startDate, int endDate, string institutionCode, string languageCode) { short? curYear = 0; StringBuilder html = new StringBuilder(); String cacheKey = "YearBrowse" + startDate.ToString() + endDate.ToString() + institutionCode + languageCode; if (Cache[cacheKey] != null) { // Use cached version html.Append(Cache[cacheKey].ToString()); } else { BHLProvider provider = new BHLProvider(); CustomGenericList<Data.Title> tl = provider.TitleSelectByDateRangeAndInstitution(startDate, endDate, institutionCode, languageCode); html.Append("<p class=\"pageheader\">"); html.Append(tl.Count + " title"); if (tl.Count != 1) html.Append("s"); html.Append(" with a publication start date between " + startDate.ToString() + " and " + endDate.ToString()); html.Append("</p>"); html.Append("<ul>"); foreach (Data.Title t in tl) { if (t.StartYear != curYear) { curYear = t.StartYear; html.Append("</ul><p class=\"pageheader\">" + curYear.Value.ToString() + "</p><ul>"); } html.Append("<li><a href=\"/bibliography/" + t.TitleID.ToString() + "\">" + t.FullTitle + " " + (t.PartNumber ?? "") + " " + (t.PartName ?? "") + "</a><br />"); html.Append("Publication Info: " + t.PublicationDetails + "<br>"); html.Append("Contributed By: " + t.InstitutionName + "</li>"); } html.Append("</ul>"); // Cache the HTML fragment Cache.Add(cacheKey, html.ToString(), null, DateTime.Now.AddMinutes( Convert.ToDouble(ConfigurationManager.AppSettings["BrowseQueryCacheTime"])), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null); } return ( html.ToString() ); }
protected void saveAsNewButton_Click( object sender, EventArgs e ) { BHLProvider bp = new BHLProvider(); if ( validate() ) { if ( codeTextBox.Text.Trim().Length == 0 ) { errorControl.AddErrorText( "Please include a unique language code before saving" ); errorControl.Visible = true; return; } else { CustomGenericList<Language> languages = bp.LanguageSelectAll(); string code = codeTextBox.Text.Trim().ToUpper(); foreach ( Language language in languages ) { if ( language.LanguageCode.ToUpper().Equals( code ) ) { errorControl.AddErrorText( "The language code " + language.LanguageCode.ToUpper() + " is not a unique code, please use another one." ); errorControl.Visible = true; return; } } } Language lang = new Language( codeTextBox.Text.Trim().ToUpper(), nameTextBox.Text.Trim(), noteTextBox.Text.Trim() ); lang.IsNew = true; bp.SaveLanguage( lang ); } else { return; } Response.Redirect( "/Admin/Dashboard.aspx" ); }
protected void saveAsNewButton_Click( object sender, EventArgs e ) { BHLProvider bp = new BHLProvider(); if ( validate() ) { if ( codeTextBox.Text.Trim().Length == 0 ) { errorControl.AddErrorText( "Please include a unique institution code before saving" ); errorControl.Visible = true; return; } else { CustomGenericList<Institution> institutions = bp.InstituationSelectAll(); string code = codeTextBox.Text.Trim().ToUpper(); foreach ( Institution inst in institutions ) { if ( inst.InstitutionCode.ToUpper().Equals( code ) ) { errorControl.AddErrorText( "The institution code " + inst.InstitutionCode.ToUpper() + " is not a unique code, please use another one." ); errorControl.Visible = true; return; } } } Institution institution = new Institution( codeTextBox.Text.Trim().ToUpper(), nameTextBox.Text.Trim(), noteTextBox.Text.Trim(), urlTextBox.Text.Trim(), chkIsMemberLibrary.Checked ); institution.IsNew = true; bp.SaveInstitution( institution ); } else { return; } Response.Redirect( "/Admin/Dashboard.aspx" ); }
private string TitleSearch(int titleId, String title) { try { TitleSearchCriteria criteria = new TitleSearchCriteria(); if (titleId != 0) criteria.TitleID = titleId; criteria.Title = title + '%'; criteria.StartRow = 1; criteria.PageSize = 10000; criteria.OrderBy = TitleSearchOrderBy.Title; criteria.SortOrder = SortOrder.Ascending; CustomGenericList<Title> titles = new BHLProvider().TitleSearchPaging(criteria); JavaScriptSerializer js = new JavaScriptSerializer(); return js.Serialize(titles); } catch { return null; } }
protected void Page_Load( object sender, EventArgs e ) { if ( !IsPostBack ) { BHLProvider bp = new BHLProvider(); CustomGenericList<ItemStatus> itemStatuses = bp.ItemStatusSelectAll(); itemStatuses.Sort(); ItemStatus emptyItemStatus = new ItemStatus(); emptyItemStatus.ItemStatusID = -1; emptyItemStatus.ItemStatusName = ""; itemStatuses.Insert( 0, emptyItemStatus ); ddlItemStatuses.DataSource = itemStatuses; ddlItemStatuses.DataTextField = "ItemStatusName"; ddlItemStatuses.DataValueField = "ItemStatusID"; ddlItemStatuses.DataBind(); } }
protected void ddlVaults_SelectedIndexChanged( object sender, EventArgs e ) { clearForm( this.Controls ); int vaultId = int.Parse( ddlVaults.SelectedValue ); if ( vaultId > 0 ) { BHLProvider bp = new BHLProvider(); Vault vault = bp.VaultSelect( vaultId ); if ( vault != null ) { idTextBox.Text = vault.VaultID.ToString(); idHid.Value = vault.VaultID.ToString(); serverTextBox.Text = vault.Server; folderShareTextBox.Text = vault.FolderShare; webVirtualFolderTextBox.Text = vault.WebVirtualDirectory; OCRFolderShareTextBox.Text = vault.OCRFolderShare; ddlVaults.SelectedValue = vault.VaultID.ToString(); } } }