示例#1
0
        public List <TransitBug> GetBugsWithOptions(string ticket, TransitBugQueryOptions qopt, ServiceQueryOptions options)
        {
            string query = null;

            using (SnCore.Data.Hibernate.Session.OpenConnection())
            {
                ISession session = SnCore.Data.Hibernate.Session.Current;
                query = qopt.GetQuery(session);
            }

            return(WebServiceImpl <TransitBug, ManagedBug, Bug> .GetList(
                       ticket, options, query, "Bug"));
        }
 TransitBugQueryOptions GetQueryOptions()
 {
     TransitBugQueryOptions qo = new TransitBugQueryOptions();
     qo.ProjectId = RequestId;
     qo.SortDirection =
         (gridManage.SortDirection == PagedGridSortDirection.Ascending)
             ? TransitSortDirection.Ascending
             : TransitSortDirection.Descending;
     qo.SortExpression = gridManage.SortExpression;
     qo.Resolved = checkboxResolvedBugs.Checked;
     qo.Open = checkboxOpenedBugs.Checked;
     qo.Closed = checkboxClosedBugs.Checked;
     qo.SearchQuery = inputSearch.Text;
     return qo;
 }
    TransitBugQueryOptions GetQueryOptions()
    {
        TransitBugQueryOptions qo = new TransitBugQueryOptions();

        qo.ProjectId     = RequestId;
        qo.SortDirection =
            (gridManage.SortDirection == PagedGridSortDirection.Ascending)
                ? TransitSortDirection.Ascending
                : TransitSortDirection.Descending;
        qo.SortExpression = gridManage.SortExpression;
        qo.Resolved       = checkboxResolvedBugs.Checked;
        qo.Open           = checkboxOpenedBugs.Checked;
        qo.Closed         = checkboxClosedBugs.Checked;
        qo.SearchQuery    = inputSearch.Text;
        return(qo);
    }
示例#4
0
 public int GetBugsWithOptionsCount(string ticket, TransitBugQueryOptions qopt)
 {
     return(GetBugsWithOptions(ticket, qopt, null).Count);
 }
示例#5
0
        public List<TransitBug> GetBugsWithOptions(string ticket, TransitBugQueryOptions qopt, ServiceQueryOptions options)
        {
            string query = null;
            using (SnCore.Data.Hibernate.Session.OpenConnection())
            {
                ISession session = SnCore.Data.Hibernate.Session.Current;
                query = qopt.GetQuery(session);
            }

            return WebServiceImpl<TransitBug, ManagedBug, Bug>.GetList(
                ticket, options, query, "Bug");
        }
示例#6
0
 public int GetBugsWithOptionsCount(string ticket, TransitBugQueryOptions qopt)
 {
     return GetBugsWithOptions(ticket, qopt, null).Count;
 }
示例#7
0
        public void SearchBugs()
        {
            ManagedBugPriority   priority   = new ManagedBugPriority(Session);
            ManagedBugProject    project    = new ManagedBugProject(Session);
            ManagedBugResolution resolution = new ManagedBugResolution(Session);
            ManagedBugSeverity   severity   = new ManagedBugSeverity(Session);
            ManagedBugStatus     status     = new ManagedBugStatus(Session);
            ManagedBugType       type       = new ManagedBugType(Session);
            ManagedBug           bug        = new ManagedBug(Session);

            try
            {
                TransitBugPriority t_priority = new TransitBugPriority();
                t_priority.Name = GetNewString();
                priority.CreateOrUpdate(t_priority, AdminSecurityContext);

                TransitBugProject t_project = new TransitBugProject();
                t_project.Name = GetNewString();
                project.CreateOrUpdate(t_project, AdminSecurityContext);

                TransitBugResolution t_resolution = new TransitBugResolution();
                t_resolution.Name = GetNewString();
                resolution.CreateOrUpdate(t_resolution, AdminSecurityContext);

                TransitBugSeverity t_severity = new TransitBugSeverity();
                t_severity.Name = GetNewString();
                severity.CreateOrUpdate(t_severity, AdminSecurityContext);

                TransitBugStatus t_status = new TransitBugStatus();
                t_status.Name = GetNewString();
                status.CreateOrUpdate(t_status, AdminSecurityContext);

                TransitBugType t_type = new TransitBugType();
                t_type.Name = GetNewString();
                type.CreateOrUpdate(t_type, AdminSecurityContext);

                TransitBug t_bug = new TransitBug();
                t_bug.Priority   = t_priority.Name;
                t_bug.ProjectId  = project.Id;
                t_bug.Resolution = t_resolution.Name;
                t_bug.Severity   = t_severity.Name;
                t_bug.Status     = t_status.Name;
                t_bug.Subject    = "subject";
                t_bug.Type       = t_type.Name;
                t_bug.Details    = "details";
                bug.CreateOrUpdate(t_bug, AdminSecurityContext);

                {
                    TransitBugQueryOptions qo = new TransitBugQueryOptions();
                    IQuery query = Session.CreateSQLQuery(qo.GetQuery(Session)).AddEntity("Bug", typeof(Bug));
                    IList  list  = query.List();
                    Assert.AreEqual(0, list.Count, "Wrong count on query w/o a project.");
                }

                //{
                //    TransitBugQueryOptions qo = new TransitBugQueryOptions();
                //    qo.ProjectId = project.Id;
                //    IQuery query = qo.GetQuery(Session);
                //    IList list = query.List();
                //    Assert.AreEqual(1, list.Count, "Wrong count on query with a project id.");
                //}

                //{
                //    TransitBugQueryOptions qo = new TransitBugQueryOptions();
                //    qo.ProjectId = project.Id;
                //    qo.SearchQuery = GetNewString();
                //    IQuery query = qo.GetQuery(Session);
                //    IList list = query.List();
                //    Assert.AreEqual(0, list.Count, "Wrong count on query with an unmatched query string.");
                //}

                //{
                //    TransitBugQueryOptions qo = new TransitBugQueryOptions();
                //    qo.ProjectId = project.Id;
                //    qo.SearchQuery = "subject";
                //    IQuery query = qo.GetQuery(Session);
                //    IList list = query.List();
                //    Assert.AreEqual(1, list.Count, "Wrong count on query with a matched subject query string.");
                //}

                //{
                //    TransitBugQueryOptions qo = new TransitBugQueryOptions();
                //    qo.ProjectId = project.Id;
                //    qo.SearchQuery = "details";
                //    IQuery query = qo.GetQuery(Session);
                //    IList list = query.List();
                //    Assert.AreEqual(1, list.Count, "Wrong count on query with a matched details query string.");
                //}
            }
            finally
            {
                bug.Delete(AdminSecurityContext);
                priority.Delete(AdminSecurityContext);
                resolution.Delete(AdminSecurityContext);
                severity.Delete(AdminSecurityContext);
                status.Delete(AdminSecurityContext);
                type.Delete(AdminSecurityContext);
                project.Delete(AdminSecurityContext);
            }
        }