public ActionResult Page01Post() { if (this.CurrentRegistrationState != RegistrationState.Available) { return(this.RedirectToAction(this.CurrentRegistrationState.ToString())); } Page01ViewData viewData = new Page01ViewData(); this.SetBaseViewData(viewData); try { TournamentRegistration newRegistration = new TournamentRegistration { TimeRegistrationStarted = DateTime.Now, TeamRegistrationFee = viewData.TeamRegistrationFee, UserAgent = this.Request.UserAgent }; // TODO: else case: Send an e-mail reporting database failure; could not create the record this.Repository.AddTournamentRegistration(newRegistration); return(this.RedirectToAction("Page02", new { id = newRegistration.TeamID })); } catch (Exception exception) { ErrorSignal.FromCurrentContext().Raise(exception); // TODO: Replace with Error Message return(this.RedirectToAction("Index", "Home")); } }
public ActionResult Page08(int id, Page08ViewData page08ViewData) { if (this.CurrentRegistrationState != RegistrationState.Available) { return(this.RedirectToAction(this.CurrentRegistrationState.ToString())); } try { TournamentRegistration newRegistrationData = new TournamentRegistration { SchedulingIssues = page08ViewData.SchedulingIssues, SpecialConsiderations = page08ViewData.SpecialConsiderations }; // TODO: Send an e-mail reporting database failure; could not find the record already added to the database. this.Repository.UpdateTournamentRegistration(id, 8, newRegistrationData); return(this.RedirectToAction("Page09", new { id })); } catch (Exception exception) { ErrorSignal.FromCurrentContext().Raise(exception); // TODO: Replace with Error Message return(this.RedirectToAction("Index", "Home")); } }
public TournamentRegistrationModel(ClubDbContext context, IApi api, Services.IMailService mailService, ILogger <TournamentRegistrationModel> logger) { _clubDbContext = context; _api = api; _mailService = mailService; _logger = logger; TournamentPage = new TournamentPage(); Registration = new TournamentRegistration(); }
public ActionResult Page04(int?id, Page04ViewData page04ViewData) { // If the user navigated to this page without a record number as parameter, // redirect him/her to a generic error page. // if (id == null) // TODO: Does HasValue work correctly? - Rob, 12/10/2014 if (!id.HasValue) { return(this.RedirectToAction("Error")); } if (this.CurrentRegistrationState != RegistrationState.Available) { return(this.RedirectToAction(this.CurrentRegistrationState.ToString())); } try { this.SetBaseViewData(page04ViewData); this.UpdateModel(page04ViewData); page04ViewData.VolunteerFound = this.Repository.GetVolunteerByIdAndName( int.Parse(page04ViewData.VolunteerId), page04ViewData.VolunteerFirstName, page04ViewData.VolunteerLastName); if (page04ViewData.VolunteerFound == null) { page04ViewData.NoVolunteersFound = true; return(this.View(page04ViewData)); } // Make sure the volunteer found is not already assigned to a team. if (page04ViewData.VolunteerFound.TeamID.HasValue) { page04ViewData.VolunteerAlreadyTaken = true; return(this.View(page04ViewData)); } TournamentRegistration newRegistrationData = new TournamentRegistration { VolunteerID = page04ViewData.VolunteerFound.VolunteerID }; // TODO: Send an e-mail reporting database failure; could not find the record already added to the database. this.Repository.UpdateTournamentRegistration(id.Value, 4, newRegistrationData); return(this.RedirectToAction("Page05", new { id })); } catch (Exception exception) { ErrorSignal.FromCurrentContext().Raise(exception); return(this.RedirectToAction("Error")); } }
public ActionResult Page07(int id, Page07ViewData page07ViewData) { if (this.CurrentRegistrationState != RegistrationState.Available) { return(this.RedirectToAction(this.CurrentRegistrationState.ToString())); } try { TournamentRegistration newRegistrationData = new TournamentRegistration { Division = page07ViewData.DivisionRadioGroup ?? page07ViewData.DivisionOfTeam.ToString(CultureInfo.InvariantCulture) }; // TODO: Get rid of all these labels, Rob - 12/10/2014 string divisionRadioGroup = page07ViewData.DivisionRadioGroup; if (divisionRadioGroup == null) { goto Label_00C9; } if (divisionRadioGroup != "0") { if (divisionRadioGroup == "1") { goto Label_00B0; } goto Label_00C9; } // Only record Spontaneous if the team is competing in the Primary Division newRegistrationData.ProblemID = 6; newRegistrationData.Spontaneous = page07ViewData.IsDoingSpontaneous == "Yes"; goto Label_00E2; Label_00B0: newRegistrationData.ProblemID = int.Parse(page07ViewData.Division123ProblemChoice); goto Label_00E2; Label_00C9: newRegistrationData.ProblemID = int.Parse(page07ViewData.SelectedProblem); Label_00E2: this.Repository.UpdateTournamentRegistration(id, 7, newRegistrationData); return(this.RedirectToAction("Page08", new { id })); } catch (Exception exception) { ErrorSignal.FromCurrentContext().Raise(exception); // TODO: Replace with Error Message return(this.RedirectToAction("Index", "Home")); } }
public ActionResult Page06(int id, Page06ViewData page06ViewData) { if (this.CurrentRegistrationState != RegistrationState.Available) { return(this.RedirectToAction(this.CurrentRegistrationState.ToString())); } try { // Retrieve the data entered on the page this.UpdateModel(page06ViewData); // Copy drop-down list values into TournamentRegistration object in the viewData to pass to the // repository. TournamentRegistration newRegistrationData = new TournamentRegistration { MemberFirstName1 = page06ViewData.MemberFirstName1, MemberLastName1 = page06ViewData.MemberLastName1, MemberGrade1 = page06ViewData.MemberGrade1, MemberFirstName2 = page06ViewData.MemberFirstName2, MemberLastName2 = page06ViewData.MemberLastName2, MemberGrade2 = page06ViewData.MemberGrade2, MemberFirstName3 = page06ViewData.MemberFirstName3, MemberLastName3 = page06ViewData.MemberLastName3, MemberGrade3 = page06ViewData.MemberGrade3, MemberFirstName4 = page06ViewData.MemberFirstName4, MemberLastName4 = page06ViewData.MemberLastName4, MemberGrade4 = page06ViewData.MemberGrade4, MemberFirstName5 = page06ViewData.MemberFirstName5, MemberLastName5 = page06ViewData.MemberLastName5, MemberGrade5 = page06ViewData.MemberGrade5, MemberFirstName6 = page06ViewData.MemberFirstName6, MemberLastName6 = page06ViewData.MemberLastName6, MemberGrade6 = page06ViewData.MemberGrade6, MemberFirstName7 = page06ViewData.MemberFirstName7, MemberLastName7 = page06ViewData.MemberLastName7, MemberGrade7 = page06ViewData.MemberGrade7 }; // TODO: Send an e-mail reporting database failure; could not find the record already added to the database. this.Repository.UpdateTournamentRegistration(id, 6, newRegistrationData); return(this.RedirectToAction("Page07", new { id })); } catch (Exception exception) { ErrorSignal.FromCurrentContext().Raise(exception); // TODO: Replace with Error Message return(this.RedirectToAction("Index", "Home")); } }
public ActionResult Page03(int id, Page03ViewData page03ViewData) { if (this.CurrentRegistrationState != RegistrationState.Available) { return(this.RedirectToAction(this.CurrentRegistrationState.ToString())); } try { this.SetBaseViewData(page03ViewData); this.UpdateModel(page03ViewData); page03ViewData.ListOfJudgesFound = this.Repository.GetJudgeByIdAndName( int.Parse(page03ViewData.JudgeId), page03ViewData.JudgeFirstName, page03ViewData.JudgeLastName); if (!page03ViewData.ListOfJudgesFound.Any()) { page03ViewData.NoJudgesFound = true; return(this.View(page03ViewData)); } // Make sure any judge found is not already assigned to a team. if ((page03ViewData.ListOfJudgesFound.First() != null) && (page03ViewData.ListOfJudgesFound.First().TeamID != null)) { page03ViewData.JudgeAlreadyTaken = true; return(this.View(page03ViewData)); } TournamentRegistration newRegistrationData = new TournamentRegistration { JudgeID = short.Parse(page03ViewData.JudgeId) }; // TODO: Send an e-mail reporting database failure; could not find the record already added to the database this.Repository.UpdateTournamentRegistration(id, 3, newRegistrationData); return(this.RedirectToAction("Page05", new { id })); } catch (Exception exception) { ErrorSignal.FromCurrentContext().Raise(exception); // TODO: Replace with Error Message return(this.RedirectToAction("Index", "Home")); } }
public async Task <ActionResult <ApiResult <string> > > PostNewRegistration(TournamentRegistrationVM p) { TournamentRegistration r = new TournamentRegistration { TournamentID = p.TournamentID, PlayerID = p.PlayerID, PaidAmount = p.PaidAmount, Division = p.Division, }; _context.TournamentRegistrations.Add(r); _context.SaveChanges(); return(new ApiResult <string> { IsValid = true, Result = "Player '" + r.PlayerID + "' was successfully registered!" }); }
public ActionResult Page05(int id, Page05ViewData page05ViewData) { if (this.CurrentRegistrationState != RegistrationState.Available) { return(this.RedirectToAction(this.CurrentRegistrationState.ToString())); } try { this.UpdateModel(page05ViewData); this.SetBaseViewData(page05ViewData); // Instantiate a new instance of MailMessage to test the legitimacy of the coach e-mail address entered. if (this.BuildMessage( page05ViewData.Config["WebmasterEmail"], "test", "test", page05ViewData.CoachEmailAddress, null, null) == null) { return(this.RedirectToAction("BadCoachEmail")); } // Instantiate a new instance of MailMessage to test the legitimacy of the alternate coach e-mail address entered. if (this.BuildMessage( page05ViewData.Config["WebmasterEmail"], "test", "test", page05ViewData.AltCoachEmailAddress, null, null) == null) { return(this.RedirectToAction("BadAltCoachEmail")); } TournamentRegistration newRegistrationData = new TournamentRegistration { CoachFirstName = page05ViewData.CoachFirstName, CoachLastName = page05ViewData.CoachLastName, CoachAddress = page05ViewData.CoachAddress, CoachCity = page05ViewData.CoachCity, CoachState = page05ViewData.CoachState, CoachZipCode = page05ViewData.CoachZipCode, CoachEveningPhone = page05ViewData.CoachEveningPhone, CoachDaytimePhone = page05ViewData.CoachDaytimePhone, CoachMobilePhone = page05ViewData.CoachMobilePhone, CoachEmailAddress = page05ViewData.CoachEmailAddress, AltCoachFirstName = page05ViewData.AltCoachFirstName, AltCoachLastName = page05ViewData.AltCoachLastName, AltCoachEveningPhone = page05ViewData.AltCoachEveningPhone, AltCoachDaytimePhone = page05ViewData.AltCoachDaytimePhone, AltCoachMobilePhone = page05ViewData.AltCoachMobilePhone, AltCoachEmailAddress = page05ViewData.AltCoachEmailAddress }; // TODO: Send an e-mail reporting database failure; could not find the record already added to the database this.Repository.UpdateTournamentRegistration(id, 5, newRegistrationData); return(this.RedirectToAction("Page06", new { id })); } catch (Exception exception) { ErrorSignal.FromCurrentContext().Raise(exception); // TODO: Replace with Error Message return(this.RedirectToAction("Index", "Home")); } }
/// <summary> /// A simple function that takes a string and does a ToUpper /// </summary> /// <param name="register">Les infos d'inscriptions au tournoi</param> /// <param name="context"></param> /// <returns></returns> public TournamentRegistration FunctionHandler(AwsPostRequest <RegisterEvent> request, ILambdaContext context) { var register = request.body; var userUid = request.context.userId; using var client = new AmazonDynamoDBClient(Amazon.RegionEndpoint.EUWest1); Table deckListTable = Table.LoadTable(client, Constantes.TableName); var batchWrite = deckListTable.CreateBatchWrite(); QueryRequest req = new QueryRequest { TableName = Constantes.TableName, IndexName = Constantes.TableIndex.REGISTER_CODE, KeyConditionExpression = $"{Constantes.DynamoCol.REGISTER_CODE} = :v_registerCode", ExpressionAttributeValues = new Dictionary <string, AttributeValue> { { ":v_registerCode", new AttributeValue { S = register.RegisterCode } } } }; Task <QueryResponse> search = client.QueryAsync(req); search.Wait(); //TODO : Et si aucun résultat ??? ou plus d'un ???? var tournamentDoc = search.Result.Items.First(); var tournamentRegistration = new TournamentRegistration { EventId = tournamentDoc[Constantes.DynamoCol.EVENT_ID].S, EventName = tournamentDoc[Constantes.DynamoCol.EVENT_NAME].S, TournamentId = tournamentDoc[Constantes.DynamoCol.TOURNAMENT_ID].S, TournamentName = tournamentDoc[Constantes.DynamoCol.TOURNAMENT_NAME].S, TournamentFormat = tournamentDoc[Constantes.DynamoCol.FORMAT].S, UserId = userUid }; var registration = new Document { [Constantes.DynamoCol.PK] = $"{Constantes.DynamoKey.USER}{userUid}", [Constantes.DynamoCol.SK] = $"{Constantes.DynamoKey.REGISTER}{tournamentRegistration.EventId}#{Constantes.DynamoKey.TOURNAMENT}{tournamentRegistration.TournamentId}", [Constantes.DynamoCol.EVENT_ID] = $"{tournamentRegistration.EventId}", [Constantes.DynamoCol.TOURNAMENT_ID] = $"{tournamentRegistration.TournamentId}", [Constantes.DynamoCol.USER_ID] = userUid, }; var registrationTask = deckListTable.UpdateItemAsync(registration); registrationTask.Wait(); context.Logger.LogLine("Registration complete."); var headersDic = new Dictionary <string, string> { { "Content-type", "application/json" } }; return(tournamentRegistration); //return new APIGatewayProxyResponse() //{ // StatusCode = 201, // Headers = headersDic, // // return the image in Base64 encoding // Body = JsonConvert.SerializeObject(tournamentRegistration) //Convert.ToBase64String(reader.ReadBytes(Convert.ToInt32(responseStream.Length))), //}; }