Esempio n. 1
0
        /// <summary>
        /// Gets the name of the tab.
        /// </summary>
        /// <param name="tabName"></param>
        /// <param name="tabValue"></param>
        /// <returns></returns>
        private string GetTabName(string tabName, string tabValue)
        {
            switch (tabValue.ToLower())
            {
            case "tabcomments":
                return(string.Format("{0} ({1})", tabName, IssueId == 0 ? 0 : IssueCommentManager.GetByIssueId(IssueId).Count));

            case "tabhistory":
                return(string.Format("{0} ({1})", tabName, IssueId == 0 ? 0 : IssueHistoryManager.GetByIssueId(IssueId).Count));

            case "tabattachments":
                return(string.Format("{0} ({1})", tabName, IssueId == 0 ? 0 : IssueAttachmentManager.GetByIssueId(IssueId).Count));

            case "tabnotifications":
                return(string.Format("{0} ({1})", tabName, IssueId == 0 ? 0 : IssueNotificationManager.GetByIssueId(IssueId).Count));

            case "tabrelatedissues":
                return(string.Format("{0} ({1})", tabName, IssueId == 0 ? 0 : RelatedIssueManager.GetRelatedIssues(IssueId).Count));

            case "tabparentissues":
                return(string.Format("{0} ({1})", tabName, IssueId == 0 ? 0 : RelatedIssueManager.GetParentIssues(IssueId).Count));

            case "tabsubissues":
                return(string.Format("{0} ({1})", tabName, IssueId == 0 ? 0 : RelatedIssueManager.GetChildIssues(IssueId).Count));

            case "tabrevisions":
                return(string.Format("{0} ({1})", tabName, IssueId == 0 ? 0 : IssueRevisionManager.GetByIssueId(IssueId).Count));

            case "tabtimetracking":
                return(string.Format("{0} ({1})", tabName, IssueId == 0 ? 0 : IssueWorkReportManager.GetByIssueId(IssueId).Count));

            default:
                return(tabName);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the name of the tab.
        /// </summary>
        /// <param name="tabName"></param>
        /// <param name="tabValue"></param>
        /// <returns></returns>
        private string GetTabName(string tabName, string tabValue)
        {
            int cnt;

            switch (tabValue.ToLower())
            {
            case "tabcomments":
                cnt = IssueId == 0 ? 0 : IssueCommentManager.GetByIssueId(IssueId).Count;
                return(string.Format("<span class='{2}'>{0} ({1})</span>", tabName, cnt, cnt == 0 ? "normal" : "bold"));

            case "tabhistory":
                cnt = IssueId == 0 ? 0 : IssueHistoryManager.GetByIssueId(IssueId).Count;
                return(string.Format("<span class='{2}'>{0} ({1})</span>", tabName, cnt, cnt == 0 ? "normal" : "normal"));

            case "tabattachments":
                cnt = IssueId == 0 ? 0 : IssueAttachmentManager.GetByIssueId(IssueId).Count;
                return(string.Format("<span class='{2}'>{0} ({1})</span>", tabName, cnt, cnt == 0 ? "normal" : "bold"));

            case "tabnotifications":
                cnt = IssueId == 0 ? 0 : IssueNotificationManager.GetByIssueId(IssueId).Count;
                return(string.Format("<span class='{2}'>{0} ({1})</span>", tabName, cnt, cnt == 0 ? "normal" : "normal"));

            case "tabrelatedissues":
                cnt = IssueId == 0 ? 0 : RelatedIssueManager.GetRelatedIssues(IssueId).Count;
                return(string.Format("<span class='{2}'>{0} ({1})</span>", tabName, cnt, cnt == 0 ? "normal" : "bold"));

            case "tabparentissues":
                cnt = IssueId == 0 ? 0 : RelatedIssueManager.GetParentIssues(IssueId).Count;
                return(string.Format("<span class='{2}'>{0} ({1})</span>", tabName, cnt, cnt == 0 ? "normal" : "bold"));

            case "tabsubissues":
                cnt = IssueId == 0 ? 0 : RelatedIssueManager.GetChildIssues(IssueId).Count;
                return(string.Format("<span class='{2}'>{0} ({1})</span>", tabName, cnt, cnt == 0 ? "normal" : "bold"));

            case "tabrevisions":
                cnt = IssueId == 0 ? 0 : IssueRevisionManager.GetByIssueId(IssueId).Count;
                return(string.Format("<span class='{2}'>{0} ({1})</span>", tabName, cnt, cnt == 0 ? "normal" : "normal"));

            case "tabtimetracking":
                cnt = IssueId == 0 ? 0 : IssueWorkReportManager.GetByIssueId(IssueId).Count;
                return(string.Format("<span class='{2}'>{0} ({1})</span>", tabName, cnt, cnt == 0 ? "normal" : "normal"));

            default:
                return(tabName);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the Click event of the cmdUpdate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected void CmdAddRelatedIssueClick(object sender, EventArgs e)
        {
            if (IssueIdTextBox.Text == String.Empty)
            {
                return;
            }

            if (!Page.IsValid)
            {
                return;
            }

            RelatedIssuesMessage.Visible = false;

            var issueId = Utilities.ParseFullIssueId(IssueIdTextBox.Text.Trim());

            if (issueId <= Globals.NEW_ID)
            {
                return;
            }

            RelatedIssueManager.CreateNewRelatedIssue(IssueId, issueId);

            IssueIdTextBox.Text = String.Empty;

            var history = new IssueHistory
            {
                IssueId                 = IssueId,
                CreatedUserName         = Security.GetUserName(),
                DateChanged             = DateTime.Now,
                FieldChanged            = ResourceStrings.GetGlobalResource(GlobalResources.SharedResources, "RelatedIssue", "Related Issue"),
                OldValue                = string.Empty,
                NewValue                = ResourceStrings.GetGlobalResource(GlobalResources.SharedResources, "Added", "Added"),
                TriggerLastUpdateChange = true
            };

            IssueHistoryManager.SaveOrUpdate(history);

            var changes = new List <IssueHistory> {
                history
            };

            IssueNotificationManager.SendIssueNotifications(IssueId, changes);

            BindRelated();
        }
Esempio n. 4
0
        /// <summary>
        /// Binds the related.
        /// </summary>
        private void BindRelated()
        {
            var issues = RelatedIssueManager.GetParentIssues(IssueId);

            if (issues.Count == 0)
            {
                NoIssuesLabel.Text     = GetLocalResourceObject("NoParentIssues").ToString();
                NoIssuesLabel.Visible  = true;
                IssuesDataGrid.Visible = false;
            }
            else
            {
                IssuesDataGrid.DataSource   = issues;
                IssuesDataGrid.DataKeyField = "IssueId";
                IssuesDataGrid.DataBind();
                NoIssuesLabel.Visible  = false;
                IssuesDataGrid.Visible = true;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Binds the related.
        /// </summary>
        private void BindRelated()
        {
            var issues = RelatedIssueManager.GetChildIssues(IssueId);

            if (issues.Count == 0)
            {
                NoIssuesLabel.Text    = GetLocalResourceObject("NoSubIssues").ToString();
                NoIssuesLabel.Visible = true;
                grdIssues.Visible     = false;
            }
            else
            {
                grdIssues.DataSource   = issues;
                grdIssues.DataKeyField = "IssueId";
                grdIssues.DataBind();
                NoIssuesLabel.Visible = false;
                grdIssues.Visible     = true;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// GRDs the bugs item command.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param>
        protected void GrdBugsItemCommand(Object s, DataGridCommandEventArgs e)
        {
            var commandArgument = e.CommandArgument.ToString();
            var commandName     = e.CommandName.ToLower().Trim();
            var currentIssueId  = Globals.NEW_ID;

            switch (commandName)
            {
            case "delete":
                currentIssueId = int.Parse(commandArgument);
                RelatedIssueManager.DeleteParentIssue(IssueId, currentIssueId);
                break;
            }

            if (currentIssueId > Globals.NEW_ID)
            {
                var history = new IssueHistory
                {
                    IssueId                 = IssueId,
                    CreatedUserName         = Security.GetUserName(),
                    DateChanged             = DateTime.Now,
                    FieldChanged            = ResourceStrings.GetGlobalResource(GlobalResources.SharedResources, "ParentIssue", "Parent Issue"),
                    OldValue                = string.Empty,
                    NewValue                = ResourceStrings.GetGlobalResource(GlobalResources.SharedResources, "Deleted", "Deleted"),
                    TriggerLastUpdateChange = true
                };

                IssueHistoryManager.SaveOrUpdate(history);

                var changes = new List <IssueHistory> {
                    history
                };

                IssueNotificationManager.SendIssueNotifications(IssueId, changes);
            }

            BindRelated();
        }