Exemple #1
0
 private NameSpaceItem AddNameSpaceToSite(int siteid, string name)
 {
     // Create a new NameSpace object and create a new name space for a test site
     IInputContext context = DnaMockery.CreateDatabaseInputContext();
     using (IDnaDataReader reader = context.CreateDnaDataReader("addnamespacetosite"))
     {
         // Create the namespace object and call the add namespace method
         NameSpaces testNameSpace = new NameSpaces(context);
         return new NameSpaceItem(name, testNameSpace.AddNameSpaceForSite(siteid, name));
     }
 }
    /// <summary>
    /// The event handler for the create namespace button click
    /// </summary>
    /// <param name="sender">The button control that was clicked</param>
    /// <param name="e">Any arguments that are associated with the event</param>
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        // Check to make sure that we are not creating an existsing namespace
        if (CheckToMakeSureNameDoesNotAlreadyExist(tbNewName.Text))
        {
            // The name already exists!
            txtWarning.Height = new Unit("26px");
            txtWarning.Visible = true;
            txtWarning.Text = "That namespace already exists!";
            return;
        }

        // Create a namespace object that will create the new namespace for the site
        NameSpaces siteNameSpaces = new NameSpaces(_basePage);
        int id = siteNameSpaces.AddNameSpaceForSite(_basePage.CurrentSite.SiteID, tbNewName.Text);
        tblNameSpaces.Rows.Add(CreateNameSpaceTableItem(new NameSpaceItem(tbNewName.Text,id)));
    }