private void Remove()
 {
     if (this.SelectedItem != null)
     {
         Matchs.Remove(this.SelectedItem);
     }
 }
예제 #2
0
 public void MatchStart(int i)
 {
     if (Matchs[i].IdPokemonVainqueur == -1)
     {
         Matchs[i].MatchStart();
         try
         {
             if (i % 2 == 0)
             {
                 if (Matchs[i + 1].IdPokemonVainqueur != -1)
                 {
                     Pokemon p1 = Matchs[i].getPokemonVainqueur();
                     Pokemon p2 = Matchs[i + 1].getPokemonVainqueur();
                     Matchs.Add(new Match(p1, p2, Matchs[i].Phase_next()));
                     nbrMatch++;
                 }
             }
             else if (i % 2 == 1)
             {
                 if (Matchs[i - 1].IdPokemonVainqueur != -1)
                 {
                     Pokemon p1 = Matchs[i].getPokemonVainqueur();
                     Pokemon p2 = Matchs[i - 1].getPokemonVainqueur();
                     Matchs.Add(new Match(p2, p1, Matchs[i].Phase_next()));
                     nbrMatch++;
                 }
             }
         }
         catch { }
     }
 }
        private void Add()
        {
            JediTournamentEntities.Match a = new JediTournamentEntities.Match();

            this.SelectedItem = new GestionMatchsViewModel(a);
            Matchs.Add(this.SelectedItem);
        }
예제 #4
0
        /// <summary>
        /// Ajoute un nouveau match à la liste de matchs.
        /// </summary>
        private void New()
        {
            Match m = new Match(_newNextId--, null, null, EPhaseTournoi.QuartFinale, null);

            this.SelectedItem = new MatchViewModel(m);
            Matchs.Add(this.SelectedItem);
        }
예제 #5
0
        private void UpdateMatchesForGroup()
        {
            int?groupId = SelectedGroup?.GroupID;

            MatchsOfGroup.Clear();
            Matchs.Where(x => x.Group.GroupID == groupId).ForEach(MatchsOfGroup.Add);
        }
예제 #6
0
 public void AjouterMatch(Match match)
 {
     //   if (Matchs.Count < 8)
     //   {
     Matchs.Add(match);
     nbrMatch++;
     //   }
 }
예제 #7
0
        public ActionResult DeleteMatchsConfirmed(int id)
        {
            Matchs matchs = db.Matchs.Find(id);

            db.Matchs.Remove(matchs);
            db.SaveChanges();
            return(RedirectToAction("IndexMatchs"));
        }
