Example #1
0
    /// <summary>
    /// Handles the Click event of the btnSave control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnNewFolderSave_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
            string folder = txtNewFolder.Text;
            string path   =
                string.Format(
                    CultureInfo.InvariantCulture,
                    Resource.NewObjectPath,
                    _root,
                    folder);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            Folder f = new Folder()
            {
                Path = path
            };

            AccessManager.AddFolderKey(f);

            foreach (Access v in AccessControl1.AccessList)
            {
                v.ItemId   = f.Id;
                v.ItemType = ItemType.FileFolder;
                AccessManager.AddAccess(v);
            }

            Refresh();
        }
    }
Example #2
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        try
        {
            string id = Request["id"];

            Category         category;
            IList <Category> categories = GetAllViewableCategories();

            //Edit
            if (id != null)
            {
                category             = DocoManager.GetCategory(id);
                category.DisplayName = txtDisplayName.Text;
            }
            else //New
            {
                category = DocoManager.CreateCategory(txtDisplayName.Text);
            }

            Category parentCategory = categories[cmbParentCategory.SelectedIndex];
            // The parent category can be assiged as the same category, do not allow this.
            // Also do not allow the root category (with parent null) to be changed.
            if (!parentCategory.Id.Equals(category.Id) && category.ParentCategory != null)
            {
                category.ParentCategory = categories[cmbParentCategory.SelectedIndex];
            }
            category.Description = txtDescription.Text;
            DocoManager.UpdateCategory(category);
            IList <Access> currentAccess = AccessManager.GetItemAccess(category.Id);

            foreach (Access access in currentAccess)
            {
                AccessManager.RemoveAccess(access.Id);
            }

            foreach (Access a in AccessControl1.AccessList)
            {
                a.Id       = null;
                a.ItemId   = category.Id;
                a.ItemType = ItemType.DocoCategory;
                AccessManager.AddAccess(a);
            }

            ((IFeedback)this.Page.Master).QueueFeedback(
                BusiBlocksConstants.Blocks.Documents.LongName,
                "Category",
                Feedback.Actions.Saved,
                category.DisplayName
                );

            Navigation.Admin_ManageDoco().Redirect(this);
        }
        catch (Exception ex)
        {
            throw ex;
            ((IFeedback)Master).SetException(GetType(), ex);
        }
    }
        public void Execute(Arguments arguments)
        {
            try
            {
                var access = AccessManager.AddAccess();
                access.OpenProject(arguments.Path.Value, arguments.OpenExclusive.Value, arguments.Show.Value);

                Scripter.Variables.SetVariableValue(arguments.Result.Value, new IntegerStructure(access.Id));
            }
            catch (Exception ex)
            {
                //if (ex.GetType() == typeof(COMException) && ex.Message.Contains("80040154"))
                //    throw new Exception("Could not find Microsoft Office on computer. Please make sure it is installed and try again.");
                throw new ApplicationException($"Problem occured while opening access instance. Path: '{arguments.Path?.Value}'", ex);
            }
        }
Example #4
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        try
        {
            string forumId = Request["id"];
            BusiBlocks.CommsBlock.Forums.Category forum;

            //Edit
            if (forumId != null)
            {
                forum             = BusiBlocks.CommsBlock.Forums.ForumsManager.GetCategory(forumId);
                forum.DisplayName = txtDisplayName.Text;
            }
            else //New
            {
                forum = BusiBlocks.CommsBlock.Forums.ForumsManager.CreateCategory(txtName.Text, txtDisplayName.Text);
            }

            forum.AttachEnabled    = chkEnabledAttach.Checked;
            forum.AttachExtensions = txtAttachExtensions.Text;
            forum.AttachMaxSize    = int.Parse(txtAttachMaxSize.Text);

            BusiBlocks.CommsBlock.Forums.ForumsManager.UpdateCategory(forum);

            IList <Access> currentAccess = AccessManager.GetItemAccess(forum.Id);
            foreach (Access access in currentAccess)
            {
                AccessManager.RemoveAccess(access.Id);
            }
            foreach (Access a in ctrlAccess.AccessList)
            {
                a.Id       = null;
                a.ItemId   = forum.Id;
                a.ItemType = BusiBlocks.ItemType.ForumTopic;
                AccessManager.AddAccess(a);
            }
            Navigation.Admin_ManageComm().Redirect(this);
        }
        catch (Exception ex)
        {
            throw ex;
            ((IFeedback)Master).SetException(GetType(), ex);
        }
    }
Example #5
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        try
        {
            string id = Request["id"];

            Category category;

            //Edit
            if (id != null)
            {
                category      = NewsManager.GetCategory(id);
                category.Name = txtDisplayName.Text;
            }
            else //New
            {
                category = NewsManager.CreateCategory(txtDisplayName.Text);
            }

            IList <Category> categories = GetAllViewableCategories(id);
            // Remove this category from the categories list.
            var indexOfThisCategory = from x in categories
                                      where x.Name.Equals(category.Name)
                                      select categories.IndexOf(x);

            if (indexOfThisCategory.Any())
            {
                categories.RemoveAt(indexOfThisCategory.First());
            }

            if (categories.Count > 0)
            {
                if (cmbParentCategory.SelectedIndex >= 0)
                {
                    Category parentCategory = categories[cmbParentCategory.SelectedIndex];
                    // The parent category can be assiged as the same category, do not allow this.
                    if (!parentCategory.Id.Equals(category.Id))
                    {
                        category.ParentCategory = categories[cmbParentCategory.SelectedIndex];
                    }
                }
            }
            category.Description = txtDescription.Text;
            NewsManager.UpdateCategory(category);
            IList <Access> currentAccess = AccessManager.GetItemAccess(category.Id);

            foreach (Access access in currentAccess)
            {
                AccessManager.RemoveAccess(access.Id);
            }

            foreach (Access a in AccessControl1.AccessList)
            {
                a.Id       = null;
                a.ItemId   = category.Id;
                a.ItemType = BusiBlocks.ItemType.NewsItem;
                AccessManager.AddAccess(a);
            }

            ((IFeedback)this.Page.Master).QueueFeedback(
                BusiBlocksConstants.Blocks.Communication.LongName,
                "Category",
                Feedback.Actions.Saved,
                category.Name
                );

            Navigation.Admin_ManageComm().Redirect(this);
        }
        catch (Exception ex)
        {
            throw ex;
            ((IFeedback)Master).SetException(GetType(), ex);
        }
    }
 public void Execute(Arguments arguments)
 {
     AccessManager.AddAccess();
     AccessManager.CurrentAccess.New();
 }