예제 #1
0
        public MatchSummary(Match match)
        {
            Location = match.Location;
            MatchDate =  match.MatchDate.Value;
            MatchId = match.Id;
            Details = match.Details;

            BoxerName1 = match.Boxers.First().FirstName + " " + match.Boxers.First().LastName;
            BoxerId1 = match.Boxers.First().Id;
            BoxerUrl1 = string.IsNullOrEmpty(match.Boxers.First().Boxrec) ? "" : match.Boxers.First().Boxrec;

            //set up second boxer (or TBA)
            if (match.Boxers.Count() < 2)
            {
                BoxerName2 = "TBA";
                BoxerUrl2 = "";
                BoxerId2 = 0;
            }
            else
            {
                BoxerName2 = match.Boxers.Last().FirstName + " " + match.Boxers.Last().LastName;
                BoxerUrl2 = string.IsNullOrEmpty(match.Boxers.Last().Boxrec) ? "" : match.Boxers.Last().Boxrec;
                BoxerId2 = match.Boxers.Last().Id;
            }

            HasResult = (match.Result != null);
            NeedsResult = ((match.Result != null) && (match.MatchDate < DateTime.Now));
        }
예제 #2
0
 public bool HasPrediction(Match match)
 {
     return CurrentPredictions.Any(p => p.Match.Id == match.Id);
 }
예제 #3
0
 public bool HasConfirmedPrediction(Match match)
 {
     return CurrentPredictions.Any(p => p.Match.Id == match.Id & p.Confirmed == true);
 }
예제 #4
0
 public string GetPredictionSummaryText(Match match)
 {
     return CurrentPredictions.First(x => x.Match.Id == match.Id).ToTextSummary();
 }
예제 #5
0
        public ResultSummaryShort(Match match)
        {
            Match = match;
            ResultText = match.Result.ResultText();
            MatchDate = match.MatchDate.Value.ordinalDateMonth();

            //get prospect
            Boxer Prospect;
            if (match.Boxers.First().IsProspect)
            {
                Prospect = match.Boxers.First();
                ProspectName = Prospect.FullName();
                ProspectUrl = Prospect.Boxrec;
            }
            else
            {
                Prospect = match.Boxers.Last();
                ProspectName = Prospect.FullName();
                ProspectUrl = Prospect.Boxrec;
            }

            //set opponent
            var Opponent = match.Boxers.Where(x => x != Prospect).Single();
            OpponentName = Opponent.FullName();
            OpponentUrl = string.IsNullOrEmpty(Opponent.Boxrec) ? "" : Opponent.Boxrec;
        }
예제 #6
0
        public ResultSummary(Match match)
        {
            Match = match;
            MatchDate = match.MatchDate.Value.ToLongDateString();

            Location = match.Location;

            if (match.Result.ResultType.HasWinner == true)
            {
                Result = match.Result.ResultType.Type;
                string Loser = "";

                if (match.Result.ResultType.HasRounds == true) Result += match.Result.Round;
                if (match.Boxers.Count == 2)
                {
                    Loser = match.Boxers.Where(x => x.Id != match.Result.Winner.Id).Single().FullName();
                }
                else
                {
                    Loser = "TBA";
                }

                MatchResult = match.Result.Winner.FullName() + " - " + Result + " vs " + Loser;

                WinnerBoxer = match.Result.Winner;
                if (match.Boxers.First() == match.Result.Winner)
                {
                    LoserBoxer = match.Boxers.Last();

                }
                else
                {
                    LoserBoxer = match.Boxers.First();
                }

            }
            else
            {
                MatchResult = match.Result.ResultType.Type + "-" + match.Boxers.First().FullName() + " vs " + match.Boxers.Last().FullName();
                Result = match.Result.ResultType.Type;

                WinnerBoxer = match.Boxers.First();
                LoserBoxer = match.Boxers.Last();
            }
        }
예제 #7
0
        public ActionResult CreateMatches(int[] BoxerA_Id, int[] BoxerB_Id, string[] matchdate, int[] matchlength, string[] details)
        {
            var repositoryBoxer = GetRepository<Boxer>();
            var repositoryMatch = GetRepository<Match>();
            int count = BoxerA_Id.Count();

            for (var i = 0; i < count; i++)
            {
                try
                {
                    if (BoxerA_Id[i] > 0 || BoxerA_Id[i] > 0)
                    {

                        Match CreateMatch = new Match();
                        //Add the two boxers

                        if (BoxerA_Id[i] > 0) CreateMatch.Boxers.Add(repositoryBoxer.Get(BoxerA_Id[i]));
                        if (BoxerB_Id[i] > 0) CreateMatch.Boxers.Add(repositoryBoxer.Get(BoxerB_Id[i]));

                        CreateMatch.Live = true;
                        CreateMatch.Rounds = matchlength[i];
                        CreateMatch.MatchDate = DateTime.Parse(matchdate[i]);
                        CreateMatch.Details = details[i];

                        repositoryMatch.Add(CreateMatch);
                    }
                }
                catch
                {

                }
            }
            //add matches like below method!
            return Redirect("/ben");
        }
예제 #8
0
        public ActionResult CreateMatch(int[] prospect, string[] opponent, string[] matchdate, string[] location, int[] matchlength)
        {
            var repositoryBoxer = GetRepository<Boxer>();
            var repositoryMatch = GetRepository<Match>();
            int count = prospect.Count();

            for (var i = 0; i < count; i++)
            {
                Match CreateMatch = new Match();

                var GetProspect = repositoryBoxer.Get(prospect[i]);
                CreateMatch.Boxers.Add(GetProspect);

                //if not opponent then its a TBA match!!!
                if (opponent[i] != string.Empty)
                {
                    Boxer GetOrCreateOpponent = repositoryBoxer.Query().GetByFullName(opponent[i]);

                    if (GetOrCreateOpponent == null)
                    {
                        GetOrCreateOpponent = new Boxer();
                        //build new boxer
                        string[] getname = opponent[i].Split('-');
                        GetOrCreateOpponent.FirstName = getname[0];
                        GetOrCreateOpponent.LastName = getname[1];
                        GetOrCreateOpponent.Weight = GetProspect.Weight;
                        repositoryBoxer.Add(GetOrCreateOpponent);
                    }

                    CreateMatch.Boxers.Add(GetOrCreateOpponent);
                }

                CreateMatch.Rounds = matchlength[i];
                CreateMatch.Location = location[i];
                CreateMatch.MatchDate = DateTime.Parse(matchdate[i]);

                repositoryMatch.Add(CreateMatch);
            }

            return Redirect("/ben");
        }
예제 #9
0
파일: Week.cs 프로젝트: elmo61/BritBoxing
 public virtual void AddMatch(Match match)
 {
     Matches.Add(match);
 }