コード例 #1
0
        public static string GetGridUrl(FixFor fixFor, Case parentCase, Status status)
        {
            var url = UserContext.FogBugzUrl + "/default.asp?sView=grid-outline";
            if (fixFor != null)
                url = AddParamToUrl(url, "ixFixFor", fixFor.Index);
            if (parentCase != null)
                url = AddParamToUrl(url, "searchFor", String.Format("parent=\"{0}\"", parentCase.Index));
            if (status != null)
                url = AddParamToUrl(url, "ixStatus", status.Index);

            return url;
        }
コード例 #2
0
        public static IHtmlString FogBugzCasesLink(this HtmlHelper helper, string caption, FogBugzCasesLinkParams parameters, object attributes = null)
        {
            var queryParts = new List<string>();

            var parametersStatus = String.Empty;
            if (parameters.Status.HasValue)
                parametersStatus = parameters.Status.ToString();

            Status status = FogBugzGateway.GetStatuses().FirstOrDefault(s => s.Index == parameters.StatusId || s.Name == parametersStatus);
            if (status == null && !String.IsNullOrEmpty(parametersStatus))
            {
                status = new Status {Name = parametersStatus};
            }

            if (parameters.PersonName == Person.ClosedUser.Name)
            {
                // if closed user
                if (parameters.Status.HasValue && parameters.Status.Value == CaseStatus.Closed || !parameters.Status.HasValue)
                {
                    queryParts.Add(@"Status:""Closed""");
                }
            }
            else
            {
                // if any other user, including no user specified
                if (!string.IsNullOrEmpty(parameters.PersonName)) queryParts.Add(string.Format(@"AssignedTo:""{0}""", parameters.PersonName));

                if (parameters.StatusId.HasValue && status != null || status != null)
                {
                    var statusQuery = String.Format(@"Status:""{0}""", status.Name);
                    queryParts.Add(statusQuery);
                }
                if (status != null && status.Name == "Closed" || parametersStatus == "Closed")
                {
                    queryParts.Add(@"Status:""Closed""");
                }
            }

            if (parameters.HasEstimate.HasValue)
            {
                if (parameters.HasEstimate == true)
                {
                    queryParts.Add(@"EstimateCurrent:""*""");
                }
                else if (parameters.HasEstimate == false)
                {
                    queryParts.Add(@"-EstimateCurrent:""*""");
                }
            }

            if (parameters.PriorityId.HasValue) queryParts.Add(string.Format(@"Priority:""{0}""", parameters.PriorityId.Value));

            if (!String.IsNullOrEmpty(parameters.Tag))
            {
                queryParts.Add(String.Format(@"Tag:""{0}""", parameters.Tag));
            }

            var query = string.Join(" ", queryParts);

            return helper.FogBugzCasesLink(caption, parameters.ProjectId, parameters.MilestoneId, parameters.SubProjectParentCaseId, query, attributes, parameters.HasChildren);
        }