Example #1
0
        public override async Task <AddDomainResponse> AddDomain(AddDomainRequest request, ServerCallContext context)
        {
            var payer = await dbContext.Users.FindIfNullThrowAsync(request.PayUserId);

            var system = await dbContext.Systems.FirstOrDefaultAsync();

            var domain = new DomainEntity(Guid.Parse(request.Id), payer, Resources.Zero, system);
            var userDomainAssignment = new UserDomainAssignment(Guid.Parse(request.PayUserAssignmentId), domain, payer);

            dbContext.Domains.Add(domain);
            dbContext.UserDomainAssignments.Add(userDomainAssignment);

            dbContext.BillingCycleEntries.Add(new BillingCycleEntry(domain.BillingCycleSubject));
            dbContext.UseCycleEntries.Add(new UseCycleEntry(domain.UseCycleSubject));
            dbContext.ManagementFeeEntries.Add(new ManagementFeeEntry(domain.Payer));

            await dbContext.SaveChangesAsync();

            return(new AddDomainResponse {
            });
        }
Example #2
0
        public void InitializeVariables(Domain.Entities.System system)
        {
            nju = new DomainEntity(Guid.NewGuid(), njuadmin, new Domain.ValueObjects.Resources(10, 20, 30), system);
            pku = new DomainEntity(Guid.NewGuid(), fc, new Domain.ValueObjects.Resources(20, 30, 40), system);
            cjd.JoinDomain(nju);
            cjd.JoinDomain(pku);
            lq.JoinDomain(nju);
            njuadmin.JoinDomain(nju);
            fc.JoinDomain(pku);

            lqproject = new Project(Guid.NewGuid(), lq, nju, new Domain.ValueObjects.Resources(5, 10, 20));
            fcproject = new Project(Guid.NewGuid(), fc, pku, new Domain.ValueObjects.Resources(10, 30, 40));

            lq67project  = new UserProjectAssignment(Guid.NewGuid(), lq, lqproject, new Domain.ValueObjects.Resources(4, 8, 10));
            cjd67project = new UserProjectAssignment(Guid.NewGuid(), cjd, lqproject, new Domain.ValueObjects.Resources(1, 2, 10));
            fcfcproject  = new UserProjectAssignment(Guid.NewGuid(), fc, fcproject, new Domain.ValueObjects.Resources(5, 15, 20));

            cjdlqTokenClaims       = new TokenClaims(false, false, cjd.Id, nju.Id, lqproject.Id, cjd67project.Id, UserRole.Member);
            lqlqTokenClaims        = new TokenClaims(false, false, lq.Id, nju.Id, lqproject.Id, lq67project.Id, UserRole.Admin);
            njuadminnjuTokenClaims = new TokenClaims(false, false, njuadmin.Id, nju.Id, null, null, UserRole.Admin);
            fcfcTokenClaims        = new TokenClaims(false, false, fc.Id, pku.Id, fcproject.Id, fcfcproject.Id, UserRole.Admin);
            systemTokenClaims      = new TokenClaims(true, false, SystemUserId, nju.Id, null, null, UserRole.Admin);
        }
Example #3
0
 public void JoinDomain(Domain domain)
 {
     Domains.Add(new UserDomainAssignment(Guid.NewGuid(), domain, this));
 }