コード例 #1
0
        public void ReportFilterTest()
        {
            var filter = new ReportFilter();

            filter.DepartmentId = Guid.NewGuid();
            filter.FromDate     = DateTime.Now.Date;
            filter.ToDate       = DateTime.Now.Date;
            filter.MilestoneStatuses.Add(MilestoneStatus.Open);
            filter.MilestoneStatuses.Add(MilestoneStatus.Closed);
            filter.ProjectIds.Add(1);
            filter.ProjectIds.Add(3);
            filter.ProjectStatuses.Add(ProjectStatus.Open);
            filter.ProjectStatuses.Add(ProjectStatus.Closed);
            filter.ProjectTag = "tag";
            filter.TaskStatuses.Add(TaskStatus.Open);
            filter.TaskStatuses.Add(TaskStatus.Closed);
            filter.TimeInterval = ReportTimeInterval.Absolute;
            filter.UserId       = Guid.NewGuid();
            filter.ViewType     = 4;

            var xml = filter.ToXml();
            var uri = filter.ToUri();

            AreEquals(filter, ReportFilter.FromXml(xml));
            AreEquals(filter, ReportFilter.FromUri(uri));

            filter.TimeInterval = ReportTimeInterval.CurrMonth;
            xml = filter.ToXml();
            uri = filter.ToUri();
            AreEquals(filter, ReportFilter.FromXml(xml));
            AreEquals(filter, ReportFilter.FromUri(uri));
        }
コード例 #2
0
ファイル: ReportDao.cs プロジェクト: Wifisoft/teamlab.v6.5
        private ReportTemplate ToTemplate(object[] r)
        {
            var tenant   = CoreContext.TenantManager.GetTenant(Convert.ToInt32(r[7]));
            var template = new ReportTemplate((ReportType)Convert.ToInt32(r[1]))
            {
                Id                                             = Convert.ToInt32(r[0]),
                Name                                           = (string)r[2],
                Filter                                         = r[3] != null?ReportFilter.FromXml((string)r[3]) : new ReportFilter(),
                                                 Cron          = (string)r[4],
                                                 CreateBy      = (string)r[5],
                                                 CreateOn      = TenantUtil.DateTimeFromUtc(tenant, (DateTime)r[6]),
                                                 Tenant        = tenant.TenantId,
                                                 AutoGenerated = Convert.ToBoolean(r[8]),
            };

            return(template);
        }