Пример #1
0
        /// <summary>
        /// Binds the options.
        /// </summary>
        private void BindOptions()
        {
            List<ITUser> users = ITUser.GetUsersByProjectId(ProjectId);
            //Get Type
            DropIssueType.DataSource = IssueType.GetIssueTypesByProjectId(ProjectId);
            DropIssueType.DataBind();

            //Get Priority
            DropPriority.DataSource = Priority.GetPrioritiesByProjectId(ProjectId);
            DropPriority.DataBind();

            //Get Resolutions
            DropResolution.DataSource = Resolution.GetResolutionsByProjectId(ProjectId);
            DropResolution.DataBind();

            //Get categories
            CategoryTree categories = new CategoryTree();
            DropCategory.DataSource = categories.GetCategoryTreeByProjectId(ProjectId);
            DropCategory.DataBind();

            //Get milestones
            if (IssueId == 0)
            {
                DropMilestone.DataSource = Milestone.GetMilestoneByProjectId(ProjectId, false);
            }
            else
            {
                DropMilestone.DataSource = Milestone.GetMilestoneByProjectId(ProjectId);
            }
            DropMilestone.DataBind();

            DropAffectedMilestone.DataSource = Milestone.GetMilestoneByProjectId(ProjectId);
            DropAffectedMilestone.DataBind();

            //Get Users
            DropAssignedTo.DataSource = users;
            DropAssignedTo.DataBind();

            DropOwned.DataSource = users;
            DropOwned.DataBind();
            DropOwned.SelectedValue = User.Identity.Name;

            DropStatus.DataSource = Status.GetStatusByProjectId(ProjectId);
            DropStatus.DataBind();

            lblDateCreated.Text = DateTime.Now.ToString("f");
            lblLastModified.Text = DateTime.Now.ToString("f");

            if (User.Identity.IsAuthenticated)
            {
                lblReporter.Text = Security.GetDisplayName();
                lblLastUpdateUser.Text = Security.GetDisplayName();
            }
        }
