Esempio n. 1
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());
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
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());
        }