/// <summary>
		/// We receive the slug value as a kind of cross-cutting value that 
		/// all methods need and use, so we catch and load the conference here, 
		/// so it's available for all. Each method doesn't need the slug parameter.
		/// </summary>
		protected override void OnActionExecuting(ActionExecutingContext filterContext)
		{
			var slug = (string)this.ControllerContext.RequestContext.RouteData.Values["slug"];
			if (!string.IsNullOrEmpty(slug))
			{
				this.ViewBag.Slug = slug;
				this.Contest = this.Service.FindContest(slug);

				if (this.Contest != null)
				{
					// check access
					var accessCode = (string)this.ControllerContext.RequestContext.RouteData.Values["accessCode"];

					if (accessCode == null || !string.Equals(accessCode, this.Contest.AccessCode, StringComparison.Ordinal))
					{
						filterContext.Result = new HttpUnauthorizedResult("Invalid access code.");
					}
					else
					{
						this.ViewBag.OwnerName = this.Contest.OwnerName;
						this.ViewBag.WasEverPublished = this.Contest.WasEverPublished;
					}
				}
			}

			base.OnActionExecuting(filterContext);
		}
示例#2
0
    public void ConfigureSlot(bool isActive, ContestInfo contestInfo)
    {
        this.gameObject.SetActive(isActive);

        if (isActive)
        {
            Contest            = contestInfo;
            ContestTitle.text  = contestInfo.contestTitle;
            ContestLogo.sprite = contestInfo.contestLogo;

            StartDate = Backend.Utility.ConvertTimestampToDatetime(contestInfo.contestStartDate);
        }
    }
示例#3
0
    protected void AdminSubmit_Click(object sender, EventArgs e)
    {
        string name = con_name.Text; string text = con_text.Text; string ruletext = Server.HtmlEncode(con_rule.Text.Replace(Environment.NewLine, "<br />"));
        int    price, validmonth;

        Int32.TryParse(con_price.Text, out price);
        Int32.TryParse(con_valdation.Text, out validmonth);
        DateTime dt;

        DateTime.TryParse(con_startdate.Text, out dt);
        ContestHelper.addContest(name, text, price, validmonth, ruletext, dt.ToString());
        // Response.Write(name+text+ price+ validmonth+ ruletext+ dt.ToString());
        cont_info = ContestHelper.getCotestInfo();
    }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ContestInfo = await _context.ContestInfo.FirstOrDefaultAsync(m => m.Id == id);

            if (ContestInfo == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#5
0
        public void AddContestInfo()
        {
            DateTime    endDate     = new DateTime(2018, 03, 05);
            ContestInfo contestInto = new ContestInfo("Bra simhoppstävling", "Örebro", DateTime.Now, endDate, "Gustavsvik");

            Database database = new Database();

            try
            {
                database.PushContestInfo(contestInto);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message.ToString());
            }
        }