Пример #2
0
        /// <summary>
        /// When the user changes the selected field type, show the corresponding list
        /// of possible values.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void dropFieldSelectedIndexChanged(Object s, EventArgs e)
        {
            dropValue.Items.Clear();
            switch (dropField.SelectedValue)
            {
                case "IssueId":
                    dropValue.Visible = false;
                    txtValue.Visible = true;
                    break;
                case "IssueTitle":
                    dropValue.Visible = false;
                    txtValue.Visible = true;
                    break;
                case "IssueDescription":
                    dropValue.Visible = false;
                    txtValue.Visible = true;
                    break;
                case "IssueVotes":
                    dropValue.Visible = false;
                    txtValue.Visible = true;
                    break;
                case "IssuePriorityId" :
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    dropValue.DataSource = Priority.GetPrioritiesByProjectId(ProjectId);
                    dropValue.DataTextField = "Name";
                    dropValue.DataValueField = "Id";
                    break;
                case "IssueTypeId":
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    dropValue.DataSource = IssueType.GetIssueTypesByProjectId(ProjectId);
                    dropValue.DataTextField = "Name";
                    dropValue.DataValueField = "Id";
                    break;
                case "IssueMilestoneId" :
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    dropValue.DataSource = Milestone.GetMilestoneByProjectId(ProjectId);
                    dropValue.DataTextField = "Name";
                    dropValue.DataValueField = "Id";
                    break;
                case "IssueAffectedMilestoneId":
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    dropValue.DataSource = Milestone.GetMilestoneByProjectId(ProjectId);
                    dropValue.DataTextField = "Name";
                    dropValue.DataValueField = "Id";
                    break;
                case "IssueResolutionId":
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    dropValue.DataSource = Resolution.GetResolutionsByProjectId(ProjectId);
                    dropValue.DataTextField = "Name";
                    dropValue.DataValueField = "Id";
                    break;
                case "IssueCategoryId" :
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    CategoryTree objCats = new CategoryTree();
                    dropValue.DataSource = objCats.GetCategoryTreeByProjectId(ProjectId);
                    dropValue.DataTextField = "Name";
                    dropValue.DataValueField = "Id";
                    break;
                case "IssueStatusId" :
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    dropValue.DataSource = Status.GetStatusByProjectId(ProjectId);
                    dropValue.DataTextField = "Name";
                    dropValue.DataValueField = "Id";
                    break;
                case "IssueAssignedUserId" :
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    dropValue.DataSource = ITUser.GetUsersByProjectId(ProjectId);
                    dropValue.DataTextField = "DisplayName";
                    dropValue.DataValueField = "Id";
                    break;
                case "IssueOwnerUserId" :
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    dropValue.DataSource = ITUser.GetUsersByProjectId(ProjectId);
                    dropValue.DataTextField = "DisplayName";
                    dropValue.DataValueField = "Id";
                    break;
                case "IssueCreatorUserId" :
                    dropValue.Visible = true;
                    txtValue.Visible = false;
                    dropValue.DataSource = ITUser.GetUsersByProjectId(ProjectId);
                    dropValue.DataTextField = "DisplayName";
                    dropValue.DataValueField = "Id";
                    break;
                case "DateCreated":
                    dropValue.Visible = false;
                    txtValue.Visible = true;
                    txtValue.CssClass = "dateField embed";
                    break;
                case "LastUpdate":
                    dropValue.Visible = false;
                    txtValue.Visible = true;
                    txtValue.CssClass = "dateField embed";
                    break;
                case "IssueDueDate":
                    dropValue.Visible = false;
                    txtValue.Visible = true;
                    txtValue.CssClass = "dateField embed";
                    break;
                case "CustomFieldName":
                    dropValue.Visible = false;
                    txtValue.Visible = true;  //show the text value field. Not needed.
                    if (CustomField.GetCustomFieldsByProjectId(ProjectId).Count > 0 )
                    {
                        dropField.DataSource = CustomField.GetCustomFieldsByProjectId(ProjectId);
                        dropField.DataTextField = "Name";
                        dropField.DataValueField = "Name";
                        dropField.DataBind();// bind to the new datasource.
                        dropField.Items.Add("--Reset Fields--");
                        dropField.Items.Insert(0, new ListItem("-- Select Custom Field --","0"));
                        CustomFieldQuery = true;
                    }
                    break;
                default :
                    if (dropField.SelectedItem.Text.Equals("-- Select Custom Field --".ToString()))
                        return;
                    // The user decides to reset the fields
                    if (dropField.SelectedItem.Text.Equals("--Reset Fields--".ToString()))
                    {
                        dropField.DataSource = null;
                        dropField.DataSource = RequiredField.GetRequiredFields();
                        dropField.DataTextField = "Name";
                        dropField.DataValueField = "Value";
                        dropField.DataBind();
                        CustomFieldQuery = false;
                    }
                    //RW Once the list is populated with any varying type of name,
                    //we just default to this case, because we know it is not a standard field.
                    else
                    {
                        //check the type of this custom field and load the appropriate values.
                        CustomField cf = CustomField.GetCustomFieldsByProjectId(ProjectId).Find(delegate(CustomField  c) { return c.Name == dropField.SelectedValue; });
                        if (cf == null)
                            return;

                        if (cf.FieldType == CustomField.CustomFieldType.DropDownList)
                        {
                            txtValue.Visible = false;
                            dropValue.Visible = true;
                            dropValue.DataSource = CustomFieldSelection.GetCustomFieldsSelectionsByCustomFieldId(cf.Id);
                            dropValue.DataTextField = "Name";
                            dropValue.DataValueField = "Value";
                        }
                        else if (cf.FieldType == CustomField.CustomFieldType.Date)
                        {
                            dropValue.Visible = false;
                            txtValue.Visible = true;
                            txtValue.CssClass = "dateField embed";
                        }
                        else
                        {
                            dropValue.Visible = false;
                            txtValue.Visible = true;
                        }
                    }
                    break;
            }
            try{
                dropValue.DataBind();
            }catch{}
        }
Пример #3
0
        /// <summary>
        /// Creates an RSS news feed for Issues By category
        /// </summary>
        private void CategoryFeed()
        {
            CategoryTree objComps = new CategoryTree();
            List<Category> al = objComps.GetCategoryTreeByProjectId(projectId);

            foreach (Category c in al)
            {
                RssItem item = new RssItem();
                item.Title = c.Name;
                item.Description = string.Concat(Issue.GetIssueCountByProjectAndCategory(projectId, c.Id).ToString(), " Open Issues");
                item.PubDate = DateTime.Now;
                item.Link = new System.Uri(Page.ResolveUrl(string.Format("{2}/Issues/IssueList.aspx?pid={0}&s=0&c={1}", projectId, c.Id, HostSetting.GetHostSetting("DefaultUrl"))));
                channel.Items.Add(item);
            }

            channel.Title = projectName + " Issues By Category";
            channel.Description = "A listing of all " + projectName + " issues grouped by category";
        }
 /// <summary>
 /// Inits this instance.
 /// </summary>
 public void Initialize()
 {
     CategoryTree categories = new CategoryTree();
     DropCategory.DataSource = categories.GetCategoryTreeByProjectId(ProjectId);
     DropCategory.DataBind();
 }
