예제 #1
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        public void BindData()
        {
            var allCategories = CategoryManager.GetByProjectId(ProjectId);

            tvCategory.Nodes.Clear();

            var tree = tvCategory.Nodes;

            if (ShowRoot)
            {
                tree.Add(new TreeNode(GetLocalResourceObject("RootCategory").ToString(), ""));
            }

            var depth = ShowRoot ? 1 : 0;

            PopulateTreeView(tree, depth, allCategories);

            var tn = new TreeNode
            {
                Text = String.Format("{0}</a></td><td style='width:100%;text-align:right;'><a>{1}&nbsp;",
                                     GetLocalResourceObject("Unassigned"),
                                     IssueManager.GetCountByProjectAndCategoryId(ProjectId)),
                NavigateUrl = String.Format("~/Issues/IssueList.aspx?pid={0}&c={1}", ProjectId, 0)
            };

            tvCategory.Nodes.Add(tn);

            tvCategory.ExpandAll();
        }
예제 #2
0
 public void TestGetIssueCountByProjectAndCategory()
 {
     Assert.IsTrue(IssueManager.GetCountByProjectAndCategoryId(ProjectId, CategoryId) == 31);
 }
예제 #3
0
        /// <summary>
        /// Creates an RSS news feed for Issues By category
        /// </summary>
        /// <param name="feed">The feed.</param>
        private void CategoryFeed(ref SyndicationFeed feed)
        {
            var             objComps = new CategoryTree();
            List <Category> al       = objComps.GetCategoryTreeByProjectId(_projectId);

            var     feedItems = new List <SyndicationItem>();
            Project p         = ProjectManager.GetById(_projectId);

            foreach (Category c in al)
            {
                var item = new SyndicationItem();

                item.Title = SyndicationContent.CreatePlaintextContent(c.Name);
                item.Links.Add(
                    SyndicationLink.CreateAlternateLink(
                        new Uri(
                            GetFullyQualifiedUrl(string.Format("~/Issues/IssueList.aspx?pid={0}&c={1}", _projectId,
                                                               c.Id)))));
                item.Summary =
                    SyndicationContent.CreatePlaintextContent(
                        string.Format(GetLocalResourceObject("OpenIssues").ToString(), IssueManager.GetCountByProjectAndCategoryId(_projectId, c.Id)));
                item.PublishDate = DateTime.Now;
                // Add the item to the feed
                feedItems.Add(item);
            }
            feed.Title =
                SyndicationContent.CreatePlaintextContent(
                    string.Format(GetLocalResourceObject("IssuesByCategoryTitle").ToString(), p.Name));
            feed.Description =
                SyndicationContent.CreatePlaintextContent(
                    string.Format(GetLocalResourceObject("IssuesByCategoryDescription").ToString(), p.Name));
            feed.Items = feedItems;
        }