示例#6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        txt_result.Visible = false;
        chkerror.Visible   = false;

        cont_info = ContestHelper.getCotestInfo();
        if (!IsPostBack)
        {
            con_name.Text      = Server.HtmlDecode(cont_info.Name); con_text.Text = Server.HtmlDecode(cont_info.Text);
            con_price.Text     = cont_info.Price.ToString();
            con_rule.Text      = Server.HtmlDecode(cont_info.RuleText).Replace("<br />", Environment.NewLine);
            con_valdation.Text = cont_info.ValidMonth.ToString();
            DateTime dt = DateTime.Parse(cont_info.StartDate);
            con_startdate.Text = dt.ToString("yyyy/MM/dd");
        }
    }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ContestInfo = await _context.ContestInfo.FindAsync(id);

            if (ContestInfo != null)
            {
                _context.ContestInfo.Remove(ContestInfo);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
示例#8
0
 public SelectSongManager(ContestInfo contestInfo, WebSongInformation[] activeScores, ListInfo[] listInfos)
 {
     this.contestInfo  = contestInfo;
     this.activeScores = activeScores;
     this.listInfos    = listInfos;
     Filter            = new SongSelectFilter();
     songSelect        = new SelectInfo();
     logicSelect       = new SelectInfo();
     contestSelect     = new SelectInfo();
     activeScoreSelect = new SelectInfo();
     listInfoSelect    = new SelectInfo();
     GenerateSelectContests();
     GenerateSelectActiveScores();
     GenerateSelectLists();
     SongInformation.Updated += SongInformation_Updated;
     LogicFolderInfomation.StaticAfterAdd          += LogicFolderInfomation_StaticAfterAdd;
     LogicFolderInfomation.StaticBeforeRemove      += LogicFolderInfomation_StaticBeforeRemove;
     LogicFolderInfomation.StaticBeforeChangeIndex += LogicFolderInfomation_StaticBeforeChangeIndex;
 }
示例#9
0
        public Contest Load(string fileName)
        {
            if (!isolatedStore.FileExists(fileName))
            {
                return(null);
            }
            using (var reader = isolatedStore.OpenFile(fileName))
            {
                var contestInfo = new ContestInfo()
                {
                    IsoStoreFileName = fileName
                };
                var contest = new Contest(contestInfo);
                var doc     = XDocument.Load(reader);
                foreach (var trackNode in doc.Element("Contest").Element("Tracks").Elements("Track"))
                {
                    var track = CreateTrackFromNode(trackNode);
                    contest.Tracks.Add(track);
                }

                var contestElement = doc.Element("Contest");
                if (contestElement != null)
                {
                    var loadUrlElement = doc.Element("TrackListUrl");
                    if (loadUrlElement != null)
                    {
                        contestInfo.TrackListUrl = loadUrlElement.Value;
                    }

                    var nameElement = doc.Element("Name");
                    if (nameElement != null)
                    {
                        contestInfo.Name = nameElement.Value;
                    }
                }
                return(contest);
            }
        }
示例#10
0
        private IEnumerable <ContestInfo> ParseContestInfosFromTable(IElement tbody)
        {
            foreach (var row in tbody.GetElementsByTagName("tr"))
            {
                var res = new ContestInfo();

                var tds         = row.GetElementsByTagName("td");
                var dateTimeStr = tds[0].FirstElementChild.GetAttribute("href").Split('?')[1].Substring(4, 13);
                res.StartTime = DateTime.ParseExact(dateTimeStr, "yyyyMMddTHHmm", null).AddHours(-9);

                var contestAnchor = tds[1].GetElementsByTagName("a")[0];
                res.ContestName       = contestAnchor.TextContent;
                res.ContestScreenName = contestAnchor.GetAttribute("href").Split('/').Last();

                var durationHourAndMin = tds[2].TextContent.Split(':');
                res.Duration = new TimeSpan(int.Parse(durationHourAndMin[0]), int.Parse(durationHourAndMin[1]), 0);

                var ratedRange = tds[3].TextContent;
                res.RatedRange = RatingRange.Parse(ratedRange);

                yield return(res);
            }
        }
示例#11
0
 public EventContestSelected(ContestInfo selectedContest)
 {
     contest = selectedContest;
 }
示例#12
0
 public ContestLoader(ContestInfo contestInfo, IIsolatedStore isoStore)
 {
     this.contestInfo = contestInfo;
     this.isoLoader   = new IsolatedStoreContestLoader(contestInfo.IsoStoreFileName, isoStore);
     this.kvrLoader   = new KvrTrackListLoader(contestInfo.TrackListUrl);
 }
示例#13
0
    public static void GetContestInfoFromGameSparks(System.Action callbackOnComplete)
    {
        new GameSparks.Api.Requests.LogEventRequest()
        .SetEventKey("getContests")
        .SetEventAttribute("contestId", "")
        .Send((response) =>
        {
            if (!response.HasErrors)
            {
                Logging.Log("Received ContestInfos from GameSparks: " + response.JSONString.ToString());

                if (response.BaseData != null)
                {
                    GameSparks.Core.GSData data = response.ScriptData;
                    if (data != null)
                    {
                        List <GameSparks.Core.GSData> dataList = data.GetGSDataList("fantasyContests");
                        if (dataList != null)
                        {
                            int i = 0;
                            foreach (var obj in dataList)
                            {
                                ContestInfo info      = new ContestInfo();
                                info.contestID        = obj.GetString("contestId");
                                info.contestTitle     = obj.GetString("name");
                                info.contestStartDate = obj.GetString("startdate") + " " + obj.GetString("starttime");

                                // Grab the corresponding logo image for this contest
                                System.Action <Texture2D> imageReceived = delegate(Texture2D image)
                                {
                                    i++;
                                    info.contestLogo = Sprite.Create(image, new Rect(0.0f, 0.0f, image.width, image.height), new Vector2(0.5f, 0.5f), 100.0f);
                                    ContestsView.CurrentContests[info.contestID] = info;

                                    if (i == dataList.Count)
                                    {
                                        if (callbackOnComplete != null)
                                        {
                                            callbackOnComplete();
                                        }
                                    }
                                };

                                FantasyManager.Instance.DownloadAnImage(obj.GetString("logoShortCode"), imageReceived);
                                // Populate the contest with teams list
                                string teamsCSV = obj.GetString("teamNames");
                                if (teamsCSV != null)
                                {
                                    Logging.Log("Teams: " + teamsCSV);
                                    string[] teamsSplit = teamsCSV.Split(',');
                                    if (teamsSplit.Length > 0)
                                    {
                                        info.Teams = FantasyManager.Instance.GetFantasyTeamListByNames(teamsSplit);
                                    }
                                }
                                else
                                {
                                    Logging.LogError("No teams found for contest: " + info.contestID);
                                }
                            }
                        }
                        else
                        {
                            Logging.LogError("Couldn't get FantasyContests GSData");
                        }
                    }
                    else
                    {
                        Logging.LogError("FantasyContests ScriptData is NULL");
                    }
                }
                else
                {
                    Logging.LogError("response Base Data = null");
                }
            }
        });
    }
示例#14
0
    public override void Initialize(object[] optionalParams)
    {
        base.Initialize(optionalParams);


        if (optionalParams == null)
        {
            Logging.LogError("Tried to initialize LineupView with optional params but the array was null!");
            return;
        }

        // Try to get a contest from the optional parameters (should never be null)
        contest = (ContestInfo)optionalParams[0];

        if (contest != null)
        {
            ContestName.text = contest.contestTitle;

            int i = 0;

            // Configure the player choices (on the lineup popup) based on the teams in the contest and hte players on those teams
            foreach (var team in contest.Teams)
            {
                foreach (var player in team.Players)
                {
                    FantasyPlayerChoices[i].gameObject.SetActive(true);

                    FantasyPlayerChoices[i].Configure(player);
                    player.OptionSlot = i;

                    FantasyPlayer fPlayer = player; // Avoid Boxing
                    FantasyPlayerChoices[i].AddButton.onClick.RemoveAllListeners();
                    FantasyPlayerChoices[i].AddButton.onClick.AddListener(() => AddFantasyPlayerToEntry(fPlayer));

                    FantasyPlayersSlot slot = FantasyPlayerChoices[i]; // Boxing
                    FantasyPlayerChoices[i].AddButton.onClick.AddListener(() => slot.gameObject.SetActive(false));

                    i++;
                }
            }

            // Turn off the remaining unused choices
            for (; i < FantasyPlayerChoices.Count; i++)
            {
                FantasyPlayerChoices[i].gameObject.SetActive(false);
            }


            for (int index = 0; index < FantasyPlayerChoices.Count; index++)
            {
                FantasyPlayerChoices[index].transform.SetSiblingIndex(index);
            }

            // Configure the current lineup slots with default parameters, including an empty name
            for (int j = 0; j < CurrentLineupSlots.Count; j++)
            {
                CurrentLineupSlots[j].Configure(EMPTY, string.Empty, string.Empty, string.Empty, null);
            }

            CurrentContestEntry.SlotPlayer1.Name = EMPTY;
            CurrentContestEntry.SlotPlayer2.Name = EMPTY;
            CurrentContestEntry.SlotPlayer3.Name = EMPTY;
            CurrentContestEntry.SlotPlayer4.Name = EMPTY;
            CurrentContestEntry.SlotTeam1        = EMPTY;
            CurrentContestEntry.CurrentSalary    = 0;
            currentTotalFPPG = 0;
            fullSlots        = 0;

            RemainingSalaryText.text  = "$" + (baseSalary - CurrentContestEntry.CurrentSalary).ToString();
            AvgFantasyPointsText.text = "0.00";

            SubmitButton.interactable = false;
        }
    }
示例#15
0
文件: Menu.cs 项目: KHCmaster/PPD
        public override bool Load()
        {
            WebManager.Instance.UpdateAccountInfo();
            //init
            var         list             = SongInformation.All;
            int         selectnum        = 0;
            string      initialdirectory = PPDSetting.Setting.SongDir;
            ContestInfo contestInfo      = null;

            WebSongInformation[] activeScores = null;
            ListInfo[]           lists        = null;
            Action[]             actions      =
            {
                () => { contestInfo  = WebManager.Instance.GetContestInfo(); },
                () => { activeScores = WebManager.Instance.GetScores(true);  },
                () => { lists        = WebManager.Instance.GetListInfos();   },
                PerfectTrialCache.Instance.Update
            };
            Parallel.ForEach(actions, (action) => action());
            // 前のメニューからのパラメーターを調べる
            if (PreviousParam.TryGetValue("PPDGameUtility", out object temp))
            {
                var gameutility = temp as PPDGameUtility;
                initialdirectory = gameutility.SongInformation.ParentDirectory;
            }
            ssm                   = new SelectSongManager(contestInfo, activeScores, lists);
            ssm.SongChanged      += ssm_SongChanged;
            ssm.DirectoryChanged += ssm_DirectoryChanged;
            ssm.ModeChanged      += ssm_ModeChanged;
            ssm.Filter.Desc       = SkinSetting.Setting.Desc;
            ssm.Filter.Difficulty = SkinSetting.Setting.Difficulty;
            ssm.Filter.Field      = SkinSetting.Setting.SortField;
            ssm.Filter.Type       = SkinSetting.Setting.ScoreType;
            textBox               = new DxTextBox(device, GameHost, ResourceManager);
            mss                   = new MenuSelectSong(device, ResourceManager, this);
            mss.Inputed          += mss_Inputed;
            mss.GotFocused       += mss_GotFocused;
            sic                   = new SongInfoControl(device, ResourceManager);
            sic.Inputed          += sic_Inputed;
            cc                 = new ConfirmControl(device, ResourceManager);
            cc.Inputed        += cc_Inputed;
            oc                 = new OptionControl(device, ResourceManager, Sound);
            lm                 = new LeftMenu(device, GameHost, ResourceManager, textBox, ssm, Sound);
            lm.RandomSelected += lm_RandomSelected;
            lm.FilterChanged  += lm_FilterChanged;
            ss                 = new ScoreSearcher(device, ResourceManager, textBox, ssm.Filter);
            obd                = new OpenBrowserDialog(device, ResourceManager, Sound);
            fm                 = new FocusManager(this);
            fm.Focus(mss);

            mss.DisapperFinish += cc.Show;
            bgd   = new BackGroundDisplay(device, ResourceManager, "skins\\PPDSingle_BackGround.xml", "Menu");
            black = new RectangleComponent(device, ResourceManager, PPDColors.Black)
            {
                RectangleHeight = 450,
                RectangleWidth  = 800,
                Alpha           = 0
            };

            menuMovie = new MenuMovie(device);
            this.AddChild(black);
            this.AddChild(textBox);
            this.AddChild(obd);
            this.AddChild(cc);
            this.AddChild(oc);
            this.AddChild(ss);
            this.AddChild(lm);
            this.AddChild(sic);
            this.AddChild(mss);
            var po = new PictureObject(device, ResourceManager, Utility.Path.Combine("bottom.png"));

            po.Position = new Vector2(0, 450 - po.Height + 1);
            po.AddChild(new TextureString(device, Utility.Language["SearchScore"], 14, PPDColors.Gray)
            {
                Position = new Vector2(85, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Move"], 14, PPDColors.Gray)
            {
                Position = new Vector2(205, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Menu"], 14, PPDColors.Gray)
            {
                Position = new Vector2(325, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Option"], 14, PPDColors.Gray)
            {
                Position = new Vector2(445, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Decide"], 14, PPDColors.Gray)
            {
                Position = new Vector2(565, 7)
            });
            po.AddChild(new TextureString(device, Utility.Language["Back"], 14, PPDColors.Gray)
            {
                Position = new Vector2(685, 7)
            });
            this.AddChild(po);
            this.AddChild(menuMovie);
            this.AddChild(bgd);

            oc.Connect    = SkinSetting.Setting.Connect;
            oc.RivalGhost = SkinSetting.Setting.RivalGhost;

            ssm.CurrentRoot      = SongInformation.Root;
            ssm.CurrentLogicRoot = LogicFolderInfomation.Root;

            if (PreviousParam.TryGetValue("CurrentRoot", out temp))
            {
                var root = temp as SongInformation;
                ssm.CurrentRoot = root;
            }
            if (PreviousParam.TryGetValue("CurrentLogicRoot", out temp))
            {
                var root = temp as LogicFolderInfomation;
                ssm.CurrentLogicRoot = root;
            }
            if (PreviousParam.TryGetValue("CurrentMode", out temp))
            {
                var mode = (SelectSongManager.Mode)temp;
                ssm.ChangeMode(mode);
            }
            if (PreviousParam.TryGetValue("SelectedIndex", out temp))
            {
                selectnum = (int)temp;
            }
            ssm.SelectedIndex = selectnum;

            return(true);
        }
        public void TestFullContest()
        {
            DateTime endDate = new DateTime(2018, 2, 22);

            ContestInfo contestInfo = new ContestInfo("Svedala simhopps tävling", "Örebro", DateTime.Now, endDate, "Gustavsvik");

            Judge judge1 = new Judge("Karl", "Mal");
            Judge judge2 = new Judge("LAban", "Asda");
            Judge judge3 = new Judge("Leg", "Shin");
            Judge judge4 = new Judge("Handy", "Bandy");
            Judge judge5 = new Judge("Sammy", "Rol");

            JudgeList judgeList = new JudgeList();

            judgeList.Add(judge1);
            judgeList.Add(judge2);
            judgeList.Add(judge3);
            judgeList.Add(judge4);
            judgeList.Add(judge5);

            Contestant kalle = new Contestant("kalle", "Cool");
            Contestant pelle = new Contestant("pelle", "Holm");
            Contestant lars  = new Contestant("Lars", "Lerin");
            Contestant anna  = new Contestant("Anna", "Annasson");

            ContestantList contestantList = new ContestantList();

            contestantList.Add(kalle);
            contestantList.Add(pelle);
            contestantList.Add(lars);
            contestantList.Add(anna);

            // create the new Contest object
            Contest contest = new Contest(contestInfo, judgeList, contestantList);


            // create ContestantLists for a subcontest
            ContestantList branch1_Contestants = new ContestantList();

            branch1_Contestants.Add(kalle);
            branch1_Contestants.Add(pelle);
            branch1_Contestants.Add(lars);

            SubContestBranch branch1 = new SubContestBranch("Deltävling 1", contest, branch1_Contestants);


            // create second subcontest
            ContestantList branch2_Contestants = new ContestantList();

            branch2_Contestants.Add(kalle);
            branch2_Contestants.Add(pelle);
            branch2_Contestants.Add(anna);

            SubContestBranch branch2 = new SubContestBranch("Deltävling 2", contest, branch2_Contestants);

            // add the newly created subcontests to the contest
            contest.SubContestBranches.Add(branch1);
            contest.SubContestBranches.Add(branch2);


            // first dive of the subcontest
            Dive dive1Kalle = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Kalle = new ScoreList();

            scoreListDive1Kalle.Add(new Score(8, judge1));
            scoreListDive1Kalle.Add(new Score(5, judge2));
            scoreListDive1Kalle.Add(new Score(8.5, judge3));
            scoreListDive1Kalle.Add(new Score(7, judge4));
            scoreListDive1Kalle.Add(new Score(9, judge5));

            dive1Kalle.Scores = scoreListDive1Kalle;

            branch1.AddNewDive(kalle, dive1Kalle);


            // second dive
            Dive dive1Pelle = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Pelle = new ScoreList();

            scoreListDive1Pelle.Add(new Score(8, judge1));
            scoreListDive1Pelle.Add(new Score(5, judge2));
            scoreListDive1Pelle.Add(new Score(8.5, judge3));
            scoreListDive1Pelle.Add(new Score(7, judge4));
            scoreListDive1Pelle.Add(new Score(6.5, judge5));

            dive1Pelle.Scores = scoreListDive1Pelle;

            branch1.AddNewDive(pelle, dive1Pelle);


            // third dive
            Dive dive1Lars = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Lars = new ScoreList();

            scoreListDive1Lars.Add(new Score(7.5, judge1));
            scoreListDive1Lars.Add(new Score(9, judge2));
            scoreListDive1Lars.Add(new Score(8.5, judge3));
            scoreListDive1Lars.Add(new Score(7, judge4));
            scoreListDive1Lars.Add(new Score(6.5, judge5));

            dive1Lars.Scores = scoreListDive1Lars;

            branch1.AddNewDive(lars, dive1Lars);


            // first dive of second subcontest
            Dive dive2Kalle = new Dive(new DiveCode(2.8));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive2Kalle = new ScoreList();

            scoreListDive2Kalle.Add(new Score(8, judge1));
            scoreListDive2Kalle.Add(new Score(5, judge2));
            scoreListDive2Kalle.Add(new Score(8.5, judge3));
            scoreListDive2Kalle.Add(new Score(7, judge4));
            scoreListDive2Kalle.Add(new Score(9, judge5));

            dive2Kalle.Scores = scoreListDive1Kalle;

            branch2.AddNewDive(kalle, dive2Kalle);


            // second dive
            Dive dive2Pelle = new Dive(new DiveCode(2.9));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive2Pelle = new ScoreList();

            scoreListDive2Pelle.Add(new Score(8, judge1));
            scoreListDive2Pelle.Add(new Score(5, judge2));
            scoreListDive2Pelle.Add(new Score(8, judge3));
            scoreListDive2Pelle.Add(new Score(7, judge4));
            scoreListDive2Pelle.Add(new Score(6.5, judge5));

            dive2Pelle.Scores = scoreListDive1Pelle;

            branch2.AddNewDive(pelle, dive2Pelle);


            // third dive
            Dive dive1Anna = new Dive(new DiveCode(3.0));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Anna = new ScoreList();

            scoreListDive1Anna.Add(new Score(7.5, judge1));
            scoreListDive1Anna.Add(new Score(9, judge2));
            scoreListDive1Anna.Add(new Score(8.5, judge3));
            scoreListDive1Anna.Add(new Score(7, judge4));
            scoreListDive1Anna.Add(new Score(6.5, judge5));

            dive1Anna.Scores = scoreListDive1Anna;

            branch2.AddNewDive(anna, dive1Anna);

            Console.WriteLine("HEJ");

            foreach (var subContest in contest.SubContestBranches)
            {
                int i = 1;
                foreach (var result in subContest.GenerateSubContestResult())
                {
                    Console.WriteLine(i + ". " + result.Key.FirstName + " Score: " + result.Value);
                    i++;
                }
            }
        }
示例#17
0
 public ContestInfo CreateContest(Organization org, Product product)
 {
     ContestInfo contestInfo = new ContestInfo { Product = product, Organization = org };
     _contestInfos.Add(contestInfo);
     return contestInfo;
 }
示例#18
0
        public Contest createTestContest()
        {
            DateTime endDate = new DateTime(2018, 2, 22);

            ContestInfo contestInfo = new ContestInfo("Svedala simhoppstävling", "Örebro", DateTime.Now, endDate, "Gustavsvik");

            Judge judge1 = new Judge(1, "Karl", "Mal", 22, "*****@*****.**", "male", "891017-6653", "Pappersvägen 3");
            Judge judge2 = new Judge(2, "Laban", "Asda", 45, "*****@*****.**", "male", "651011-6423", "Venavägen 8");
            Judge judge3 = new Judge(3, "Leg", "Shin", 33, "*****@*****.**", "male", "821201-5434", "Storgatan 1");
            Judge judge4 = new Judge(4, "Anna", "Pann", 29, "*****@*****.**", "female", "910413-4594", "Järnvägsgatan 33");
            Judge judge5 = new Judge(5, "Sammy", "Rol", 38, "*****@*****.**", "female", "880623-5921", "Skolgatan 28");

            JudgeList judgeList = new JudgeList();

            judgeList.Add(judge1);
            judgeList.Add(judge2);
            judgeList.Add(judge3);
            judgeList.Add(judge4);
            judgeList.Add(judge5);

            Contestant kalle = new Contestant(6, "Kalle", "Cool", 35, "*****@*****.**", "male", "78345345-435", "Storgatan 3");
            Contestant pelle = new Contestant(7, "Pelle", "Holm", 14, "*****@*****.**", "male", "04546387-1104", "Småttmisnöjdmedtillvaro gatan 25");
            Contestant lars  = new Contestant(8, "Lars", "Lerin", 50, "*****@*****.**", "male", "68345435-4352", "Brittmarie-gatan 89");
            Contestant anna  = new Contestant(9, "Anna", "Annasson", 28, "*****@*****.**", "female", "88376534534-3455", "Lokalgatan 8");

            ContestantList contestantList = new ContestantList();

            contestantList.Add(kalle);
            contestantList.Add(pelle);
            contestantList.Add(lars);
            contestantList.Add(anna);

            // create the new Contest object
            Contest contest = new Contest(contestInfo, judgeList, contestantList);


            // create ContestantLists for a subcontest
            ContestantList branch1_Contestants = new ContestantList();

            branch1_Contestants.Add(kalle);
            branch1_Contestants.Add(pelle);
            branch1_Contestants.Add(lars);

            SubContestBranch branch1 = new SubContestBranch("Deltävling 1", contest, branch1_Contestants);


            // create second subcontest
            ContestantList branch2_Contestants = new ContestantList();

            branch2_Contestants.Add(kalle);
            branch2_Contestants.Add(pelle);
            branch2_Contestants.Add(anna);

            SubContestBranch branch2 = new SubContestBranch("Deltävling 2", contest, branch2_Contestants);

            // add the newly created subcontests to the contest
            contest.SubContestBranches.Add(branch1);
            contest.SubContestBranches.Add(branch2);


            // first dive of the subcontest
            Dive dive1Kalle = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Kalle = new ScoreList();

            scoreListDive1Kalle.Add(new Score(8, judge1));
            scoreListDive1Kalle.Add(new Score(5, judge2));
            scoreListDive1Kalle.Add(new Score(8.5, judge3));
            scoreListDive1Kalle.Add(new Score(7, judge4));
            scoreListDive1Kalle.Add(new Score(9, judge5));

            dive1Kalle.Scores = scoreListDive1Kalle;

            branch1.AddNewDive(kalle, dive1Kalle);


            // second dive
            Dive dive1Pelle = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Pelle = new ScoreList();

            scoreListDive1Pelle.Add(new Score(8, judge1));
            scoreListDive1Pelle.Add(new Score(5, judge2));
            scoreListDive1Pelle.Add(new Score(8.5, judge3));
            scoreListDive1Pelle.Add(new Score(7, judge4));
            scoreListDive1Pelle.Add(new Score(6.5, judge5));

            dive1Pelle.Scores = scoreListDive1Pelle;

            branch1.AddNewDive(pelle, dive1Pelle);


            // third dive
            Dive dive1Lars = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Lars = new ScoreList();

            scoreListDive1Lars.Add(new Score(7.5, judge1));
            scoreListDive1Lars.Add(new Score(9, judge2));
            scoreListDive1Lars.Add(new Score(8.5, judge3));
            scoreListDive1Lars.Add(new Score(7, judge4));
            scoreListDive1Lars.Add(new Score(6.5, judge5));

            dive1Lars.Scores = scoreListDive1Lars;

            branch1.AddNewDive(lars, dive1Lars);


            // first dive of second subcontest
            Dive dive2Kalle = new Dive(new DiveCode(2.8));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive2Kalle = new ScoreList();

            scoreListDive2Kalle.Add(new Score(8, judge1));
            scoreListDive2Kalle.Add(new Score(5, judge2));
            scoreListDive2Kalle.Add(new Score(8.5, judge3));
            scoreListDive2Kalle.Add(new Score(7, judge4));
            scoreListDive2Kalle.Add(new Score(9, judge5));

            dive2Kalle.Scores = scoreListDive1Kalle;

            branch2.AddNewDive(kalle, dive2Kalle);


            // second dive
            Dive dive2Pelle = new Dive(new DiveCode(2.9));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive2Pelle = new ScoreList();

            scoreListDive2Pelle.Add(new Score(8, judge1));
            scoreListDive2Pelle.Add(new Score(5, judge2));
            scoreListDive2Pelle.Add(new Score(8, judge3));
            scoreListDive2Pelle.Add(new Score(7, judge4));
            scoreListDive2Pelle.Add(new Score(6.5, judge5));

            dive2Pelle.Scores = scoreListDive1Pelle;

            branch2.AddNewDive(pelle, dive2Pelle);


            // third dive
            Dive dive1Anna = new Dive(new DiveCode(3.0));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Anna = new ScoreList();

            scoreListDive1Anna.Add(new Score(7.5, judge1));
            scoreListDive1Anna.Add(new Score(9, judge2));
            scoreListDive1Anna.Add(new Score(8.5, judge3));
            scoreListDive1Anna.Add(new Score(7, judge4));
            scoreListDive1Anna.Add(new Score(6.5, judge5));

            dive1Anna.Scores = scoreListDive1Anna;

            branch2.AddNewDive(anna, dive1Anna);

            return(contest);
        }
示例#19
0
 public ContestSelectedSongInfo(ContestInfo contestInfo)
     : base(SongInformation.FindSongInformationByHash(CryptographyUtility.Parsex2String(contestInfo.ScoreHash), contestInfo.Difficulty))
 {
     ContestInfo = contestInfo;
 }