예제 #8
0
 public ActionResult Edit(int id, MatchsViewModel mVm)
 {
     try
     {
         Matchs matchUpdate = _db.Matchs.Find(id);
         if (matchUpdate != null)
         {
             int srList = _db.SchemasRencontres.Count(t => t.Type == matchUpdate.Serie.Type);
             for (int cpt = 1; cpt <= srList; cpt++)
             {
                 Rencontres rc = _db.Rencontres.Where(o => o.Sr.Ordre == cpt).FirstOrDefault(r => r.Match.MatchId == id);
                 rc.Score = String.Empty;
                 if (rc != null)
                 {
                     for (int cpt2 = 0; cpt2 < 10; cpt2++)
                     {
                         if (rc != null)
                         {
                             if (cpt2 % 2 == 0)
                             {
                                 rc.Score = rc.Score + Request.Form["Set" + cpt + cpt2] + "-";
                             }
                             else
                             {
                                 rc.Score = rc.Score + Request.Form["Set" + cpt + cpt2] + ";";
                             }
                         }
                     }
                 }
                 _db.SaveChanges();
             }
             matchUpdate.SerieId           = mVm.SeriesVm.SerieChoisi;
             matchUpdate.ClubVisite        = mVm.ClubsVeVm.ClubChoisi;
             matchUpdate.ClubVisiteur      = mVm.ClubsVrVm.ClubChoisi;
             matchUpdate.CapitaineVisite   = mVm.CapitaineVe.JoueurChoisi;
             matchUpdate.CapitaineVisiteur = mVm.CapitaineVr.JoueurChoisi;
             matchUpdate.J1Visite          = mVm.Joueur1Ve.JoueurChoisi;
             matchUpdate.J2Visite          = mVm.Joueur2Ve.JoueurChoisi;
             matchUpdate.J3Visite          = mVm.Joueur3Ve.JoueurChoisi;
             matchUpdate.J4Visite          = mVm.Joueur4Ve.JoueurChoisi;
             matchUpdate.J1Visiteur        = mVm.Joueur1Vr.JoueurChoisi;
             matchUpdate.J2Visiteur        = mVm.Joueur2Vr.JoueurChoisi;
             matchUpdate.J3Visiteur        = mVm.Joueur3Vr.JoueurChoisi;
             matchUpdate.J4Visiteur        = mVm.Joueur4Vr.JoueurChoisi;
             _db.SaveChanges();
         }
         else
         {
             //Message d'erreur : Id non inexistant
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         //Message d'erreur : Problème
         return(View(mVm));
     }
 }
예제 #9
0
 public Round VersModeleRound()
 {
     return(new Round
     {
         Id = Id,
         Nom = Nom,
         Matchs = Matchs.Select(m => m.VersModeleMatch())
     });
 }
예제 #10
0
        //
        // GET: /admMatchs/Delete/5

        public ActionResult DeleteMatchs(int id = 0)
        {
            Matchs matchs = db.Matchs.Find(id);

            if (matchs == null)
            {
                return(HttpNotFound());
            }
            return(View("DeleteMatchs", matchs));
        }
예제 #11
0
        public ActionResult CloturerMatchs(Matchs matchs)
        {
            List <UserProfile> gagnants = new List <UserProfile>();
            List <UserProfile> perdants = new List <UserProfile>();

            if (ModelState.IsValid)
            {
                switch (matchs.resultat)
                {
                case 0:
                    gagnants = db.UserProfile.Where(c => c.paris_user.Where(i => i.match_id == matchs.Id).FirstOrDefault().resultat_parie == 0).ToList();
                    perdants = db.UserProfile.Where(c => c.paris_user.Where(i => i.match_id == matchs.Id).FirstOrDefault().resultat_parie == 2).ToList();
                    break;

                case 2:
                    gagnants = db.UserProfile.Where(c => c.paris_user.Where(i => i.match_id == matchs.Id).FirstOrDefault().resultat_parie == 2).ToList();
                    perdants = db.UserProfile.Where(c => c.paris_user.Where(i => i.match_id == matchs.Id).FirstOrDefault().resultat_parie == 0).ToList();
                    break;
                }
                double sommeP = 0;
                double sommeG = 0;
                foreach (UserProfile p in perdants)
                {
                    sommeP += p.paris_user.Where(c => c.match_id == matchs.Id).FirstOrDefault().credit_parie;
                }
                foreach (UserProfile p in gagnants)
                {
                    sommeG += p.paris_user.Where(c => c.match_id == matchs.Id).FirstOrDefault().credit_parie;
                }

                db.User_infos.Where(c => c.admin == true).FirstOrDefault().credits += sommeP / 10;

                sommeP -= sommeP / 10;

                double credGagne   = 0;
                double credParie   = 0;
                double pourcentage = 0;
                foreach (UserProfile p in gagnants)
                {
                    credParie   = p.paris_user.Where(c => c.match_id == matchs.Id).FirstOrDefault().credit_parie;
                    pourcentage = (credParie * 100) / sommeG;
                    credGagne   = credParie + (sommeP * pourcentage) / 100;

                    db.User_infos.Where(c => c.UserId == p.UserId).FirstOrDefault().credits += credGagne;
                }

                db.Entry(matchs).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("IndexMatchs"));
            }
            ViewBag.id_Eq1 = new SelectList(db.Tournois.Where(c => c.Id == matchs.tournoi_id).First().Equipes.ToList(), "Id", "nom", matchs.id_Eq1);
            ViewBag.id_Eq2 = new SelectList(db.Tournois.Where(c => c.Id == matchs.tournoi_id).First().Equipes.ToList(), "Id", "nom", matchs.id_Eq2);

            return(View("CloturerMatchs", matchs));
        }
예제 #12
0
        /// <summary>
        /// Applique la suppression du jedi courant.
        /// </summary>
        private void Remove()
        {
            if (this.SelectedItem != null)
            {
                if (this.SelectedItem.Match.ID >= 0)    // Notifie que pour les matchs déjà en BDD
                {
                    OnRemoveMatch(this.SelectedItem.Match);
                }

                Matchs.Remove(this.SelectedItem);
            }
        }
예제 #13
0
 private Pokemon[] JouerPhaseTournoi(Pokemon[] tablpokemon, EPhaseTournoi phase)
 {
     Pokemon[] pokevainqueur = new Pokemon[(int)((tablpokemon.Length) / 2)];
     for (int i = 0; i < (tablpokemon.Length) / 2; i++)
     {
         Stade stade = getRandomStade();
         Match match = new Match(tablpokemon[i * 2], tablpokemon[(i * 2) + 1], stade, phase);
         match.JouerMatch();
         Matchs.Add(match);
         pokevainqueur[i] = match.Vainqueur;
     }
     return(pokevainqueur);
 }
