public static bool IsResolved(Case arg)
        {
            Status status = FogBugzGateway.GetStatuses().FirstOrDefault(s => s.Index == arg.IndexStatus);

            if (status == null) return false;

            return status.Resolved && arg.IsOpen && !IsResolvedVerified(arg);
        }
        /*public static bool IsResolvedNotVerified(Case arg)
        {
            Status status = FogBugzUtils.GetStatuses().First(s => s.Index == arg.IndexStatus);
            return ResolvedNotVerifiedRegex.IsMatch(status.Name) && arg.IsOpen;
        }*/
        public static bool IsResolvedVerified(Case arg)
        {
            //Status status = FogBugzGateway.GetStatuses().First(s => s.Index == arg.IndexStatus);

            bool isResolvedVerified = FbAccountContext.Current.Settings.ResolvedVerifiedStatusId == arg.IndexStatus;

            return isResolvedVerified && arg.IsOpen;
        }
        /*private static readonly Regex ResolvedNotVerifiedRegex = new Regex(
            @"^Resolved(?!\s*\(Verified)",
            RegexOptions.Singleline | RegexOptions.Compiled);*/
        public static bool IsActive(Case arg)
        {
            Status status = FogBugzGateway.GetStatuses().FirstOrDefault(s => s.Index == arg.IndexStatus);

            if (status == null) return false;

            return !status.WorkDone && !status.Resolved && !status.Deleted && !status.Duplicate;
        }
        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;
        }
        private decimal CalcEstimateForCase(Case cs, bool currentEstimate = false)
        {
            decimal result = 0;

            var ratio = (decimal)FbAccountContext.Current.Settings.QaPercentage / 100;

            if (currentEstimate)
            {
                if (FbAccountContext.Current.Settings.AllowQaEstimates)
                    result = ((decimal)cs.TestEstimate.GetValueOrDefault(0)) / 60m; // "Test Estimate" field value is in minutee
                else
                    result = cs.HoursCurrentEstimate.GetValueOrDefault(0) * ratio;
            }
            else if (FbAccountContext.Current.Settings.AllowQaEstimates)
            {
                result = ((decimal)cs.TestEstimate.GetValueOrDefault(0))/60m; // "Test Estimate" field value is in minutes
            }
            else
            {
                result = cs.HoursElapsed.GetValueOrDefault(0) * ratio;
            }

            return result;
        }
 public static string GetCaseQueryPart(Case caseItem)
 {
     string searchQuery = null;
     searchQuery = String.Format("case:\"={0}\"", caseItem.Index);
     return searchQuery;
 }
 public static bool IsClosed(Case arg)
 {
     return !arg.IsOpen;
 }
 public static bool HasNoChildren(Case arg)
 {
     return (arg.IndexBugChildren == null || arg.IndexBugChildren.Count() == 0);
 }
        public Case BuildCase(Person assignedTo, int originalEstimate, int elapsed, DateTime? resolvedDate, int id)
        {
            var task = new Case() { IndexPersonAssignedTo = assignedTo.Index, IsOpen = true, Index = id, HoursOriginalEstimate = originalEstimate, HoursElapsed = elapsed, DateResolved = resolvedDate };

            if (resolvedDate.HasValue) task.IndexPersonResolvedBy = assignedTo.Index;

            return task;
        }