/// <summary> /// The event handler for the show phrases button clicks /// </summary> /// <param name="sender">The button controls that was clicked</param> /// <param name="e">Any arguments associated with the event</param> protected void OnShowButtonClick(object sender, EventArgs e) { // Check to make sure the button clicked was a show button Button btClicked = ((Button)sender); if (btClicked.CommandName.CompareTo("Show") == 0) { // Get the ID From the command argument and find the table row that is associated with the namespace item string cmdArg = btClicked.CommandArgument; int ID = Convert.ToInt32(cmdArg.Substring(4)); TableRow nameSpaceRow = (TableRow)FindControl("namespaceitem" + ID); int index = tblNameSpaces.Rows.GetRowIndex(nameSpaceRow); // Get all the phrases for the item and insert it into the table under the namespace NameSpaces siteNameSpaces = new NameSpaces(_basePage); List<string> phrases = siteNameSpaces.GetPhrasesForNameSpaceItem(_basePage.CurrentSite.SiteID,ID); tblNameSpaces.Rows.AddAt(index + 1, CreatePhrasesForItem(ID, phrases)); } }
private List<string> GetPhrasesForNameSpace(int siteid, int namespaceid, NameSpaces nameSpace) { // Now get all the phrases for a given namespace IInputContext context = DnaMockery.CreateDatabaseInputContext(); using (IDnaDataReader reader = context.CreateDnaDataReader("getphrasesfornamespace")) { return nameSpace.GetPhrasesForNameSpaceItem(siteid, namespaceid); } }