public async Task RequestPlayersNewRegistration(List <int> playerIds, int teamId, string domainUrl) { var team = await this.teamRepository.FindByIdAsync(teamId); var season = await this.seasonRepository.FindByDate(DateTime.Today); var reservationNumber = await ReservationNumberFactory.Create(this.reservationNumberRepository); var branchNumber = 1; foreach (var playerId in playerIds) { var player = await this.playerRepository.FindByIdAsync(playerId); var requestPlayer = new RequestPlayer( playerId, teamId, season.Id, reservationNumber, branchNumber, player.Category, RequestType.NewRegistration, ApproveState.Unapproved, DateTime.Now, season.GetPlayerRegistrationFee(), null); await this.requestPlayerRepository.UpdateAsync(requestPlayer); branchNumber++; } await this.SendRequestPlayersNewRegistrationMail(team.RepresentativeEmailAddress, domainUrl); }
public async Task AddRequestTransferPlayers(List <int> transferPlayerIds, int teamId) { var team = await this.teamRepository.FindByIdAsync(teamId); var season = await this.seasonRepository.FindByDate(DateTime.Today); var reservationNumber = await ReservationNumberFactory.Create(this.reservationNumberRepository); var branchNumber = 1; var players = await this.playerRepository.FindAllByIdsAsync(transferPlayerIds); var requestPlayers = await this.requestPlayerRepository.FindAllByPlayerIdsAndSeasonId(transferPlayerIds, season.Id); foreach (var player in players) { var isRegisteredThisSeason = requestPlayers.Any(o => o.PlayerId == player.Id && o.SeasonId == season.Id); var requestPlayer = new RequestPlayer( player.Id, teamId, season.Id, reservationNumber, branchNumber, player.Category, RequestType.TransferRegistration, ApproveState.Unapproved, DateTime.Now, season.GetPlayerTradeFee(isRegisteredThisSeason), null); await this.requestPlayerRepository.AddAsync(requestPlayer); branchNumber++; } await this.SendRequestPlayersTransferMail(team.RepresentativeEmailAddress); }
public async Task AddRequestPlayers(List <AddRequestPlayersDto> dtos, int teamId) { var team = await this.teamRepository.FindByIdAsync(teamId); var season = await this.seasonRepository.FindByDate(DateTime.Today); var reservationNumber = await ReservationNumberFactory.Create(this.reservationNumberRepository); var branchNumber = 1; foreach (var dto in dtos) { var requestPlayer = new RequestPlayer( dto.PlayerId, teamId, season.Id, reservationNumber, branchNumber, Enumeration.FromValue <Category>(dto.CategoryId), RequestType.ContinuedRegistration, ApproveState.Unapproved, DateTime.Now, season.GetPlayerRegistrationFee(), null); await this.requestPlayerRepository.AddAsync(requestPlayer); branchNumber++; } await this.SendRequestPlayersContinuedRegistrationMail(team.RepresentativeEmailAddress); }
public void 登録選手情報を設定() { var now = DateTime.Now; var act = new RequestPlayer( playerId: 1, teamId: 1, seasonId: 1, reservationNumber: new ReservationNumber(), reservationBranchNumber: 1, category: Category.Under11Or12, requestType: RequestType.NewRegistration, approveState: ApproveState.Unapproved, now, new PlayerRegistrationFee(500), null ); Assert.Equal(1, act.PlayerId); Assert.Equal(1, act.TeamId); Assert.Equal(1, act.SeasonId); Assert.Equal(new ReservationNumber(), act.ReservationNumber); Assert.Equal(Category.Under11Or12, act.Category); Assert.Equal(RequestType.NewRegistration, act.RequestType); Assert.Equal(ApproveState.Unapproved, act.ApproveState); Assert.Equal(now, act.RequestedDateTime); Assert.Equal(500, act.PlayerRegistrationFee.Value); Assert.Null(act.ApproveDateTime); }
/// <summary> /// 登録選手からviewModelの新しいインスタンスを生成します。 /// </summary public RequestStateDisplayViewModel(RequestPlayer requestplayer) { this.ReservationNumber = requestplayer.ReservationNumber.Value; this.RequestTypeName = requestplayer.RequestType.Name; this.RequestedDateTime = $"{requestplayer.RequestedDateTime:yyyy/M/d HH:mm}"; this.ApproveStateName = requestplayer.ApproveState == ApproveState.Approved ? ApproveState.Approved.Name : "申請中"; this.PlayerName = new PlayerName(requestplayer.Player.PlayerFamilyName, requestplayer.Player.PlayerFirstName).Value; this.PlayerNameKana = new PlayerNameKana(requestplayer.Player.PlayerFamilyNameKana, requestplayer.Player.PlayerFirstNameKana).Value; this.CategoryName = requestplayer.Category.Name; this.GenderName = requestplayer.Player.Gender.Name; this.BirthDate = requestplayer.Player.BirthDate.DisplayValue; }
public void 登録選手情報を取消にする() { var act = new RequestPlayer( playerId: 1, teamId: 1, seasonId: 1, reservationNumber: new ReservationNumber(), reservationBranchNumber: 1, category: Category.Under11Or12, requestType: RequestType.NewRegistration, approveState: ApproveState.Approved, DateTime.Now, new PlayerRegistrationFee(500), null ); act.Unapprove(); Assert.Equal(ApproveState.Unapproved, act.ApproveState); }
private void requestPlayerToolStripMenuItem_Click(object sender, EventArgs e) { RequestPlayer requestPlayerForm = new RequestPlayer(); requestPlayerForm.Show(); }
public Player(RequestPlayer obj) : this() { Name = obj.Name; SteamID = obj.SteamID; }