protected void SaveAndGoToNextStep() { using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { targetCompetitionEntry = proxy.Save(targetCompetitionEntry).ResultValue.ConvertTo <msCompetitionEntry>(); // clear cached info as certain info may change targetCompetition.ClearCompetitionEntryInformation(); if (MultiStepWizards.EnterCompetition.EntryFee != null) { GoToOrderForm(); return; } // send out the confirmation proxy.SendTransactionalEmail( targetCompetition.ConfirmationEmail ?? EmailTemplates.Awards.CompetitionEntrySubmissionConfirmation, targetCompetitionEntry.ID, null); } QueueBannerMessage(string.Format("Competition Entry #{0} was created successfully.", targetCompetitionEntry.LocalID)); GoHome(); }
/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { base.InitializeTargetObject(); targetCompetitionEntry = LoadObjectFromAPI <msCompetitionEntry>(ContextID); if (targetCompetitionEntry == null) { GoToMissingRecordPage(); return; } targetCompetition = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition); if (targetCompetition == null) { GoToMissingRecordPage(); return; } targetEntryStatus = LoadObjectFromAPI <msCompetitionEntryStatus>(targetCompetitionEntry.Status); using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { Search s = new Search(msCustomField.CLASS_NAME); s.AddCriteria(Expr.Equals(msCustomField.FIELDS.Competition, targetCompetition.ID)); targetCompetitionQuestions = proxy.GetObjectsBySearch(s, null, 0, null). ResultValue.Objects.ConvertTo <msCustomField>(); } }
/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { base.InitializeTargetObject(); targetCompetitionEntry = LoadObjectFromAPI <msCompetitionEntry>(ContextID); targetJudgingRound = LoadObjectFromAPI <msJudgingRound>(JudgingRoundId); if (targetCompetitionEntry == null) { GoToMissingRecordPage(); return; } targetCompetition = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition); if (targetCompetition == null) { GoToMissingRecordPage(); return; } targetEntrant = LoadObjectFromAPI <msIndividual>(targetCompetitionEntry.Entrant); if (targetEntrant == null) { GoToMissingRecordPage(); return; } }
/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { base.InitializeTargetObject(); targetCompetitionEntry = LoadObjectFromAPI <msCompetitionEntry>(ContextID); targetJudgingRound = LoadObjectFromAPI <msJudgingRound>(JudgingRoundId); if (targetCompetitionEntry == null || targetJudgingRound == null) { GoToMissingRecordPage(); return; } targetCompetition = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition); if (targetCompetition == null) { GoToMissingRecordPage(); return; } targetEntrant = LoadObjectFromAPI <msIndividual>(targetCompetitionEntry.Entrant); if (targetEntrant == null) { GoToMissingRecordPage(); return; } //Search for an existing score card for this judge/competition entry/round and if not found create a new one Search sScoreCard = new Search { Type = msScoreCard.CLASS_NAME, Context = targetCompetitionEntry.ID }; sScoreCard.AddOutputColumn("ID"); sScoreCard.AddCriteria(Expr.Equals("Judge", ConciergeAPI.CurrentEntity.ID)); sScoreCard.AddCriteria(Expr.Equals("Entry", targetCompetitionEntry.ID)); sScoreCard.AddCriteria(Expr.Equals("Round", targetJudgingRound.ID)); SearchResult srScoreCard = APIExtensions.GetSearchResult(sScoreCard, 0, 1); targetScoreCard = srScoreCard.Table != null && srScoreCard.Table.Rows.Count > 0 ? LoadObjectFromAPI <msScoreCard>(srScoreCard.Table.Rows[0]["ID"].ToString()) : new msScoreCard { Entry = targetCompetitionEntry.ID, Judge = ConciergeAPI.CurrentEntity.ID, Round = targetJudgingRound.ID, Scores = new List <msScoreCardScore>(), Name = string.Format("{0} Scores for {1} {2} Round", targetCompetition.Name, targetEntrant.Name, targetJudgingRound.Name) }; }
protected void btnSaveAsDraft_Click(object sender, EventArgs e) { unbind(); targetCompetitionEntry.Status = targetCompetitionInfo.DraftStatusId; using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { targetCompetitionEntry = proxy.Save(targetCompetitionEntry).ResultValue.ConvertTo <msCompetitionEntry>(); // clear cached info as certain info may change targetCompetition.ClearCompetitionEntryInformation(); } QueueBannerMessage(string.Format("Competition Entry #{0} was successfully saved as a draft.", targetCompetitionEntry.LocalID)); GoHome(); }
/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { base.InitializeTargetObject(); var contextObject = APIExtensions.LoadObjectFromAPI(ContextID); switch (contextObject.ClassType) { case "CompetitionEntry": targetCompetitionEntry = contextObject.ConvertTo <msCompetitionEntry>(); targetCompetition = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition); targetCompetitionInfo = targetCompetition.GetCompetitionEntryInformation(); MultiStepWizards.EnterCompetition.EntryFee = LoadObjectFromAPI <msCompetitionEntryFee>(targetCompetitionEntry.EntryFee); break; case "Competition": targetCompetition = contextObject.ConvertTo <msCompetition>(); targetCompetitionInfo = targetCompetition.GetCompetitionEntryInformation(); targetCompetitionEntry = new msCompetitionEntry { Competition = targetCompetition.ID, Entrant = ConciergeAPI.CurrentEntity.ID, Status = targetCompetitionInfo.PendingPaymentStatusId }; // If the fee is null make sure it is allowed to be. If a session expires in the middle of the form, the user will be // redirected here without the proper Fee in session state. if (MultiStepWizards.EnterCompetition.EntryFee == null && targetCompetitionInfo.CompetitionEntryFees.Count > 0) { if (targetCompetitionInfo.CompetitionEntryFees.Count > 1) { Response.Redirect("~/competitions/ApplyToCompetition.aspx?contextID=" + ContextID); } MultiStepWizards.EnterCompetition.EntryFee = LoadObjectFromAPI <msCompetitionEntryFee>(targetCompetitionInfo.CompetitionEntryFees[0].ProductID); } break; default: QueueBannerError("Unknown context object supplied."); GoHome(); return; } if (targetCompetition == null || targetCompetitionEntry == null || targetCompetitionInfo == null) { GoToMissingRecordPage(); return; } using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { var s = new Search(msCustomField.CLASS_NAME); s.AddCriteria(Expr.Equals(msCustomField.FIELDS.Competition, targetCompetition.ID)); targetCompetitionQuestions = proxy.GetObjectsBySearch(s, null, 0, null). ResultValue.Objects.ConvertTo <msCustomField>(); // sort the competition questions - MS-2648 targetCompetitionQuestions.Sort((x, y) => x.DisplayOrder.CompareTo(y.DisplayOrder)); } }