예제 #14
0
        public ActionResult EditMatchs(Matchs matchs)
        {
            if (ModelState.IsValid)
            {
                db.Entry(matchs).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("IndexMatchs"));
            }
            ViewBag.id_Eq1 = new SelectList(db.Tournois.Where(c => c.Id == matchs.tournoi_id).First().Equipes.ToList(), "Id", "nom", matchs.id_Eq1);
            ViewBag.id_Eq2 = new SelectList(db.Tournois.Where(c => c.Id == matchs.tournoi_id).First().Equipes.ToList(), "Id", "nom", matchs.id_Eq2);

            return(View("EditMatchs", matchs));
        }
예제 #15
0
        public ActionResult CloturerMatchs(int id = 0)
        {
            Matchs matchs = db.Matchs.Find(id);

            if (matchs == null)
            {
                return(HttpNotFound());
            }
            ViewBag.id_Eq1 = new SelectList(db.Tournois.Where(c => c.Id == matchs.tournoi_id).First().Equipes.ToList(), "Id", "nom", matchs.id_Eq1);
            ViewBag.id_Eq2 = new SelectList(db.Tournois.Where(c => c.Id == matchs.tournoi_id).First().Equipes.ToList(), "Id", "nom", matchs.id_Eq2);

            return(View("CloturerMatchs", matchs));
        }
 public IHttpActionResult GetMatch(int matchID)
 {
     try
     {
         DAL    dal   = new DAL();
         Matchs match = dal.getMatchDetails(matchID);
         return(Content(HttpStatusCode.OK, match));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(Content(HttpStatusCode.BadRequest, e.Message));
     }
 }
 public IHttpActionResult PostCreateMatch([FromBody] Matchs match)
 {
     try
     {
         DAL dal    = new DAL();
         int result = dal.CreateMatch(match.UserID, match.MatchName, match.MatchDate, match.MatchTime, match.FieldID, match.CityID, match.IsPrivate, match.MatchKey, match.MaxPlayers, match.PlayTime);
         return(Content(HttpStatusCode.Created, result));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(Content(HttpStatusCode.BadRequest, e.Message));
     }
 }
예제 #18
0
        public ActionResult CreateMatchs(Matchs matchs, int idtournoi)
        {
            matchs.tournoi_id = idtournoi;
            matchs.resultat   = 1;
            if (ModelState.IsValid)
            {
                db.Matchs.Add(matchs);
                db.SaveChanges();
                return(RedirectToAction("IndexMatchs"));
            }

            ViewBag.id_Eq1 = new SelectList(db.Tournois.Where(c => c.Id == idtournoi).First().Equipes.ToList(), "Id", "nom", matchs.id_Eq1);
            ViewBag.id_Eq2 = new SelectList(db.Tournois.Where(c => c.Id == idtournoi).First().Equipes.ToList(), "Id", "nom", matchs.id_Eq2);
            return(View("CreateMatchs", matchs));
        }
예제 #19
0
 public static MatchDto ConvertToDto(this Matchs match)
 {
     return(new MatchDto
     {
         Id = match.Id.ToString(),
         IsCompleted = match.IsCompleted,
         TournamentId = match.TournamentId.ToString(),
         HomeTeam = new TeamDto {
             Id = match.HomeTeam.ToString()
         },
         AwayTeam = new TeamDto {
             Id = match.AwayTeam.ToString()
         },
     });
 }
