Beispiel #1
0
        public void AjouterAuPoule(infoJoueur j, int idPoule)
        {
            List <infoJoueur> lJoueur = new infoJoueur().GetListJoueur(idPoule);
            int cpt = 1;

            foreach (infoJoueur joueur in lJoueur)
            {
                if (j.matchGagné - j.matchPerdu > joueur.matchGagné - joueur.matchPerdu)
                {
                    joueur.position++;
                }
                else
                {
                    cpt++;
                }
            }
            j.position = cpt;
            DCJoueur dc = new DCJoueur();

            foreach (infoJoueur joueur in lJoueur)
            {
                dc.UpdateLD(joueur, idPoule);
            }
            dc.InsertLD(j, idPoule);
        }
        public ActionResult SupprimerJoueurPoule(int id, int idP, int idJ)
        {
            DCJoueur dc = new DCJoueur();

            dc.DeleteLD(idJ, idP);
            return(Redirect("~/Competition/InfoComp/" + id));
        }
Beispiel #3
0
        public String GetVainqueur()
        {
            DCJoueur dc  = new DCJoueur();
            DCEquipe dc2 = new DCEquipe();
            Joueur   j   = null;
            Equipe   e   = null;

            if (nbrJoueur == "Individuel")
            {
                j = dc.FindVainqueur(id);
                if (j != null)
                {
                    return(j.Identite);
                }
            }
            else if (nbrJoueur == "Equipe")
            {
                e = dc2.FindVainqueur(id);
                if (e != null)
                {
                    return(e.Nom);
                }
            }
            return("Pas de vainqueur désigné");
        }
Beispiel #4
0
        public ActionResult AjoutParticipant()
        {
            // Liste des participants de la compétition
            int                  idC              = Convert.ToInt32(Session["idComp"]);
            DCJoueur             dCJoueur         = new DCJoueur();
            Joueur               participant      = new Joueur();
            Joueur               joueur           = new Joueur();
            List <VMParticipant> listeParticipant = new List <VMParticipant>();

            foreach (Joueur j in participant.GetListJoueurComp(idC))
            {
                VMParticipant mParticipant = new VMParticipant();
                joueur                = dCJoueur.GetJoueur(j.Id);
                mParticipant.Id       = joueur.Id;
                mParticipant.Nom      = joueur.Nom;
                mParticipant.Prenom   = joueur.Prenom;
                mParticipant.National = joueur.National;
                mParticipant.Position = Convert.ToString(dCJoueur.GetPositionComp(joueur.Id, idC));
                if (mParticipant.Position == "100")
                {
                    mParticipant.Position = "Pas classé(e)";
                }
                listeParticipant.Add(mParticipant);
            }
            ViewBag.listeParticipant = listeParticipant;
            return(View());
        }
