Example #1
0
        public List <club> ReadClub()
        {
            List <club> liste = new List <club>();

            club club;

            type_club typec;


            using (connection)
            {
                connection.Open();
                string requete = "SELECT `id_club`,`Titre_club`,`url_club`,`Adresse_club`,`Code_Postal_club`,`Ville_club`,`mail_club`,`telephone_club`,libelle,type_club.id_type_club from club inner join type_club on club.id_type_club=type_club.id_type_club order by `id_club`";


                MySqlCommand cmd = new MySqlCommand(requete, connection);
                using (MySqlDataReader datareader = cmd.ExecuteReader())
                {
                    while (datareader.Read())
                    {
                        typec        = new type_club(Convert.ToInt32(datareader["id_type_club"]), (string)datareader["libelle"]);
                        club         = new club((string)datareader["Titre_club"], (string)datareader["url_club"], (string)datareader["Adresse_club"], (string)datareader["Code_Postal_club"], (string)datareader["Ville_club"], (string)datareader["mail_club"], Convert.ToInt32(datareader["telephone_club"]), typec);
                        club.id_club = Convert.ToInt32(datareader["id_club"]);

                        //typec.libelle = (string)datareader["libelle"];
                        //club.type.id_type = (int)datareader["id_type_club"];
                        liste.Add(club);
                    }
                }
            }
            return(liste);
        }
        public ActionResult ClubResultsUnR(int id, String sid, String SearchString)
        {
            var savedBooksTrue = (from clb in db.clubbooks
                                  where (clb.clubid == id) && (clb.isread == true)
                                  select clb).ToList();

            var savedBooksFalse = (from clb in db.clubbooks
                                   where (clb.clubid == id) && (clb.isread == false)
                                   select clb).ToList();

            var list = (from clb in db.clubbooks
                        where clb.clubid == id
                        select clb.gbid).ToArray();

            GenerateClubList(list).Wait();

            ViewBag.clubBooksRead   = savedBooksTrue;
            ViewBag.clubBooksToRead = savedBooksFalse;

            ViewBag.searched = sid;
            BookSearch(sid).Wait();



            club club = db.clubs.Find(id);

            return(View(club));
        }
Example #3
0
        public List <club> ReadClub()
        {
            List <club> liste = new List <club>();

            club club;

            type_club typec;


            using (connection) {
                connection.Open();
                string requete = "SELECT `C_id`,`C_nom`,`C_url`,`C_adresse`,`C_codepostal`,`C_ville`,`C_email`,`C_tel`,'T_libelle',type_club.T_id FROM club INNER JOIN type_club ON club.C_fk_type = type_club.T_id ORDER BY `C_id`";


                MySqlCommand cmd = new MySqlCommand(requete, connection);
                using (MySqlDataReader datareader = cmd.ExecuteReader()) {
                    while (datareader.Read())
                    {
                        typec = new type_club(Convert.ToInt32(datareader["T_id"]), (string)datareader["T_libelle"]);
                        club  = new club((string)datareader["C_nom"], (string)datareader["C_url"], (string)datareader["C_adresse"], (string)datareader["C_codepostal"], (string)datareader["C_ville"], (string)datareader["C_email"], Convert.ToInt32(datareader["C_tel"]), typec);
                        //Convert.ToInt32
                        club.id_club = Convert.ToInt32(datareader["C_id"]);

                        //typec.libelle = (string)datareader["libelle"];
                        //club.type.id_type = (int)datareader["id_type_club"];
                        liste.Add(club);
                    }
                }
            }
            return(liste);
        }
Example #4
0
 public ClubPage(club c, int sId)
 {
     NavigationPage.SetHasNavigationBar(this, false);
     InitializeComponent();
     clubId  = c.id;
     sportId = sId;
 }
