-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
389 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/EventCloud.Application/Statistics/IStatisticsAppService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Threading.Tasks; | ||
using Abp.Application.Services; | ||
using Abp.Application.Services.Dto; | ||
|
||
namespace EventCloud.Statistics | ||
{ | ||
public interface IStatisticsAppService : IApplicationService | ||
{ | ||
Task<ListResultOutput<NameValueDto>> GetStatistics(); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/EventCloud.Application/Statistics/StatisticsAppService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Abp.Application.Services.Dto; | ||
using Abp.Domain.Repositories; | ||
using Abp.Domain.Uow; | ||
using EventCloud.Events; | ||
using EventCloud.MultiTenancy; | ||
using EventCloud.Users; | ||
|
||
namespace EventCloud.Statistics | ||
{ | ||
public class StatisticsAppService : EventCloudAppServiceBase, IStatisticsAppService | ||
{ | ||
private readonly IRepository<Tenant> _tenantRepository; | ||
private readonly IRepository<User, long> _userRepository; | ||
private readonly IRepository<Event, Guid> _eventRepository; | ||
private readonly IRepository<EventRegistration> _eventRegistrationRepository; | ||
|
||
public StatisticsAppService( | ||
IRepository<Tenant> tenantRepository, | ||
IRepository<User, long> userRepository, | ||
IRepository<Event, Guid> eventRepository, | ||
IRepository<EventRegistration> eventRegistrationRepository) | ||
{ | ||
_tenantRepository = tenantRepository; | ||
_userRepository = userRepository; | ||
_eventRepository = eventRepository; | ||
_eventRegistrationRepository = eventRegistrationRepository; | ||
} | ||
|
||
public async Task<ListResultOutput<NameValueDto>> GetStatistics() | ||
{ | ||
//Disabled MayHaveTenant filter to access to all tenant's data, not for only current tenant. | ||
using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant)) | ||
{ | ||
var statisticItems = new List<NameValueDto> | ||
{ | ||
new NameValueDto( | ||
"Tenants", | ||
(await _tenantRepository.CountAsync()).ToString() | ||
), | ||
new NameValueDto( | ||
"Users", | ||
(await _userRepository.CountAsync()).ToString() | ||
), | ||
new NameValueDto( | ||
"Events", | ||
(await _eventRepository.CountAsync()).ToString() | ||
), | ||
new NameValueDto( | ||
"Registrations", | ||
(await _eventRegistrationRepository.CountAsync()).ToString() | ||
) | ||
}; | ||
|
||
return new ListResultOutput<NameValueDto>(statisticItems); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ntCloud.EntityFramework/Migrations/201510231926262_UpgradeTo_ModuleZero_0_7_3.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
src/EventCloud.EntityFramework/Migrations/201510231926262_UpgradeTo_ModuleZero_0_7_3.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
namespace EventCloud.Migrations | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data.Entity.Infrastructure.Annotations; | ||
using System.Data.Entity.Migrations; | ||
|
||
public partial class UpgradeTo_ModuleZero_0_7_3 : DbMigration | ||
{ | ||
public override void Up() | ||
{ | ||
CreateTable( | ||
"dbo.AbpFeatures", | ||
c => new | ||
{ | ||
Id = c.Long(nullable: false, identity: true), | ||
Name = c.String(nullable: false, maxLength: 128), | ||
Value = c.String(nullable: false, maxLength: 2000), | ||
CreationTime = c.DateTime(nullable: false), | ||
CreatorUserId = c.Long(), | ||
EditionId = c.Int(), | ||
TenantId = c.Int(), | ||
Discriminator = c.String(nullable: false, maxLength: 128), | ||
}) | ||
.PrimaryKey(t => t.Id) | ||
.ForeignKey("dbo.AbpEditions", t => t.EditionId) | ||
.Index(t => t.EditionId); | ||
|
||
CreateTable( | ||
"dbo.AbpEditions", | ||
c => new | ||
{ | ||
Id = c.Int(nullable: false, identity: true), | ||
Name = c.String(nullable: false, maxLength: 32), | ||
DisplayName = c.String(nullable: false, maxLength: 64), | ||
IsDeleted = c.Boolean(nullable: false), | ||
DeleterUserId = c.Long(), | ||
DeletionTime = c.DateTime(), | ||
LastModificationTime = c.DateTime(), | ||
LastModifierUserId = c.Long(), | ||
CreationTime = c.DateTime(nullable: false), | ||
CreatorUserId = c.Long(), | ||
}, | ||
annotations: new Dictionary<string, object> | ||
{ | ||
{ "DynamicFilter_Edition_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, | ||
}) | ||
.PrimaryKey(t => t.Id); | ||
|
||
AddColumn("dbo.AbpTenants", "EditionId", c => c.Int()); | ||
CreateIndex("dbo.AbpTenants", "EditionId"); | ||
AddForeignKey("dbo.AbpTenants", "EditionId", "dbo.AbpEditions", "Id"); | ||
} | ||
|
||
public override void Down() | ||
{ | ||
DropForeignKey("dbo.AbpTenants", "EditionId", "dbo.AbpEditions"); | ||
DropForeignKey("dbo.AbpFeatures", "EditionId", "dbo.AbpEditions"); | ||
DropIndex("dbo.AbpTenants", new[] { "EditionId" }); | ||
DropIndex("dbo.AbpFeatures", new[] { "EditionId" }); | ||
DropColumn("dbo.AbpTenants", "EditionId"); | ||
DropTable("dbo.AbpEditions", | ||
removedAnnotations: new Dictionary<string, object> | ||
{ | ||
{ "DynamicFilter_Edition_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, | ||
}); | ||
DropTable("dbo.AbpFeatures"); | ||
} | ||
} | ||
} |
Oops, something went wrong.