Пример #5
0
        /// <summary>
        /// Binds a data source to the invoked server control and all its child controls.
        /// </summary>
        public override void DataBind()
        {
            if(this.DataSource.Count > 0)
            {
                if(!string.IsNullOrEmpty(SortField))
                    _DataSource.Sort(new IssueComparer(SortField, SortAscending));

                gvIssues.Visible=true;

                DisplayColumns();
                gvIssues.DataSource = this.DataSource;
                gvIssues.DataBind();

                SelectColumnsPanel.Visible = true;

                Table tb = (Table)gvIssues.Controls[0];
                TableRow pagerRow = tb.Rows[tb.Rows.Count - 1]; //last row in the table is for bottom pager
                pagerRow.Cells[0].Attributes.Remove("colspan");
                pagerRow.Cells[0].Attributes.Add("colspan",_arrIssueColumns.Length.ToString() + 4);
                lblResults.Visible=false;

                if (ShowProjectColumn)
                {
                    gvIssues.Columns[0].Visible = false;
                    LeftButtonContainerPanel.Visible = false;
                }
                else
                {
                    gvIssues.Columns[4].Visible = false;
                    lstIssueColumns.Items.Remove(lstIssueColumns.Items.FindByValue("4"));

                    int projectId = ((Issue)_DataSource[0]).ProjectId;

                    //hide votes column if issue voting is disabled
                    if (!Project.GetProjectById(projectId).AllowIssueVoting)
                    {
                        gvIssues.Columns[4].Visible = false;
                        lstIssueColumns.Items.Remove(lstIssueColumns.Items.FindByValue("4"));
                    }

                    if (Page.User.Identity.IsAuthenticated
                        && ITUser.HasPermission(projectId, Globals.Permission.EDIT_ISSUE.ToString())
                        )
                    {
                        LeftButtonContainerPanel.Visible = true;
                    }
                    else
                    {
                        //hide selection column for unauthenticated users
                        gvIssues.Columns[0].Visible = false;
                        LeftButtonContainerPanel.Visible = false;
                    }

                    CategoryTree categories = new CategoryTree();
                    dropCategory.DataSource = categories.GetCategoryTreeByProjectId(projectId);
                    dropCategory.DataBind();
                    dropMilestone.DataSource = Milestone.GetMilestoneByProjectId(projectId);
                    dropMilestone.DataBind();
                    dropAffectedMilestone.DataSource = Milestone.GetMilestoneByProjectId(projectId);
                    dropAffectedMilestone.DataBind();
                    dropOwner.DataSource = ITUser.GetUsersByProjectId(projectId);
                    dropOwner.DataBind();
                    dropPriority.DataSource = Priority.GetPrioritiesByProjectId(projectId);
                    dropPriority.DataBind();
                    dropStatus.DataSource = Status.GetStatusByProjectId(projectId);
                    dropStatus.DataBind();
                    dropType.DataSource = IssueType.GetIssueTypesByProjectId(projectId);
                    dropType.DataBind();
                    dropAssigned.DataSource = ITUser.GetUsersByProjectId(projectId);
                    dropAssigned.DataBind();
                    dropResolution.DataSource = Resolution.GetResolutionsByProjectId(projectId);
                    dropResolution.DataBind();
                }

                foreach (string colIndex in _arrIssueColumns)
                {
                    ListItem item = lstIssueColumns.Items.FindByValue(colIndex);
                    if (item != null)
                        item.Selected = true;
                }
            }
            else
            {
                OptionsContainerPanel.Visible = false;
                lblResults.Visible = true;
                gvIssues.Visible = false;
            }
        }
Пример #6
0
        public String[] GetCategories(int ProjectId)
        {
            if (Project.GetProjectById(ProjectId).AccessType == Globals.ProjectAccessType.Private && !Project.IsUserProjectMember(UserName, ProjectId))
               throw new UnauthorizedAccessException(string.Format("The user {0} does not have permission to this project.", UserName)); //TODO: Get this from resource string

               CategoryTree categoriyTree = new CategoryTree();
               List<Category> categories = categoriyTree.GetCategoryTreeByProjectId(ProjectId);
               List<String> returnval = new List<String>();
               foreach (Category item in categories)
               {
               returnval.Add(item.Name.ToString());
               }
               return returnval.ToArray();
        }