コード例 #1
0
 public async Task <bool> SaveGroupUser(IUser tEntity, long userId)
 {
     if (tEntity.RoleId == 1)
     {
         foreach (var user in tEntity.GroupUsers)
         {
             IGroupUser groupUser = user;
             groupUser.UserId  = userId;
             groupUser.GroupId = user.Id;
             var savedUser = await this._groupUserRepository.AddNew(user);
         }
     }
     return(true);
 }
コード例 #2
0
        public async Task <IGroupUser> AddNew(IGroupUser entity)
        {
            try
            {
                this.StartTransaction();
                var savedEntity = await base.AddNew(entity as TGroupUser);

                this.CommitTransaction();

                return(savedEntity);
            }
            catch (PostgresException ex)
            {
                throw new EntityUpdateException(ex);
            }
            catch
            {
                throw;
            }
        }
コード例 #3
0
        public async Task WarnUser(IGroupUser user)
        {
            var userAccount = UserAccounts.getAccount((SocketUser)user);

            userAccount.NumberOfWarnings++;
            UserAccounts.SaveAccounts();

            //punishiment check
            if (userAccount.NumberOfWarnings >= 3)
            {
                //await user.Guild.AddBanAsync(user, 5);
            }
            else if (userAccount.NumberOfWarnings >= 2)
            {
                await Context.Channel.SendMessageAsync("You received more than 2 warning! If you recive more than 3 warnings you could be banned!");
            }
            else if (userAccount.NumberOfWarnings >= 1)
            {
                await Context.Channel.SendMessageAsync("You received your first warning! If you recive more than 3 warnings you could be banned!");
            }
        }
コード例 #4
0
 public GroupUserEvent(IGroupUser iGroupUser)
 {
     _IGroupUser = iGroupUser;
 }
コード例 #5
0
 public GroupUserController(IGroupUser repo, IGroup groupRepository)
 {
     repository = repo;
     groupRepo  = groupRepository;
 }
コード例 #6
0
 public GroupController(IGroup groupRepository, IEvent eventRepository, IGroupUser groupUser)
 {
     repository = groupRepository;
     eventRepo  = eventRepository;
     guRepo     = groupUser;
 }
コード例 #7
0
 public DbGroupRepo(GatheringDbContext context, IConfiguration configuration, IGroupUser groupUserRepo)
 {
     _context      = context;
     Configuration = configuration;
     guRepo        = groupUserRepo;
 }