コード例 #1
0
 private List<ViewSeason> GetViewSeasonList(int LeagueID)
 {
     List<ViewSeason> vsl = new List<ViewSeason>();
     ViewSeason vs = null;
     List<Season> seasons = BizMgr.GetCurrentSeasonsByLeagueID(LeagueID);
     foreach (Season s in seasons)
     {
         vs = new ViewSeason();
         vs.Description = s.Description;
         vs.EndDate = s.EndDate;
         vs.LeagueID = s.LeagueID;
         vs.SeasonID = s.SeasonID;
         vs.StartDate = s.StartDate;
         vsl.Add(vs);
     }
     return vsl;
 }
コード例 #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);
            }
        }
コード例 #3
0
        private ViewSeason GetSeason(int SeasonID, int LeagueID)
        {
            Season season = BizMgr.GetSeasonBySeasonIDSystemUserID(SeasonID, this.CurrentUser.SystemUserID);
            ViewSeason vs = new ViewSeason();
            vs.Description = season.Description;
            vs.SeasonID = season.SeasonID;
            vs.LeagueID = (season.SeasonID == 0) ? LeagueID : season.LeagueID;
            vs.StartDate = season.StartDate;
            vs.EndDate = season.EndDate;
            vs.AgeClassRuleID = season.AgeClassRuleID;
            vs.AgeClassRuleDescription = season.AgeClassRuleDescription;
            vs.IsAdmin = season.IsAdmin || (season.SeasonID == 0); //set admin = true for new season so they can create it
            vs.AgeClassRuleCustomDate = season.AgeClassRuleCustomDate;
            vs.LeagueName = season.LeagueName;
            vs.AgeClassRules = GetAgeClassRules(season.AgeClassRuleID);

            List<ViewScoringScheme> customScoringSchemes = GetScoringSchemes(SeasonID);
            ViewScoringScheme vx = (ViewScoringScheme)customScoringSchemes.Where(c => c.SwimMeetTypeID == 1).FirstOrDefault();
            if (vx != null)
            {
                vs.ScoringCustomIndividual = vx.IndividualPoints;
                vs.ScoringCustomRelay = vx.RelayPoints;
            }
            vx = (ViewScoringScheme)customScoringSchemes.Where(c => c.SwimMeetTypeID == 3).FirstOrDefault();
            if (vx != null)
            {
                vs.ScoringFinalCustomIndividual = vx.IndividualPoints;
                vs.ScoringFinalCustomRelay = vx.RelayPoints;
            }
            foreach (ViewScoringScheme vss in customScoringSchemes)
            {
                vs.ScoringSchemeIDs.Add(vss.ScoringSchemeID);
            }

            //vs.ScoringUSASchemesHeat = GetScoringSchemes(true, SwimomaticBusinessManager.ScoringEventType.Heat);
            //vs.ScoringUSASchemesFinal = GetScoringSchemes(true, SwimomaticBusinessManager.ScoringEventType.Final);
            //vs.ScoringUSASchemesConsolation = GetScoringSchemes(true, SwimomaticBusinessManager.ScoringEventType.Consolation);
            return vs;
        }
コード例 #4
0
        private ViewSeasons GetSeasons(int LeagueID)
        {
            ViewSeasons vss = new ViewSeasons();
            vss.LeagueID = LeagueID;

            LeagueCollection leagues = BizMgr.GetLeaguesBySystemUserID(this.CurrentUser.SystemUserID);
            var lgs = leagues.Where<League>(l => l.LeagueID == LeagueID && l.IsAdmin);
            vss.IsAdmin = lgs.Count() > 0;

            SeasonCollection seasons = BizMgr.GetSeasonsByLeagueIDSystemUserID(LeagueID, this.CurrentUser.SystemUserID);
            ViewSeason vs;
            foreach (Season season in seasons)
            {
                vs = new ViewSeason();
                vs.LeagueDescription = season.Description;
                vs.LeagueID = season.LeagueID;
                vs.SeasonID = season.SeasonID;
                vs.StartDate = season.StartDate;
                vs.EndDate = season.EndDate;
                vs.LeagueID = season.LeagueID;
                vs.IsAdmin = season.IsAdmin;
                vss.ViewSeasonList.Add(vs);
            }
            return vss;
        }
コード例 #5
0
ファイル: TeamController.cs プロジェクト: kdmerkle/Swimomatic
 private List<ViewSeason> GetTeamSeasons(int TeamID)
 {
     List<ViewSeason> vss = new List<ViewSeason>();
     ViewSeason vs = new ViewSeason();
     SeasonCollection seasons = BizMgr.GetSeasonsByTeamID(TeamID);
     foreach (Season season in seasons)
     {
         vs = new ViewSeason();
         vs.Description = season.Description;
         vs.EndDate = season.EndDate;
         vs.LeagueID = season.LeagueID;
         vs.LeagueName = season.LeagueName;
         vs.LeagueDescription = season.LeagueDescription;
         vs.SeasonID = season.SeasonID;
         vs.StartDate = season.StartDate;
         vs.TeamSeasonID = season.TeamSeasonID;
         vss.Add(vs);
     }
     return vss;
 }