protected CustomGenericList<Language> GetLanguages() { BHLProvider bp = new BHLProvider(); _itemLanguages = bp.LanguageSelectAll(); return _itemLanguages; }
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" ); }
private void fillLanguages() { BHLProvider bp = new BHLProvider(); CustomGenericList<Language> languages = bp.LanguageSelectAll(); Language emptyLanguage = new Language(); emptyLanguage.LanguageCode = ""; emptyLanguage.LanguageName = ""; languages.Insert( 0, emptyLanguage ); ddlLanguages.DataSource = languages; ddlLanguages.DataTextField = "LanguageName"; ddlLanguages.DataValueField = "LanguageCode"; ddlLanguages.DataBind(); }
private void fillCombos() { BHLProvider bp = new BHLProvider(); CustomGenericList<Institution> institutions = bp.InstituationSelectAll(); Institution emptyInstitution = new Institution(); emptyInstitution.InstitutionCode = ""; emptyInstitution.InstitutionName = ""; institutions.Insert(0, emptyInstitution); ddlInst.DataSource = institutions; ddlInst.DataTextField = "InstitutionName"; ddlInst.DataValueField = "InstitutionCode"; ddlInst.DataBind(); CustomGenericList<Language> languages = bp.LanguageSelectAll(); Language emptyLanguage = new Language(); emptyLanguage.LanguageCode = ""; emptyLanguage.LanguageName = ""; languages.Insert( 0, emptyLanguage ); ddlLang.DataSource = languages; ddlLang.DataTextField = "LanguageName"; ddlLang.DataValueField = "LanguageCode"; ddlLang.DataBind(); CustomGenericList<Vault> vaults = bp.VaultSelectAll(); Vault emptyVault = new Vault(); emptyVault.VaultID = 0; emptyVault.Description = ""; vaults.Insert( 0, emptyVault ); ddlVault.DataSource = vaults; ddlVault.DataTextField = "Description"; ddlVault.DataValueField = "VaultID"; ddlVault.DataBind(); CustomGenericList<ItemStatus> itemStatuses = bp.ItemStatusSelectAll(); ddlItemStatus.DataSource = itemStatuses; ddlItemStatus.DataTextField = "ItemStatusName"; ddlItemStatus.DataValueField = "ItemStatusID"; ddlItemStatus.DataBind(); }