/// <summary> /// Populate the page with database queries /// </summary> private void InitCreationData() { RaceDAO raceDAO = new RaceDAO(); races = raceDAO.GetAllRaces(); ClassDAO classDAO = new ClassDAO(); classes = classDAO.GetAllClasses(); BackgroundDAO backgroundDAO = new BackgroundDAO(); backgrounds = backgroundDAO.GetAllBackgroundTypes(); }
private void BackgroundLinks() { string backgroundIDstr = ""; BackgroundDAO bDAO = new BackgroundDAO(); List <Background> backgroundList = bDAO.GetAllBackgroundTypes(); if (Request.QueryString.AllKeys.Contains("backgroundID")) { backgroundIDstr = Request.QueryString.Get("backgroundID"); } //checks to make sure that the string isn't null if (backgroundIDstr.Length > 0) { int backID = int.Parse(backgroundIDstr); int counter = 0; while (backID != backgroundList[counter].BackgroundId) { counter++; } Background pulledBackground = backgroundList[counter]; name.InnerHtml = pulledBackground.Name; description.InnerHtml = pulledBackground.Description; descriptor2.InnerHtml = "<br>Personality Traits:"; descriptor2.InnerHtml += "<br>"; foreach (String pulledBackgroundPersonalityTrait in pulledBackground.Personality) { descriptor2.InnerHtml += pulledBackgroundPersonalityTrait; descriptor2.InnerHtml += "<br>"; } descriptor3.InnerHtml = "<br>Ideals:"; descriptor3.InnerHtml += "<br>"; foreach (String pulledBackgroundIdeal in pulledBackground.Ideals) { descriptor3.InnerHtml += pulledBackgroundIdeal; descriptor3.InnerHtml += "<br>"; } descriptor4.InnerHtml = "<br>Bonds:"; descriptor4.InnerHtml += "<br>"; foreach (String pulledBackgroundBond in pulledBackground.Bonds) { descriptor4.InnerHtml += pulledBackgroundBond; descriptor4.InnerHtml += "<br>"; } descriptor5.InnerHtml = "<br>Flaws:"; descriptor5.InnerHtml += "<br>"; foreach (String pulledBackgroundFlaw in pulledBackground.Flaws) { descriptor5.InnerHtml += pulledBackgroundFlaw; descriptor5.InnerHtml += "<br>"; } } //connect to db and populate the links div with 1 link for each entry to DB links.InnerHtml = ""; links.InnerHtml = "<a href='EncyclopaediaOverview.aspx' class='text-dark'>> Back</a><br>"; foreach (Background lBackground in backgroundList) { int bgID = lBackground.BackgroundId; string bgName = lBackground.Name; links.InnerHtml += "<a href=\"EncyclopaediaOverview.aspx?encyclopaediaReq=backgroundTypes&backgroundID=" + bgID + "\" class='text-dark'>" + bgName + "</a><br /> "; } }