Beispiel #5
0
        public List <Joueur> GetListJoueurComp(int idC)
        {
            DCJoueur      dc = new DCJoueur();
            List <Joueur> j  = dc.findAllComp(idC);

            return(j);
        }
        public ActionResult AjoutJoueurPoule(int?joueur, int pos, int matchg, int matchp)
        {
            infoJoueur j = new infoJoueur {
                position = pos, matchGagné = matchg, matchPerdu = matchp, Id = Convert.ToInt32(joueur)
            };
            DCJoueur dc = new DCJoueur();

            dc.InsertLD(j, (int)Session["idPoule"]);
            Session["idPoule"] = null;
            return(Redirect("~/Competition/InfoComp/" + Session["idC"]));
        }
        public ActionResult ModifierJpoule(int idP, int idJ, int pos, int matchG, int matchP)
        {
            infoJoueur j = new infoJoueur
            {
                matchGagné = matchG,
                matchPerdu = matchP,
                position   = pos,
                Id         = Convert.ToInt32(idJ)
            };

            DCJoueur dc = new DCJoueur();

            dc.UpdateLD(j, idP);
            return(Redirect("~/Competition/InfoComp/" + Session["idC"]));
        }
        public ActionResult Joueur(int id)
        {
            DCJoueur joueur = new DCJoueur();
            Joueur   player = new Joueur();

            string[] ext    = new string[] { "jpg", "jpeg", "png", "gif" };
            string   file   = "";
            int      i      = 0;
            string   path   = "";
            bool     trouve = false;

            // Récupère les informations du joueur
            player = joueur.GetJoueur(id);
            ViewBag.dateNaissance = player.DateNaissance.ToString("dddd, le dd MMMM yyyy ");
            do
            {
                path = id + "." + ext[i];
                if (System.IO.File.Exists(@"C:\Inetpub\vhosts\default\htdocs\Content\image\" + path))
                {
                    file   = path;
                    trouve = true;
                }
                i++;
            } while (!trouve && i < ext.Length);
            ViewBag.photo = file;

            if (player.Sexe == 'f')
            {
                ViewBag.sexe = "Féminin";
            }
            else
            {
                ViewBag.sexe = "Masculin";
            }
            ViewBag.Joueur = player;
            // Récupère le palmarès civic du joueur
            PalmaresCivil palmares = new PalmaresCivil();

            ViewBag.listePalmaresCivic = palmares.GetListPalmaresCivic(id);

            // Récupéré le palmarès sportif du joueur
            PalmaresSportif palmaresSportif = new PalmaresSportif();

            ViewBag.palmaresSportif = palmaresSportif.GetList(id);
            return(View());
        }
Beispiel #9
0
        public ActionResult SupprimerParticipant(int idJ, int idC)
        {
            DCJoueur  dc  = new DCJoueur();
            DCPoule   dcP = new DCPoule();
            DCTournoi dcT = new DCTournoi();

            dc.DeletePart(idJ, idC);
            Competition comp = new Competition(idC);

            comp = comp.GetInformation();
            foreach (Poule p in comp.LPoule)
            {
                dcP.DeleteLD(idJ, p.Id);
            }
            if (comp.Tournoi != null)
            {
                dcT.DeleteLD(idJ, comp.Tournoi.Id);
            }
            return(Redirect("InfoComp/" + idC));
        }
Beispiel #10
0
        public ActionResult ListeJoueurs(string nom, int?pays, string sexe)
        {
            // Initialisation
            char          sex         = 'f';
            DCJoueur      joueur      = new DCJoueur();
            List <Joueur> listeJoueur = new List <Joueur>();

            nom             = HttpUtility.HtmlEncode(nom);
            ViewBag.alerte  = 0;
            ViewBag.Message = null;
            // Vérification du sexe
            if (sexe == "Masculin")
            {
                sex = 'm';
            }

            // Appel des listes de joueurs selon les attribut sélectionnés
            // 1) Nom est rempli
            if (nom != "")
            {
                // Pays remplis , sexe vide (Vérifier)
                if (pays != null && sexe == "")
                {
                    listeJoueur = joueur.GetJoueurByNameAndCountry(nom, pays);
                    if (listeJoueur.Count() != 0)
                    {
                        ViewBag.listeJoueur = listeJoueur;
                    }
                    else
                    {
                        return(Redirect("Index?error=Aucune information trouvée"));
                    }
                }
                // Pays vide , sexe remplis
                if (pays == null && sexe != "")
                {
                    listeJoueur = joueur.GetJoueurByNameAndSex(nom, sex);
                    if (listeJoueur.Count() != 0)
                    {
                        ViewBag.listeJoueur = listeJoueur;
                    }
                    else
                    {
                        return(Redirect("Index?error=Aucune information trouvée"));
                    }
                }
                // Pays remplis , sexe remplis (OK)
                if (pays != null && sexe != "")
                {
                    listeJoueur = joueur.GetJoueurByNameCountryAndSex(nom, pays, sex);
                    if (listeJoueur.Count() != 0)
                    {
                        ViewBag.listeJoueur = listeJoueur;
                    }
                    else
                    {
                        return(Redirect("Index?error=Aucune information trouvée"));
                    }
                }
                // Pays vide , sexe vide (OK)
                else
                {
                    listeJoueur = joueur.GetJoueur(nom);
                    if (listeJoueur.Count() != 0)
                    {
                        ViewBag.listeJoueur = listeJoueur;
                    }
                    else
                    {
                        return(Redirect("Index?error=Aucune information trouvée"));
                    }
                }
            }
            else // Nom est vide
            {
                // Pays non sélectionné et Sexe sélectionné
                if (pays == null && sexe != "")
                {
                    listeJoueur = joueur.GetJoueurBySex(sex);
                    if (listeJoueur.Count() != 0)
                    {
                        ViewBag.listeJoueur = listeJoueur;
                    }
                    else
                    {
                        return(Redirect("Index?error=Aucune information trouvée"));
                    }
                }
                // Pays sélectionné et Sexe non sélectionné
                if (pays != null && sexe == "")
                {
                    listeJoueur = joueur.GetJoueurByNation(pays);
                    if (listeJoueur.Count() != 0)
                    {
                        ViewBag.listeJoueur = listeJoueur;
                    }
                    else
                    {
                        return(Redirect("Index?error=Aucune information trouvée"));
                    }
                }
                // Pays sélectionné et Sexe sélectionné
                if (pays != null && sexe != "")
                {
                    listeJoueur = joueur.GetJoueurByNationAndSex(pays, sex);
                    if (listeJoueur.Count() != 0)
                    {
                        ViewBag.listeJoueur = listeJoueur;
                    }
                    else
                    {
                        return(Redirect("Index?error=Aucune information trouvée"));
                    }
                }
                if (pays == null && sexe == "") // Pays non sélectionné et Sexe non sélectionné
                {
                    return(Redirect("Index?error=Un choix minimum est requis"));
                }
            }
            return(View());
        }
Beispiel #11
0
        public List <Joueur> GetListPart()
        {
            DCJoueur dc = new DCJoueur();

            return(dc.findAllComp(id));
        }
Beispiel #12
0
        public List <infoJoueur> GetListJoueur(int id)
        {
            DCJoueur dc = new DCJoueur();

            return(dc.GetinfoPouleJoueur(id));
        }
Beispiel #13
0
        internal List <Joueur> GetListJoueur()
        {
            DCJoueur dc = new DCJoueur();

            return(dc.GetAllJoueur());
        }
Beispiel #14
0
 public void UpdateJoueur(int idJoueur, string nom, string prenom, DateTime dateNaiss, char sexe, int pays)
 {
     DataContext.DCJoueur dCJoueur = new DCJoueur();
     dCJoueur.UpdateJoueur(idJoueur, nom, prenom, dateNaiss, sexe, pays);
 }
Beispiel #15
0
 public void DeleteJoueur(int id)
 {
     DataContext.DCJoueur dCJoueur = new DCJoueur();
     dCJoueur.DeleteJoueur(id);
 }