Exemple #1
0
        // GET: /Liveboard/Team/
        public ActionResult Team(Guid meetId, Guid teamId, string groupId = null, int dayNo = 0, int sortBy = 0)
        {
            using (MARS_Meet_dbEntities meetDb = new MARS_Meet_dbEntities())
            {
                meetDb.Database.Log = s => MyLogger.Log("Team", s);

                mars_MMeet meet = (from mars_Meet in meetDb.mars_MMeet where mars_Meet.MeetId == meetId select mars_Meet).SingleOrDefault();
                if (meet == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                mars_MTeams query = (from team in meetDb.mars_MTeams
                                     where team.MeetId == meetId && team.TeamId == teamId
                                     select team).SingleOrDefault();

                if (query == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                OneMeet oneMeet = createMeet(meet, Selection.OneTeam);
                oneMeet.CurrentGroupId = groupId;
                oneMeet.CurrentDay     = dayNo;
                oneMeet.CurrentSortBy  = sortBy;

                oneMeet.CurrentTeam = new OneTeam()
                {
                    Name         = query.ShortName,
                    Id           = query.TeamId,
                    Participants = new List <DispParticipant>()
                };

                loadEvents(meetDb, oneMeet);
                loadTeam(meetDb, oneMeet);

                return(View(oneMeet));
            }
        }
Exemple #2
0
        private void doBuildResultList(Ovelse ov, List <mars_MTeams> teamList)
        {
            ResultList           = new ResultList();
            ResultList.Ov        = ov;
            ResultList.Heats     = new List <DispHeat>();
            ResultList.NoInSerie = 0;

            if (ov.VertikalSpringOvelse && ov.SpringHojder.Count > 0)
            {
                ResultList.JumpSchema = new List <string>();
                for (int i = 0; i < ov.SpringHojder.Count; i++)
                {
                    ResultList.JumpSchema.Add(ov.SpringHojder[i].ToString());
                }
            }

            foreach (Heat heat in ResultList.Ov.Heats)
            {
                if (heat.Nr == 0)
                {
                    continue;
                }

                DispHeat h = new DispHeat()
                {
                    Participants = new List <DispParticipant>()
                };

                StringBuilder sb = new StringBuilder();
                if (heat.Nr > 0 && StartList.Ov.AntalHeat > 1)
                {
                    sb.AppendFormat("HEAT {0} / {1}", heat.Nr, ResultList.Ov.AntalHeat);
                }

                if (ov.VindPrHeat)
                {
                    if (sb.Length > 0)
                    {
                        sb.Append("  -  ");
                    }
                    sb.AppendFormat("Wind: {0}", heat.Vind);
                }

                h.Header = sb.Length > 0 ? sb.ToString() : "";

                if (heat.Deltagere != null)
                {
                    Array.Sort(heat.Deltagere, (k1, k2) => k1.CompareResultListHeatOrder(k2));

                    foreach (ResDeltager deltager in heat.Deltagere)
                    {
                        DispParticipant d = new DispParticipant();

                        mars_MTeams key = teamList.FirstOrDefault(t => deltager.Klub == t.ShortName);
                        d.TeamId = key != null ? key.TeamId : Guid.Empty;

                        d.OrderNo = deltager.BaneNr.ToString();
                        d.BibNo   = StartList.Ov.StafetOvelse ? "" : deltager.StartNr.ToString();

                        if (StartList.Ov.StafetOvelse)
                        {
                            sb = new StringBuilder();

                            if (deltager.StafetDeltagere != null && deltager.StafetDeltagere.Length > 0)
                            {
                                foreach (var stafetDeltager in deltager.StafetDeltagere)
                                {
                                    if (sb.Length > 0)
                                    {
                                        sb.Append(", ");
                                    }
                                    if (stafetDeltager.Deltager != null)
                                    {
                                        sb.Append(stafetDeltager.Deltager.EfternavnFornavn);
                                    }
                                    else
                                    {
                                        sb.Append(stafetDeltager.StartNr.ToString());
                                    }
                                }
                            }

                            d.Name = sb.ToString();

                            d.YOB  = "";
                            d.Team = deltager.Navn;
                        }
                        else
                        {
                            d.Name = deltager.EfternavnFornavn;
                            d.YOB  = deltager.Aargang;
                            d.Team = deltager.Klub;
                        }

                        d.SB        = deltager.Seedning == "X" ? "" : deltager.Seedning;
                        d.PB        = deltager.Pr == "X" ? "" : deltager.Pr;
                        d.Comment   = deltager.Kommentar;
                        d.Qualified = deltager.QualifiedText;

                        if (deltager.ResKodeText == "")
                        {
                            d.Position = deltager.ResStatus.IsNull() ? deltager.Plac.ToString() : "";
                            d.Result   = deltager.Resultat;
                        }
                        else
                        {
                            d.Position = "";
                            d.Result   = deltager.ResKodeText;
                        }

                        doBuildSerie(ov, deltager, d);

                        h.Participants.Add(d);
                    }
                }

                ResultList.Heats.Add(h);
            }

            if (ov.ResultatSort == "Resultat" && ov.AntalHeat > 1)
            {
                List <ResDeltager> delt = new List <ResDeltager>();
                foreach (Heat heat in ResultList.Ov.Heats)
                {
                    if (heat.Nr != 0)
                    {
                        if (heat.Deltagere != null)
                        {
                            foreach (ResDeltager deltager in heat.Deltagere)
                            {
                                if (deltager.ResKodeText == "" && deltager.ResStatus.IsNull())
                                {
                                    delt.Add(deltager);
                                }
                            }
                        }
                    }
                }

                if (delt.Count > 0)
                {
                    ResultList.Summary       = new List <DispParticipant>();
                    ResultList.SummaryHeader = "SUMMARY";

                    delt.Sort((k1, k2) => k1.CompareResultListPosition(k2));

                    foreach (ResDeltager deltager in delt)
                    {
                        DispParticipant d = new DispParticipant();

                        mars_MTeams key = teamList.FirstOrDefault(t => deltager.Klub == t.ShortName);
                        d.TeamId = key != null ? key.TeamId : Guid.Empty;

                        d.OrderNo = deltager.BaneNr.ToString();
                        d.BibNo   = StartList.Ov.StafetOvelse ? "" : deltager.StartNr.ToString();
                        d.Name    = StartList.Ov.StafetOvelse ? deltager.Navn : deltager.EfternavnFornavn;
                        d.YOB     = StartList.Ov.StafetOvelse ? "" : deltager.Aargang;
                        d.Team    = deltager.Klub;
                        d.SB      = deltager.Seedning == "X" ? "" : deltager.Seedning;
                        d.PB      = deltager.Pr == "X" ? "" : deltager.Pr;
                        d.Comment = deltager.Kommentar;

                        if (deltager.ResKodeText == "")
                        {
                            d.Position = deltager.ResStatus.IsNull() ? deltager.Plac.ToString() : "";
                            d.Result   = deltager.Resultat;
                        }
                        else
                        {
                            d.Position = "";
                            d.Result   = deltager.ResKodeText;
                        }

                        ResultList.Summary.Add(d);
                    }
                }
            }
        }
Exemple #3
0
        public void BuildStartList(List <mars_MTeams> teamList)
        {
            if (Staevne != null && Staevne.Ovelser != null && Staevne.Ovelser.Length == 1)
            {
                Ovelse ov = Staevne.Ovelser[0];
                if (ov.Heats != null)
                {
                    bool seedet = ov.FindesSeedning;

                    StartList       = new StartList();
                    StartList.Ov    = ov;
                    StartList.Heats = new List <DispHeat>();

                    foreach (Heat heat in StartList.Ov.Heats)
                    {
                        DispHeat h = new DispHeat()
                        {
                            Participants = new List <DispParticipant>()
                        };

                        if (heat.Nr > 0 && StartList.Ov.AntalHeat > 1)
                        {
                            h.Header = String.Format("HEAT {0} / {1}", heat.Nr, StartList.Ov.AntalHeat);
                        }
                        else if (heat.Id.IsNotNull() && heat.Id != "0" && StartList.Ov.AntalHeat > 1)
                        {
                            h.Header = String.Format("HEAT {0}", heat.Id);
                        }
                        else if (heat.Nr == 0 && seedet)
                        {
                            h.Header = "SCRATCH";
                        }
                        else
                        {
                            h.Header = "";
                        }

                        if (heat.Deltagere != null)
                        {
                            if (seedet)
                            {
                                Array.Sort(heat.Deltagere, (k1, k2) => k1.CompareStartListOrder(k2));
                            }

                            int orderNo = 0;
                            foreach (ResDeltager deltager in heat.Deltagere)
                            {
                                DispParticipant d = new DispParticipant();

                                mars_MTeams key = teamList.FirstOrDefault(t => deltager.Klub == t.ShortName);
                                d.TeamId = key != null ? key.TeamId : Guid.Empty;

                                orderNo++;

                                d.OrderNo = deltager.BaneNr > 0 ? deltager.BaneNr.ToString() : orderNo.ToString();
                                d.BibNo   = StartList.Ov.StafetOvelse ? "" : deltager.StartNr.ToString();

                                if (StartList.Ov.StafetOvelse)
                                {
                                    StringBuilder sb = new StringBuilder();

                                    if (deltager.StafetDeltagere != null && deltager.StafetDeltagere.Length > 0)
                                    {
                                        foreach (var stafetDeltager in deltager.StafetDeltagere)
                                        {
                                            if (sb.Length > 0)
                                            {
                                                sb.Append(", ");
                                            }
                                            if (stafetDeltager.Deltager != null)
                                            {
                                                sb.Append(stafetDeltager.Deltager.EfternavnFornavn);
                                            }
                                            else
                                            {
                                                sb.Append(stafetDeltager.StartNr.ToString());
                                            }
                                        }
                                    }

                                    d.Name = sb.ToString();

                                    d.YOB  = "";
                                    d.Team = deltager.Navn;
                                }
                                else
                                {
                                    d.Name = deltager.EfternavnFornavn;
                                    d.YOB  = deltager.Aargang;
                                    d.Team = deltager.Klub;
                                }

                                d.SB = deltager.Seedning == "X" ? "" : deltager.Seedning;
                                d.PB = deltager.Pr == "X" ? "" : deltager.Pr;
                                if (!deltager.Startet)
                                {
                                    d.Comment = deltager.ResKodeText;
                                }

                                h.Participants.Add(d);
                            }
                        }

                        StartList.Heats.Add(h);
                    }
                }
            }
        }