Example #5
0
 private void btn_Club_Valid_Click(object sender, EventArgs e)
 {
     try
     {
         string Titre   = txt_Titre_Club.Text;
         string Url     = txt_Url_Club.Text;
         string CP      = txt_Cp_Club.Text;
         string Ville   = txt_Ville_CLub.Text;
         string adresse = txt_Adr_Club.Text;
         string Mail    = txt_Mail_Club.Text;
         string Tel     = txt_Tel_Club.Text;
         string type    = cbb_type_club.SelectedItem.ToString();
         if (Titre.Length != 0 && Url.Length != 0 && CP.Length != 0 && Ville.Length != 0 && adresse.Length != 0 && Mail.Length != 0 && Tel.Length != 0 & type.Length != 0)
         {
             club Nclub = new club(Titre, Url, adresse, CP, Ville, Mail, int.Parse(Tel), BDDC.RecupType(type));
             gest_club.ajouter_Club(Nclub);
             BDDC.ajouterClub(Nclub);
             MessageBox.Show("Ajout du club réussi", "ajout", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
         }
         else
         {
             MessageBox.Show("Veuillez remplir tous les champs", "champ(s) non rempli(s)", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch
     {
         MessageBox.Show("Vérifiez que vous avez entré un nom de club unique et que tous les champs sont remplis", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        /// <summary>
        /// Cette fonction permet de récuperer une liste d'évenement dans la BDD en l'associant à des instances de la classe : evenement
        /// </summary>
        /// <returns>Liste d'événements</returns>
        public List <evenement> ReadEvent()
        {
            List <evenement> Liste = new List <evenement>();
            club             club;
            type_club        typec;
            evenement        evenement;

            using (connection) {
                connection.Open();
                string       requete = "SELECT * FROM evenement JOIN club ON evenement.E_fk_club = club.C_id JOIN type_club ON club.C_fk_type = type_club.T_id";
                MySqlCommand cmd     = new MySqlCommand(requete, connection);
                using (MySqlDataReader datareader = cmd.ExecuteReader()) {
                    while (datareader.Read())
                    {
                        typec                  = new type_club(Convert.ToInt32(datareader["T_id"]), (string)datareader["T_libelle"]);
                        club                   = new club((string)datareader["C_id"], (string)datareader["C_url"], (string)datareader["C_adresse"], (string)datareader["C_codepostal"], (string)datareader["C_ville"], (string)datareader["C_email"], Convert.ToInt32(datareader["C_tel"]), typec);
                        club.id_club           = Convert.ToInt32(datareader["C_id"]);
                        evenement              = new evenement((string)datareader["E_nom"], (DateTime)datareader["E_datedeb"], (DateTime)datareader["E_datefin"], club);
                        evenement.id_evenement = Convert.ToInt32(datareader["E_id"]);
                        Liste.Add(evenement);
                    }
                }
            }
            return(Liste);
        }
Example #7
0
        public void insertClub(club club)
        {
            prueba_pabloEntities db = new prueba_pabloEntities();

            db.club.Add(club);
            db.SaveChanges();
        }
Example #8
0
        /// <summary>
        /// Cette fonction permet de récuperer une liste d'évenement dans la BDD en l'associant à des instances de la classe : evenement
        /// </summary>
        /// <returns>Liste d'événements</returns>
        public List <evenement> ReadEvent()
        {
            List <evenement> Liste = new List <evenement>();
            club             club;
            type_club        typec;
            evenement        evenement;

            using (connection)
            {
                connection.Open();
                string       requete = "SELECT * from evenement join club on evenement.id_club=club.id_club join type_club on club.id_type_club=type_club.id_type_club";
                MySqlCommand cmd     = new MySqlCommand(requete, connection);
                using (MySqlDataReader datareader = cmd.ExecuteReader())
                {
                    while (datareader.Read())
                    {
                        typec                  = new type_club(Convert.ToInt32(datareader["id_type_club"]), (string)datareader["libelle"]);
                        club                   = new club((string)datareader["Titre_club"], (string)datareader["url_club"], (string)datareader["Adresse_club"], (string)datareader["Code_Postal_club"], (string)datareader["Ville_club"], (string)datareader["mail_club"], Convert.ToInt32(datareader["telephone_club"]), typec);
                        club.id_club           = Convert.ToInt32(datareader["id_club"]);
                        evenement              = new evenement((string)datareader["Titre_evenement"], (DateTime)datareader["debut_evenement"], (DateTime)datareader["fin_evenement"], club);
                        evenement.id_evenement = Convert.ToInt32(datareader["id_evenement"]);
                        Liste.Add(evenement);
                    }
                }
            }
            return(Liste);
        }
Example #9
0
 public void agregar(club club)
 {
     if (_clubDal.getByDescripcion(club.descripcion) == null)
     {
         _clubDal.insertClub(club);
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            club club = db.clubs.Find(id);

            db.clubs.Remove(club);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #11
0
        public void deleteClub(club club)
        {
            prueba_pabloEntities db = new prueba_pabloEntities();

            db.club.Attach(club);
            db.club.Remove(club);
            db.SaveChanges();
        }
Example #12
0
        public void testclub()
        {
            type_club tc    = new type_club(20, "tennis");
            club      club  = new club("un club", "une url", "une adresse", "un CP", "une ville", "un mail", 012345679, tc);
            club      cluba = club;

            Assert.Equal("tennis", club.type.libelle);
            Assert.Equal(club, cluba);
            Assert.Equal("un club", cluba.Titre_club);
        }
Example #13
0
 public ActionResult Edit([Bind(Include = "id,Name,location,Description,Contact")] club club)
 {
     if (ModelState.IsValid)
     {
         db.Entry(club).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(club));
 }
Example #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClubManager nuevoClub = new ClubManager();
            club        nuevo     = new club()
            {
                nombre = "", descripcion = ""
            };

            nuevoClub.Save(nuevo);
        }
Example #15
0
      public ActionResult Create([Bind(Include = "id,Name,location,Description,Contact")] club club)
      {
          if (ModelState.IsValid)
          {
              db.clubs.Add(club);
              db.SaveChanges();
              return(RedirectToAction("Index"));
          }

          return(View(club));
      }
 public ActionResult Edit([Bind(Include = "clubid,clubname,members,creator,admins,booksread,bookstoread,meetings")] club club)
 {
     if (ModelState.IsValid)
     {
         db.Entry(club).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.members = new SelectList(db.users, "userid", "fullname", club.members);
     return(View(club));
 }
 public void AjouterUnClub(club Unclub, adherent UnAdh)
 {
     using (connection) {
         connection.Open();
         string       requete = "UPDATE `adherent` SET `C_id` = @idC WHERE `adherent`.`A_id`= @idA";
         MySqlCommand cmd     = new MySqlCommand(requete, connection);
         cmd.Parameters.AddWithValue("@idA", UnAdh.Id);
         cmd.Parameters.AddWithValue("@idC", Unclub.id_club);
         cmd.ExecuteNonQuery();
     }
 }
        public ActionResult Cheer(int id)
        {
            club clubCheer     = db.clubs.Find(id);
            int? currentCheers = clubCheer.Cheer;

            clubCheer.Cheer = currentCheers + 1;
            if (ModelState.IsValid)
            {
                db.Entry(clubCheer).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(PartialView("_TableRow", clubCheer));
        }
        public ActionResult _TableRow(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            club club = db.clubs.Find(id);

            if (club == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(club));
        }
Example #20
0
        public List <club> GetFilteredClubs(int sportsId)
        {
            var cs    = Services.ContentService;
            var clubs = cs.GetRootContent();

            List <club> filteredClubs = new List <club>();
            bool        status        = false;

            foreach (var club in clubs)
            {
                if (club.ContentTypeId == 1073)
                {
                    var teams = cs.GetChildren(club.Id);

                    foreach (var team in teams)
                    {
                        status = false;

                        if (team.ContentTypeId == 1074)
                        {
                            var s = (team.Properties["typeOfSport"].Value.ToString() != null) ? this.GetSport(team.Properties["typeOfSport"].Value.ToString()) : null;

                            if (s.id == sportsId)
                            {
                                status = true;
                                break;
                            }
                        }
                    }

                    if (status == true)
                    {
                        var c = new club();
                        c.id   = club.Id;
                        c.name = club.Name;
                        try
                        {
                            c.clubImage = this.GetImg(club.Properties["clubLogo"].Value.ToString());
                        }
                        catch
                        {
                            c.clubImage = "";
                        };
                        filteredClubs.Add(c);
                    }
                }
            }

            return(filteredClubs);
        }
        public ActionResult Edit([Bind(Include = "id,Name,Established,Country,CurrentCoach,Video,Cheer,Logo,Trophies,ClubHomepage,Stadium,Capacity,NotablePlayers,Rivalries")] club club)
        {
            if (club.Logo == null)
            {
                club.Logo = "https://www.shareicon.net/data/2015/10/20/130824_exit_256x256.png";
            }

            if (ModelState.IsValid)
            {
                db.Entry(club).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(club));
        }
        // GET: clubs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            club club = db.clubs.Find(id);

            if (club == null)
            {
                return(HttpNotFound());
            }
            ViewBag.members = new SelectList(db.users, "userid", "fullname", club.members);
            return(View(club));
        }
Example #23
0
        public void testnbradh()
        {
            type_club tc       = new type_club(20, "tennis");
            club      club     = new club("un club", "une url", "une adresse", "un CP", "une ville", "un mail", 012345679, tc);
            adherent  adhtest  = new adherent("Bertrand", "jean", "92130", "6 squares louis blé", "Issy-les-mx");
            adherent  adhtest1 = new adherent("Bertrand", "Paul", "92130", "6 squares louis blé", "Issy-les-mx");
            adherent  adhtest2 = new adherent("Bertrand", "Romain", "92130", "6 squares louis blé", "Issy-les-mx");

            adhtest2.Id = 28;
            adherent adhtest3 = new adherent("Bertrand", "Romain", "92130", "6 squares louis blé", "Issy-les-mx");

            adhtest3.Id = 28;
            club.AjouterClubAdh(adhtest);
            club.AjouterClubAdh(adhtest3);
            club.AjouterClubAdh(adhtest2);
            Assert.Equal(2, club.adherents.Count);
        }
Example #24
0
        public void ajouterClub(club UnClub)
        {
            using (connection) {
                connection.Open();
                string       requete = "INSERT INTO `club` (`C_id`, `C_nom`, `C_url`, `C_adresse`, `C_codepostal`, `C_ville`, `C_email`, `C_tel`, `C_fk_type`) VALUES(NULL, @titre,@url,@adresse,@cp,@ville,@mail,@tel,@type)";
                MySqlCommand cmd     = new MySqlCommand(requete, connection);
                cmd.Parameters.AddWithValue("@titre", UnClub.Titre_club);
                cmd.Parameters.AddWithValue("@url", UnClub.url_club);
                cmd.Parameters.AddWithValue("@adresse", UnClub.Adresse_club);
                cmd.Parameters.AddWithValue("@cp", UnClub.Code_Postal);
                cmd.Parameters.AddWithValue("@ville", UnClub.Ville);
                cmd.Parameters.AddWithValue("@mail", UnClub.mail_club);

                cmd.Parameters.AddWithValue("@tel", UnClub.telephone_club);
                cmd.Parameters.AddWithValue("@type", UnClub.type.id_type);
                cmd.ExecuteNonQuery();
            }
        }
Example #25
0
        public void modifier_club(club UnClub)
        {
            using (connection) {
                connection.Open();
                string       requete = "UPDATE `club` SET `C_nom` = @titre, `C_url` = @url, `C_adresse` = @adresse, `C_codepostal` = @cp, `C_ville` = @ville, `C_email` = @mail, `C_tel` = @tel WHERE `club`.`C_id` = @idc";
                MySqlCommand cmd     = new MySqlCommand(requete, connection);
                cmd.Parameters.AddWithValue("@titre", UnClub.Titre_club);
                cmd.Parameters.AddWithValue("@url", UnClub.url_club);
                cmd.Parameters.AddWithValue("@adresse", UnClub.Adresse_club);
                cmd.Parameters.AddWithValue("@cp", UnClub.Code_Postal);
                cmd.Parameters.AddWithValue("@ville", UnClub.Ville);
                cmd.Parameters.AddWithValue("@mail", UnClub.mail_club);

                cmd.Parameters.AddWithValue("@tel", UnClub.telephone_club);
                cmd.Parameters.AddWithValue("@idc", UnClub.id_club);
                cmd.ExecuteNonQuery();
            }
        }
Example #26
0
        public List <adherent> Readadherent()
        {
            List <adherent> liste = new List <adherent>();

            adherent  adhérents;
            club      club;
            type_club type;


            using (connection)
            {
                connection.Open();
                string requete = "select * from adherent left join club on adherent.id_club=club.id_club left join type_club on club.id_type_club = type_club.id_type_club order by adherent.id_adherent";


                MySqlCommand cmd = new MySqlCommand(requete, connection);
                using (MySqlDataReader datareader = cmd.ExecuteReader())
                {
                    while (datareader.Read())
                    {
                        adhérents = new adherent((string)datareader["Nom_adherent"], (string)datareader["Prenom_adherent"], (string)datareader["Code_Postal_adherent"], (string)datareader["Adresse_adherent"], (string)datareader["Ville_adherent"]);

                        adhérents.DateNaissance = (DateTime)datareader["Date_naissance_adherent"];
                        adhérents.Id            = (int)datareader["id_adherent"];


                        if (datareader["id_club"] != System.DBNull.Value && datareader["numero_licence"] != System.DBNull.Value)
                        {
                            type = new type_club(Convert.ToInt32(datareader["id_type_club"]), (string)datareader["libelle"]);
                            club = new club((string)datareader["Titre_club"], (string)datareader["url_club"], (string)datareader["Adresse_club"], (string)datareader["Code_Postal_club"], (string)datareader["Ville_club"], (string)datareader["mail_club"], Convert.ToInt32(datareader["telephone_club"]), type);
                            adhérents.numero_licence = Convert.ToInt32(datareader["numero_licence"]);
                            adhérents.Cotisation     = Convert.ToInt32(datareader["cotisation_adherent"]);
                            adhérents.club           = club;
                        }



                        liste.Add(adhérents);
                    }
                }
            }
            return(liste);
        }
Example #27
0
        public int Nombredadh(club club)
        {
            int Nbr = 0;

            using (connection) {
                connection.Open();
                string       requete = "SELECT count(A_id) AS Nbr FROM adherent WHERE adherent.A_id=@id";
                MySqlCommand cmd     = new MySqlCommand(requete, connection);
                cmd.Parameters.AddWithValue("@id", club.id_club);
                using (MySqlDataReader datareader = cmd.ExecuteReader()) {
                    while (datareader.Read())
                    {
                        Nbr = Convert.ToInt32(datareader["Nbr"]);
                    }
                }
            }

            return(Nbr);
        }
        public ActionResult Create([Bind(Include = "clubid,clubname,creator,admins,description")] club club)
        {
            club.creator = (int)Session["userid"];
            if (ModelState.IsValid)
            {
                db.clubs.Add(club);

                member m = new member();
                m.clubid = club.clubid;
                m.userid = (int)Session["userid"];
                db.members.Add(m);

                db.SaveChanges();
                return(RedirectToAction("Details", "clubs", new { id = club.clubid }));
            }

            ViewBag.members = new SelectList(db.users, "userid", "fullname", club.members);
            return(View(club));
        }
Example #29
0
        public int Nombreevenement(club club)
        {
            int Nbr = 0;

            using (connection)
            {
                connection.Open();
                string       requete = "call compterevent(@id)";
                MySqlCommand cmd     = new MySqlCommand(requete, connection);
                cmd.Parameters.AddWithValue("@id", club.id_club);
                using (MySqlDataReader datareader = cmd.ExecuteReader())
                {
                    while (datareader.Read())
                    {
                        Nbr = Convert.ToInt32(datareader["nbrE"]);
                    }
                }
            }

            return(Nbr);
        }
        // GET: clubs/Details/5
        public ActionResult Details(int?id, String SearchString)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var savedBooksTrue = (from clb in db.clubbooks
                                  where (clb.clubid == id) && (clb.isread == true)
                                  select clb).ToList();

            var savedBooksFalse = (from clb in db.clubbooks
                                   where (clb.clubid == id) && (clb.isread == false)
                                   select clb).ToList();

            var list = (from clb in db.clubbooks
                        where clb.clubid == id
                        select clb.gbid).ToArray();

            GenerateClubList(list).Wait();

            ViewBag.clubBooksRead   = savedBooksTrue;
            ViewBag.clubBooksToRead = savedBooksFalse;

            club club = db.clubs.Find(id);

            if (club == null)
            {
                return(HttpNotFound());
            }

            if (SearchString != null)
            {
                return(RedirectToAction("ClubResults", new { id = id, sid = SearchString }));
            }
            else
            {
                return(View(club));
            }
        }