コード例 #1
0
 /// <summary>
 /// Saves custom Scoring Schemes.  
 /// All USA Swimming Scoring Schemes will be maintained internally and cannot be changed by the user
 /// If an identical Scoring Scheme exists, a new one won't be created.
 /// </summary>
 /// <param name="IsRelay"></param>
 /// <param name="Points"></param>
 /// <returns></returns>
 public int SaveScoringScheme(ScoringScheme scoringScheme)
 {
     //
     scoringScheme.Description = "Custom: Ind-" + scoringScheme.IndividualPoints + " Rly-" + scoringScheme.RelayPoints;
     scoringScheme.IsUSASwimming = false;
     scoringScheme.LaneCount = 0;
     scoringScheme.ScoringSchemeID = 0; //always use 0 because changes must be saved to a new scoring Scheme record.
     scoringScheme.ScoringEventTypeID = 1; //TODO: use ScoringEventTypeID = 1 until Events can be designated as Heat, Final or Consolation
     return Ctx.ScoringSchemeManager.ScoringSchemeSave(scoringScheme);
 }
コード例 #2
0
        public PartialViewResult SaveSeason(ViewSeason vwSeason)
        {
            Season season = null;
            if (ModelState.IsValid)
            {
                try
                {
                    season = BizMgr.GetSeason(vwSeason.SeasonID);
                    season.AgeClassRuleID = vwSeason.AgeClassRuleID;
                    if (vwSeason.AgeClassRuleID == 1)
                    {
                        season.AgeClassRuleCustomDate = (vwSeason.AgeClassRuleCustomDate.HasValue) ? vwSeason.AgeClassRuleCustomDate.Value : DateTime.MinValue;
                    }
                    else
                    {
                        season.AgeClassRuleCustomDate = DateTime.MinValue;
                    }
                    season.LeagueID = vwSeason.LeagueID;
                    season.Description = vwSeason.Description;
                    season.StartDate = vwSeason.StartDate.Value;
                    season.EndDate = vwSeason.EndDate.Value;
                    season.SeasonID = BizMgr.SaveSeason(season);

                    //SCORING SCHEMES
                    ScoringScheme ss = new ScoringScheme();
                    int scoringSchemeID = 0;
                    SeasonScoringScheme sss = new SeasonScoringScheme();

                    //Dual-Triangle Custom Scoring Scheme
                    ss.IndividualPoints = vwSeason.ScoringCustomIndividual;
                    ss.RelayPoints = vwSeason.ScoringCustomRelay;
                    scoringSchemeID = BizMgr.SaveScoringScheme(ss);

                    sss.SeasonID = season.SeasonID;
                    sss.ScoringSchemeID = scoringSchemeID;
                    sss.SwimMeetTypeID = 1;
                    BizMgr.SaveSeasonScoringScheme(sss);

                    // Invitational-Championship Custom Scoring Scheme
                    ss.IndividualPoints = vwSeason.ScoringFinalCustomIndividual;
                    ss.RelayPoints = vwSeason.ScoringFinalCustomRelay;
                    scoringSchemeID = BizMgr.SaveScoringScheme(ss);

                    sss = new SeasonScoringScheme();
                    sss.SeasonID = season.SeasonID;
                    sss.ScoringSchemeID = scoringSchemeID;
                    sss.SwimMeetTypeID = 3;
                    BizMgr.SaveSeasonScoringScheme(sss);
                    return PartialView("_Season", GetSeason(season.SeasonID, season.LeagueID));
                }
                catch (Exception ex)
                {
                    LogController.LogError(ex, LogEntryType.NormalError, "", "", "", "Season=" + season.SeasonID.ToString());
                    return PartialView("_Season", vwSeason);
                }
            }
            else
            {
                vwSeason.IsAdmin = true;
                vwSeason.AgeClassRules = GetAgeClassRules(vwSeason.AgeClassRuleID);
                return PartialView("_Season", vwSeason);
            }
        }