예제 #20
0
 public ActionResult Delete(Matchs m, int id)
 {
     try
     {
         Matchs matchRemove = _db.Matchs.Find(id);
         if (matchRemove != null)
         {
             _db.Matchs.Remove(matchRemove);
             _db.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(m));
     }
 }
 public IHttpActionResult DeleteMatch([FromBody] Matchs value)
 {
     try
     {
         DAL    dal    = new DAL();
         string result = dal.CancelMatch(value.MatchID, value.MatchDate);
         if (result == "Done!")
         {
             return(Content(HttpStatusCode.OK, result));
         }
         else
         {
             return(Content(HttpStatusCode.BadRequest, result));
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(Content(HttpStatusCode.BadRequest, e.Message));
     }
 }
예제 #22
0
    //将xml解析成list集合
    public List <Matchs> TranList()
    {
        List <Matchs> list     = new List <Matchs>();
        XmlDocument   dom      = JQCPage();
        XmlNodeList   nodelist = dom.SelectSingleNode("/xml").ChildNodes;

        foreach (XmlNode node in nodelist)
        {
            Matchs     matchs = new Matchs();
            XmlElement xe     = (XmlElement)node;//将子节点类型转换为xmlelement类型

            matchs.phase      = xe.GetAttribute("phase").ToString();
            matchs.result     = xe.GetAttribute("result").ToString();
            matchs.sale_start = xe.GetAttribute("sale_start").ToString();
            matchs.sale_end   = xe.GetAttribute("sale_end").ToString();

            foreach (XmlNode node2 in node)
            {
                foreach (XmlNode node3 in node2)
                {
                    Matchs2    matchs2 = new Matchs2();
                    XmlElement xe2     = (XmlElement)node3;

                    matchs2.match      = xe2.GetAttribute("match").ToString();
                    matchs2.team_home  = xe2.GetAttribute("team_home").ToString();
                    matchs2.team_away  = xe2.GetAttribute("team_away").ToString();
                    matchs2.start_time = xe2.GetAttribute("start_time").ToString();
                    matchs2.score      = xe2.GetAttribute("score").ToString();

                    matchs.listMatch.Add(matchs2);
                }
            }
            list.Add(matchs);
        }
        return(list);
    }
예제 #23
0
        internal void InitBaseData(Arma3TacMapLibrary.TacMaps.IApiTacMaps apiTacMaps, Arma3TacMapLibrary.Arma3.IMapInfosService mapInfosService)
        {
            if (!Factions.Any())
            {
                Factions.Add(new Faction()
                {
                    Name = "OTAN", UsualSide = GameSide.BLUFOR, Flag = "/img/flags/nato.png", GameMarker = GameMarkerType.flag_nato
                });
                Factions.Add(new Faction()
                {
                    Name = "CSAT", UsualSide = GameSide.OPFOR, Flag = "/img/flags/csat.png", GameMarker = GameMarkerType.flag_csat
                });
                Factions.Add(new Faction()
                {
                    Name = "AAF", UsualSide = GameSide.Independant, Flag = "/img/flags/aaf.png", GameMarker = GameMarkerType.flag_aaf
                });
                Factions.Add(new Faction()
                {
                    Name = "USA", UsualSide = GameSide.BLUFOR, Flag = "/img/flags/us.png", GameMarker = GameMarkerType.flag_usa
                });
                Factions.Add(new Faction()
                {
                    Name = "UK", UsualSide = GameSide.BLUFOR, Flag = "/img/flags/uk.png", GameMarker = GameMarkerType.flag_uk
                });
                Factions.Add(new Faction()
                {
                    Name = "FIA", UsualSide = GameSide.Independant, Flag = "/img/flags/fia.png", GameMarker = GameMarkerType.flag_fia
                });
                Factions.Add(new Faction()
                {
                    Name = "France", UsualSide = GameSide.BLUFOR, Flag = "/img/flags/fr.png", GameMarker = GameMarkerType.flag_france
                });
                SaveChanges();
            }
            var oldMissionBrief = Matchs.Where(m => !string.IsNullOrEmpty(m.MissionBriefLink)).ToList();

            if (oldMissionBrief.Any())
            {
                foreach (var match in oldMissionBrief)
                {
                    Documents.Add(new Document()
                    {
                        Date = DateTime.Now, MatchID = match.MatchID, Link = match.MissionBriefLink, Type = DocumentType.MissionBrief, Title = "Mission brief"
                    });
                    match.MissionBriefLink = null;
                    Update(match);
                }
                SaveChanges();
            }
            var oldMaps = Matchs.Where(m => m.GameMapID != null && m.TacMapId == null).Include(m => m.GameMap).ToList();

            if (oldMaps.Any())
            {
                var worlds = mapInfosService.GetMapsInfos().Result;
                foreach (var match in oldMaps)
                {
                    var world = worlds.FirstOrDefault(w => string.Equals(w.worldName, match.GameMap.WebMap, StringComparison.OrdinalIgnoreCase)) ??
                                worlds.FirstOrDefault(w => w.worldName.EndsWith(match.GameMap.WebMap, StringComparison.OrdinalIgnoreCase)) ??
                                worlds.FirstOrDefault(w => w.worldName.StartsWith(match.GameMap.WebMap, StringComparison.OrdinalIgnoreCase));
                    if (world != null)
                    {
                        match.WorldName = world.worldName;
                        match.TacMapId  = apiTacMaps.Create(new Arma3TacMapLibrary.TacMaps.ApiTacMapCreate()
                        {
                            WorldName = world.worldName,
                            Label     = match.Name,
                            EventHref = new Uri("https://plan-ops.fr/Events/Details/" + match.MatchID),
                            Markers   = MapMarkers.Where(m => m.MatchID == match.MatchID && m.RoundSideID == null && m.RoundSquadID == null).Select(m => new Arma3TacMapLibrary.Maps.StoredMarker()
                            {
                                MarkerData = m.MarkerData
                            }).ToList()
                        }).Result.Id;
                        Update(match);
                    }
                }
                SaveChanges();
            }
        }
예제 #24
0
        public List <objMatch> getMatchOddLive()
        {
            objMatch o;
            string   data = "";

            try
            {
                lstLive.Clear();
                data = http.Fetch(mainHost + "/UnderOver.aspx?Market=t&DispVer=new", HttpHelper.HttpMethod.Get, mainLink, null);
                if (data == "")
                {
                    o = new objMatch();
                    lstLive.Clear();
                    o.Score = "Logout";
                    lstLive.Add(o);
                    login();
                    return(lstLive);
                }
                int    ik    = data.IndexOf("name=\"k");
                int    iv    = data.IndexOf("value=\"v");
                string kIbet = data.Substring(ik + 6, iv - ik - 8);
                string vIbet = data.Substring(iv + 7, iv - ik - 8);
                string CT    = Util.EscapeDataString(DateTime.Now.AddHours(-11).ToString());
                data = http.Fetch(mainHost + "/UnderOver_data.aspx?Market=l&Sport=1&DT=&RT=W&CT=" + CT + "&Game=0&OrderBy=0&OddsType=4&MainLeague=0&DispRang=0&" + kIbet + "=" + vIbet + "&key=dodds&_=1502509515441", HttpHelper.HttpMethod.Get, mainHost + "/UnderOver.aspx?Market=t&DispVer=new", null);
                string LeaugeName = "", HomeName = "", AwayName = "", Time = "", Score = "";
                if (data == "")
                {
                    o = new objMatch();
                    lstLive.Clear();
                    o.Score = "Logout";
                    lstLive.Add(o);
                    login();
                    return(lstLive);
                }
                else
                {
                    foreach (Match m in Regex.Matches(data, @"Nl\[\d+\]=\[.*\];"))
                    {
                        string strIbetMatch = m.Value.ToString().Replace("];", "");
                        strIbetMatch = Regex.Replace(strIbetMatch, @"Nl\[\d+\]=\[", "");
                        strIbetMatch = strIbetMatch.Replace("'", "");

                        string[] dataIbetMatch = strIbetMatch.Split(',');
                        if (dataIbetMatch[5] != "")
                        {
                            LeaugeName = UtilSoccer.ChuanTenLeauge_Ibet(dataIbetMatch[5]);
                        }
                        if (LeaugeName.Contains("CORNERS") || LeaugeName.Contains("BOOKING") || LeaugeName.Contains("TEAM") || LeaugeName.Contains("WINNER") ||
                            LeaugeName.Contains("MATCH") || LeaugeName.Contains("SPECIFIC") || LeaugeName.Contains("SUBSTITUTION") ||
                            LeaugeName.Contains("GOAL KICK") || LeaugeName.Contains("OFFSIDE") || LeaugeName.Contains("THROW IN") ||
                            LeaugeName.Contains("FREE KICK") || LeaugeName.Contains("1st HALF vs 2nd HALF") || LeaugeName.Contains("RED CARD") ||
                            LeaugeName.Contains("OWN GOAL") || LeaugeName.Contains("PENALTY") || LeaugeName.Contains("TOTAL GOALS MINUTES") ||
                            LeaugeName.Contains("Injury"))
                        {
                            continue;
                        }

                        if (dataIbetMatch[6] != "")
                        {
                            HomeName = UtilSoccer.ChuanTenTeam_Ibet(dataIbetMatch[6]);
                            AwayName = UtilSoccer.ChuanTenTeam_Ibet(dataIbetMatch[7]);
                        }
                        if (dataIbetMatch[12] != "")
                        {
                            Time = dataIbetMatch[12].Replace("\\", "");
                        }
                        if (dataIbetMatch[21] != "" && dataIbetMatch[22] != "")
                        {
                            Score = dataIbetMatch[21] + "-" + dataIbetMatch[22];
                        }
                        ///FT///
                        try
                        {
                            o            = new objMatch();
                            o.Score      = Score;
                            o.TimeLive   = Time;
                            o.LeaugeName = LeaugeName;
                            o.HomeName   = HomeName;
                            o.AwayName   = AwayName;
                            if (Matchs.Contains(o.HomeName + "-" + o.AwayName) == false)
                            {
                                Matchs += o.HomeName + "-" + o.AwayName + ",";
                            }
                            o.IdKeo   = dataIbetMatch[31];
                            o.BetType = "1";
                            o.hdp     = dataIbetMatch[32];
                            o.Odd1    = dataIbetMatch[33];
                            o.Odd2    = dataIbetMatch[34];
                            if (dataIbetMatch[35] == "a")
                            {
                                o.hdp = "-" + o.hdp;
                            }
                            o.hdp = UtilSoccer.formatkeo(o.hdp);
                            lstLive.Add(o);
                        }
                        catch
                        { }



                        ///OUFT///
                        try
                        {
                            o            = new objMatch();
                            o.Score      = Score;
                            o.TimeLive   = Time;
                            o.LeaugeName = LeaugeName;
                            o.HomeName   = HomeName;
                            o.AwayName   = AwayName;
                            o.IdKeo      = dataIbetMatch[36];
                            o.BetType    = "3";
                            o.hdp        = dataIbetMatch[37];
                            o.Odd1       = dataIbetMatch[38];
                            o.Odd2       = dataIbetMatch[39];
                            if (dataIbetMatch[35] == "a")
                            {
                                o.hdp = "-" + o.hdp;
                            }
                            o.hdp = UtilSoccer.formatkeo(o.hdp);
                            lstLive.Add(o);
                        }
                        catch
                        { }

                        ///HT///
                        try
                        {
                            o            = new objMatch();
                            o.Score      = Score;
                            o.TimeLive   = Time;
                            o.LeaugeName = LeaugeName;
                            o.HomeName   = HomeName;
                            o.AwayName   = AwayName;
                            o.IdKeo      = dataIbetMatch[44];
                            o.BetType    = "7";
                            o.hdp        = dataIbetMatch[45];
                            o.Odd1       = dataIbetMatch[46];
                            o.Odd2       = dataIbetMatch[47];
                            if (dataIbetMatch[48] == "a")
                            {
                                o.hdp = "-" + o.hdp;
                            }
                            o.hdp = UtilSoccer.formatkeo(o.hdp);
                            lstLive.Add(o);
                        }
                        catch { }
                        ///HTOU///
                        try
                        {
                            o            = new objMatch();
                            o.Score      = Score;
                            o.TimeLive   = Time;
                            o.LeaugeName = LeaugeName;
                            o.HomeName   = HomeName;
                            o.AwayName   = AwayName;
                            o.IdKeo      = dataIbetMatch[49];
                            o.BetType    = "9";
                            o.hdp        = dataIbetMatch[50];
                            o.Odd1       = dataIbetMatch[51];
                            o.Odd2       = dataIbetMatch[52];
                            if (dataIbetMatch[48] == "a")
                            {
                                o.hdp = "-" + o.hdp;
                            }
                            o.hdp = UtilSoccer.formatkeo(o.hdp);
                            lstLive.Add(o);
                        }
                        catch { }
                    }
                }
            }
            catch (Exception)
            {
                o = new objMatch();
                lstLive.Clear();
                o.Score   = "Error";
                o.BetType = data;
                lstLive.Add(o);
                return(lstLive);
            }
            TotalMatch = "IBET MATCH: " + (Matchs.Split(',').Length - 1).ToString();
            return(lstLive);
        }
예제 #25
0
        public void WhenNoMatchByConstraintsThenNull()
        {
            var route     = new AbsoluteRoute("{controller}/{action}/{id}", constraints: new RouteValueDictionary(new { controller = Matchs.When(x => false) }));
            var context   = "http://acme.com/pizza/calda/1".AsUri().ToHttpContext();
            var routedata = route.GetRouteData(context);

            routedata.Should().Be.Null();
        }
예제 #26
0
        public void WhenMatchThenAssignValues()
        {
            var route     = new AbsoluteRoute("{controller}/{action}/{id}", constraints: new RouteValueDictionary(new { controller = Matchs.When(x => x != null && (new [] { "pazza", "pizza" }).Contains(x.ToLowerInvariant())) }));
            var context   = "http://acme.com/pizza/calda/1".AsUri().ToHttpContext();
            var routedata = route.GetRouteData(context);

            routedata.Values.Should().Not.Be.Null();
            routedata.Values["controller"].Should().Be("pizza");
            routedata.Values["action"].Should().Be("calda");
            routedata.Values["id"].Should().Be("1");
        }
예제 #27
0
        public List <objMatch> getMatchOddNonLive(DateTime TimeLimit)
        {
            try
            {
                lst.Clear();
                string DataOddSboNonLive = http.Fetch(mainLink + "/web-root/restricted/odds-display/today-data.aspx?od-param=2,1,1,1,2,2,2,2,3,1&fi=1&v=0&dl=3", HttpHelper.HttpMethod.Get, null, null);
                string leagueDataNonLive = "[" + Util.GetSubstringByString(DataOddSboNonLive, "[[[", "]],[[") + "]";
                leagueDataNonLive = leagueDataNonLive.Replace("],[", "]\n[");
                string str_LeaugeSbo = "", str_TeamSbo = "";
                if (str_LeaugeSbo == "")
                {
                    hsLeagueNonLive.Clear();
                    foreach (string league in leagueDataNonLive.Split('\n'))
                    {
                        string leagueTemp     = league.Replace("[", "").Replace("]", "").Replace("'", "");
                        string nameleagueTemp = UtilSoccer.ChuanTenLeauge_Sbo(leagueTemp.Split(',')[1]).ToUpper();
                        if (nameleagueTemp.IndexOf("SPECIFIC") != -1 || nameleagueTemp.IndexOf("CORNERS") != -1 || nameleagueTemp.IndexOf("BOOKING") != -1 ||
                            nameleagueTemp.IndexOf("FANTASY MATCH") != -1 || nameleagueTemp.IndexOf("WHICH TEAM") != -1 || nameleagueTemp.IndexOf("TOTAL GOALS") != -1 ||
                            nameleagueTemp.IndexOf("INJURY") != -1 || nameleagueTemp.IndexOf("WINNER") != -1)
                        {
                            continue;
                        }
                        hsLeagueNonLive.Add(leagueTemp.Split(',')[0], nameleagueTemp);
                        if (str_LeaugeSbo.IndexOf(nameleagueTemp) == -1)
                        {
                            str_LeaugeSbo += nameleagueTemp + ",";
                        }
                    }
                }

                string matchDataNonLive = "[" + Util.GetSubstringByString(DataOddSboNonLive, "]],[[", "]],[[") + "]";
                matchDataNonLive = matchDataNonLive.Replace("],[", "]\n[");
                hsMatchNonLive.Clear();
                foreach (string matchNonLive in matchDataNonLive.Split('\n'))
                {
                    string   matchTempNonLive     = matchNonLive.Replace("[", "").Replace("]", "").Replace("'", "");
                    string[] arr_matchTempNonLive = matchTempNonLive.Split(',');
                    string   idmatchNonLive       = Util.GetSubstringByStringLast(DataOddSboNonLive, "[", "," + arr_matchTempNonLive[0]);
                    try
                    {
                        hsMatchNonLive.Add(idmatchNonLive, hsLeagueNonLive[arr_matchTempNonLive[2]].ToString() + "," + arr_matchTempNonLive[3] + "," + arr_matchTempNonLive[4] + "," + arr_matchTempNonLive[7]);
                    }
                    catch
                    {
                        continue;
                    }
                    if (str_TeamSbo.IndexOf(UtilSoccer.ChuanTenTeam_Sbo(arr_matchTempNonLive[3])) == -1 || str_TeamSbo.IndexOf(UtilSoccer.ChuanTenTeam_Sbo(arr_matchTempNonLive[4])) == -1)
                    {
                        str_TeamSbo += UtilSoccer.ChuanTenTeam_Sbo(arr_matchTempNonLive[3]) + "-" + UtilSoccer.ChuanTenTeam_Sbo(arr_matchTempNonLive[4]) + ",";
                    }
                }

                string oddDataNonLive = "[[" + Util.GetSubstringByString(DataOddSboNonLive, ",,[[", "]]],,") + "]]]";
                foreach (string OddTempNonLive in oddDataNonLive.Split(new string[] { "]],[" }, StringSplitOptions.None))
                {
                    objMatch o           = new objMatch();
                    string   OddTemp     = OddTempNonLive.Replace("[", "").Replace("]", "").Replace("'", "");
                    string[] arr_OddTemp = OddTemp.Split(',');
                    string   infomatch   = "";
                    try
                    {
                        infomatch = hsMatchNonLive[arr_OddTemp[1]].ToString();
                    }
                    catch
                    {
                        continue;
                    }
                    o.LeaugeName = UtilSoccer.ChuanTenLeauge_Sbo(infomatch.Split(',')[0]);
                    o.HomeName   = UtilSoccer.ChuanTenTeam_Sbo(infomatch.Split(',')[1]);
                    o.AwayName   = UtilSoccer.ChuanTenTeam_Sbo(infomatch.Split(',')[2]);
                    if (Matchs.Contains(o.HomeName + "-" + o.AwayName) == false)
                    {
                        Matchs += o.HomeName + "-" + o.AwayName + ",";
                    }
                    o.TimeNonLive = infomatch.Split(',')[3];
                    if (DateTime.Parse(o.TimeNonLive) > TimeLimit.AddHours(1))
                    {
                        continue;
                    }
                    if (o.TimeNonLive.Split('/').Length == 1)
                    {
                        o.TimeNonLive = o.TimeLive;
                    }

                    o.IdKeo   = arr_OddTemp[0];
                    o.hdp     = UtilSoccer.formatkeo(arr_OddTemp[5]);
                    o.BetType = arr_OddTemp[2];
                    o.Odd1    = arr_OddTemp[6];
                    o.Odd2    = arr_OddTemp[7];

                    lst.Add(o);
                }
            }
            catch (Exception)
            {
                lst.Clear();
                return(lst);
            }
            TotalMatch = "SBO MATCH: " + (Matchs.Split(',').Length - 1).ToString();
            return(lst);
        }
예제 #28
0
    /// <summary>
    /// 将xml解析成list集合
    /// </summary>
    /// <returns>返回list集合</returns>
    public List <Matchs> TranList()
    {
        List <Matchs> list     = new List <Matchs>();
        XmlDocument   dom      = GetXmlData();
        XmlNodeList   nodelist = dom.SelectSingleNode("/xml").ChildNodes;

        foreach (XmlNode node in nodelist)//遍历xml节点
        {
            Matchs     matchs = new Matchs();
            XmlElement xe     = (XmlElement)node;//将子节点类型转换为xmlelement类型

            matchs.phase = int.Parse(xe.GetAttribute("phase"));
            string[] result    = xe.GetAttribute("result").ToString().Split(',');
            string   newresult = "";
            for (int i = 0; i < result.Length; i++)
            {
                if (i % 2 == 0)
                {
                    newresult += result[i] + "-";
                }
                else
                {
                    newresult += result[i] + ",";
                }
            }
            matchs.result = newresult.Substring(0, newresult.Length - 1);
            if (!String.IsNullOrEmpty(xe.GetAttribute("sale_start")) && !String.IsNullOrEmpty(xe.GetAttribute("sale_end")))
            {
                matchs.sale_start = DateTime.Parse(xe.GetAttribute("sale_start"));
                matchs.sale_end   = DateTime.Parse(xe.GetAttribute("sale_end"));
            }
            else
            {
                matchs.sale_start = null;
                matchs.sale_end   = null;
            }


            StringBuilder sbMatchs    = new StringBuilder();
            StringBuilder sbTeamHome  = new StringBuilder();
            StringBuilder sbTeamAway  = new StringBuilder();
            StringBuilder sbStartTime = new StringBuilder();
            StringBuilder sbScore     = new StringBuilder();

            foreach (XmlNode node2 in node)
            {
                foreach (XmlNode node3 in node2)
                {
                    XmlElement xe2 = (XmlElement)node3;
                    sbMatchs.Append(xe2.GetAttribute("match").ToString() + ",");
                    sbTeamHome.Append(xe2.GetAttribute("team_home").ToString() + ",");
                    sbTeamAway.Append(xe2.GetAttribute("team_away").ToString() + ",");
                    sbStartTime.Append(xe2.GetAttribute("start_time").ToString() + ",");
                    sbScore.Append(xe2.GetAttribute("score").ToString() + ",");
                }
            }

            matchs.matchs     = sbMatchs.ToString().TrimEnd(',');
            matchs.team_home  = sbTeamHome.ToString().TrimEnd(',');
            matchs.team_away  = sbTeamAway.ToString().TrimEnd(',');
            matchs.start_time = sbStartTime.ToString().TrimEnd(',');
            matchs.score      = sbScore.ToString().TrimEnd(',');

            list.Add(matchs);
        }
        return(list);
    }
예제 #29
0
        // GET: Clubs/Delete/5
        public ActionResult Delete(int id)
        {
            Matchs matchRemove = _db.Matchs.Find(id);

            return(View(matchRemove));
        }
예제 #30
0
        //[InlineData("2019/08/01", true)]
        public void Test_Date(string value, bool result)
        {
            _testOutputHelper.WriteLine(value);

            Matchs.IsMath(Dates.Date, value).ShouldBe(result);
        }