Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //Récupération de tous les adhérents et affichage dans une listView qui a pour nom listViewAdherents
            AdherentDB adhDB = new AdherentDB();
            List<Adherent> lesAdherents = adhDB.GetAllAdherent();

            foreach (var item in lesAdherents)
            {

                ListViewItem listItem = new ListViewItem(item.GetNom());
                listItem.SubItems.Add(item.GetPrenom());
                listItem.SubItems.Add(item.GetVille());
                listItem.SubItems.Add(item.GetCodePostal());
                listItem.SubItems.Add(item.GetDateDeNaissance().ToShortDateString());
                listItem.SubItems.Add(item.GetTypeAdherent().Libelle);

                listViewAdherents.Items.Add(listItem);

            }
            //Exemple de création d'un nouvel adhérent (avec des données en dur) dans la base.
            //On doit récupérer le type d'adhésion pour pouvoir créer l'adhérent.
            TypeAdhesionDB typeDB = new TypeAdhesionDB();
            TypeAdhesion t = typeDB.GetTypeAdhesion(1);
            Adherent a = new Adherent("tom", "tim", "445", "Paris", new DateTime(1980, 5, 6), t);
            adhDB.Save(a);

            //Modification de la ville d'un adhérent
            Adherent a1 = adhDB.GetAdherent(6);
            a1.SetVille("NY");
            adhDB.Save(a1);
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            List<Adherent> lesAdherents = Adherent.GetAllAdherent();

            //Exemple d'affichage dans une listView. La listView s'appelle listViewAdherent.
            foreach (var item in lesAdherents)
            {

                ListViewItem listItem = new ListViewItem(item.GetNom());
                listItem.SubItems.Add(item.GetPrenom());
                listItem.SubItems.Add(item.GetVille());
                listItem.SubItems.Add(item.GetCodePostal());
                listItem.SubItems.Add(item.GetDateDeNaissance().ToShortDateString());

                listViewAdherents.Items.Add(listItem);

            }

            //Exemple de création d'un nouvel adhérent dans la base
            Adherent unNouvelAdherent = new Adherent("Ryan", "Giggs", "4675", "Manchester", new DateTime(1960, 5, 6), 1);
            unNouvelAdherent.Save();

            //Exemple de modification d'un adhérent dans la base. On modifie l'adhérent avec un id de 6
            Adherent adherentModification = Adherent.GetAdherent(6);
            adherentModification.SetVille("Tottenham");
            adherentModification.Save();
        }
Example #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int dateNissance = Calendar1.SelectedDate.Year;


       

            //SqlDataSource1



            using (associationEntities1 bdd = new associationEntities1())
            {


                List<Adherent> ListAdr = new List<Adherent>();

                 var Result3 = from p in bdd.Adherent join q in bdd.Cotisation on p.IDAdherent equals q.IDAdherent
                               where q.AnneeCotis == dateNissance.ToString()
               select new {Nom=p.Nom, Prenom = p.Prenom, Genre=p.Genre, Naissance = p.Naissance,Photo = p.Photo, SituatFam = p.SituatFam, VilOrig= p.VilOrig, 
                    };
 


                   List<Adherent> listeAdherent = new List<Adherent>();

                   foreach (var item in Result3)
                   {
                       Adherent adr = new Adherent();

                       adr.Nom = item.Nom;
                       adr.Prenom = item.Prenom;
                       adr.Genre = item.Genre;
                       adr.Naissance = item.Naissance;
                       adr.Photo = item.Photo;
                       adr.SituatFam = item.SituatFam;
                       adr.VilOrig = item.VilOrig;


                       listeAdherent.Add(adr);
                   }



                   GridView1.DataSource = listeAdherent;
                GridView1.DataBind();









            }

        }
Example #4
0
    public void Respawn(Fountain fount) {
        parent = null;
        transform.SetParent(fount.gameObject.transform);
        transform.localPosition = new Vector3(1, 0, 0);
        transform.localEulerAngles = new Vector3(1, 0, 0);
        transform.SetParent(null);
        m_StartPos = transform.position;
        m_EndPos = fount.respawnPointPrefab.transform.position;

        StartCoroutine ("Animate");
    }
Example #5
0
 public void Ajouter(Adherent ad)
 {
     using (IUnitOfWork uow = BeginTransaction())
     {
         //Adherent ad = depotAdherents.Read(idAdherent);
         if (ad == null)
         {
             throw new Exception("Ne peut pas ajouter un adherent null.");
         }
         depotAdherents.Create(ad);
         uow.Commit();
     }
 }
Example #6
0
        /// <summary>
        /// Constructeur pour le mode édition. On doit passer par l'id pour récupérer l'adhérent car on a changé de contexte.
        /// </summary>
        /// <param name="idAdherent">ID de l'adhérent à éditer</param>
        public FormulaireAdherentVM(Guid idAdherent)
        {
            this.UCParentCode = CodesUC.ConsultationAdherents;
            this.IsEditMode   = true;

            this.CreateRepositories();
            this.PopulateCombos();

            this.CurrentAdherent = this.repoAdherent.GetByKey(idAdherent);

            this.CreateSaveAndJoinCommand();
            Messenger.Default.Register <NMRefreshDatas>(this, m => this.PopulateCombos());
        }
        public void ModifierAdherentSucces()
        {
            adherent.Nom = "Test Modifier";
            serviceAdherents.Modifier(adherent.Id);

            using (ISession session = sessionFactory.OpenSession())
            {
                Adherent ad = session.Get <Adherent>(adherent.Id);
                Assert.IsNotNull(ad);
                Assert.AreEqual(adherent.Id, ad.Id);
                Assert.AreEqual("Test Modifier", ad.Nom);
            }
        }
Example #8
0
 public void Modifier(int idAdherent)
 {
     using (IUnitOfWork uow = BeginTransaction())
     {
         Adherent ad = depotAdherents.Read(idAdherent);
         if (ad == null)
         {
             throw new Exception("Ne peut pas modifier un adherent avec null.");
         }
         depotAdherents.Update(ad);
         uow.Commit();
     }
 }
Example #9
0
    //performs the actual adherence
    void Adhere(Adherent other)
    {
        FixedJoint joint = gameObject.AddComponent <FixedJoint>();

        joint.connectedBody = other.GetBody();
        if (!indestructibleJoints)
        {
            joint.breakForce  = jointStrength;
            joint.breakTorque = jointStrength;
        }
        attachedObjects.Add(other, joint);
        print("Adhering to " + other);
    }
        /// <summary>
        /// Création des adhérents en dur pour simuler une base de données
        /// </summary>
        /// <returns>La liste des adhérents</returns>
        public static List <Adherent> CreationListe()
        {
            List <Adherent> LesAdherents = new List <Adherent>();
            Adherent        a1           = new Adherent(1, "Durand", "Jean", new DateTime(2016, 5, 5));
            Adherent        a2           = new Adherent(4, "Martin", "Louis", new DateTime(2016, 6, 6));
            Adherent        a3           = new Adherent(5, "Wang", "Pierre", new DateTime(2016, 7, 9));

            LesAdherents.Add(a1);
            LesAdherents.Add(a2);
            LesAdherents.Add(a3);

            return(LesAdherents);
        }
Example #11
0
 public void Modifier(int idAdherent)
 {
     using (IUnitOfWork uow = BeginTransaction())
     {
         Adherent adherent = depotAdherents.Read(idAdherent);
         if (adherent == null)
         {
             throw new Exception("Impossible de modifier, l'adherent n'a pas été trouvé !");
         }
         depotAdherents.Update(adherent);
         uow.Commit();
     }
 }
Example #12
0
 //Begin the process of modifying a new member
 private void BtnModifyAdherent_Click(object sender, EventArgs e)
 {
     adherent = FindAdherent(adherentIDTextBox.Text);
     if (adherent == null)
     {
         MessageBox.Show(" Choississez un adhérent existant à modifier", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     MessageBox.Show("Veuillez saisir les données à modifier puis cliquez sur Valider", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
     adherentIDTextBox.Enabled = false;
     nomTextBox.Enabled        = true;
     prenomTextBox.Enabled     = true;
     btnValidateModify.Enabled = true;
 }
Example #13
0
        private Adherent ChargerDonnees(SqlDataReader rd)
        {
            Adherent adherent = new Adherent
            {
                AdherentID = rd["IdAdherent"].ToString(),
                Nom        = rd["NomAdherent"].ToString(),
                Prenom     = rd["PrenomAdherent"] ==
                             DBNull.Value ? string.Empty : rd["PrenomAdherent"].ToString()
                             // Prenom = rd["PrenomAdherent"]?.ToString
            };

            return(adherent);
        }
Example #14
0
 public Adherents()
 {
     InitializeComponent();
     UserErrors    = new BindingList <string>();
     currentSeance = new Seance();
     currentAdh    = new Adherent();
     // Disable Code Adhérant
     CodeAdhTB.Enabled    = false;
     CodeAdhIcon.Enabled  = false;
     CodeAdhPanel.Enabled = false;
     // Initialize Sexe CB
     SexeCB.SelectedIndex = 0;
 }
Example #15
0
 //Validate and modifying the member
 private void BtnValidateModify_Click(object sender, EventArgs e)
 {
     adherent = FindAdherent(adherentIDTextBox.Text);
     if (string.IsNullOrEmpty(nomTextBox.Text) || string.IsNullOrEmpty(prenomTextBox.Text))
     {
         error.SetError(nomTextBox, "Saisir un Nom");
         error.SetError(prenomTextBox, "Saisir un Prenom");
     }
     adherent.Nom    = nomTextBox.Text;
     adherent.Prenom = prenomTextBox.Text;
     AdherentDAO.Instance.Update(adherent);
     adherentBindingSource.ResetBindings(false);
 }
Example #16
0
        // GET: Adherents/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Adherent adherent = await _applicationDbContext.Adherents.FindAsync(id);

            if (adherent == null)
            {
                return(HttpNotFound());
            }
            return(View(adherent));
        }
Example #17
0
        private void adherents_Load(object sender, EventArgs e)
        {
            // disable form for input security control
            formEnabled(false);

            // Get all adherent from the db and bind them to the data source
            using (ClubDbContext context = new ClubDbContext())
            {
                adherentBindingSource.DataSource = context.Adherents.ToList();
                seanceBindingSource.DataSource   = context.Seances.ToList();
            }
            currentAdh    = adherentBindingSource.Current as Adherent;
            currentSeance = seanceBindingSource.Current as Seance;
        }
Example #18
0
        public async Task <IActionResult> ChangeUserInformations()
        {
            var user = await GetCurrentAppUserAsync();

            Adherent adherent = _context.Adherents.Single(x => x.Email == user.Email);

            if (adherent == null)
            {
                return(NotFound());
            }
            IList <string> roles = await _userManager.GetRolesAsync(user);

            return(View(new AdherentViewModel()));
        }
        public ActionResult Create()
        {
            var livresPretes   = from l in db.prets select l.leLivrePrete;
            var livreNonPretes = from l in db.livres where !livresPretes.Contains(l) select l;

            var             adherentAutorisable = from a in db.adherents where a.pretsEnCours.Count == 3 select a;
            List <Adherent> adherentAutorise    = adherentAutorisable.ToList <Adherent>();

            List <Adherent> adhWithDepas = new List <Adherent>();
            var             listpret     = from p in db.prets select p;
            List <Pret>     listprets    = listpret.ToList <Pret>();

            var             listAdherents = from a in db.adherents select a;
            List <Adherent> listAdherent  = listAdherents.ToList <Adherent>();


            foreach (Pret pr in listprets)
            {
                Adherent d = db.adherents.Find(pr.AdherentID);
                if (DateTime.Compare(pr.getDateRetour().Date, DateTime.Now.Date) < 0)
                {
                    adhWithDepas.Add(d);
                    listAdherent.Remove(d);
                }
            }
            foreach (Adherent d in adherentAutorise)
            {
                listAdherent.Remove(d);
            }



            var             list  = adhWithDepas.GroupBy(x => x.ID).Select(y => y.First());
            List <Adherent> lista = list.ToList <Adherent>();

            lista.Union(adherentAutorise);



            if (livreNonPretes.Count() == 0 || listAdherent.Count() == 0)
            {
                System.Windows.Forms.MessageBox.Show("Pas de livre à pêter ou d'emprunteur autorisé");
                return(RedirectToAction("Index"));
            }

            ViewBag.AdherentID = new SelectList(listAdherent, "ID", "nom");
            ViewBag.LivreID    = new SelectList(livreNonPretes, "ID", "titre");

            return(View());
        }
Example #20
0
        private static void AddAbonnement(ApplicationDbContext context, Adherent adh, Formule formule)
        {
            DateTime dtStart = Lorem.DateTime(formule.Activite.DateDebut, formule.Activite.DateFin);

            adh.Abonnements.Add(new Abonnement
            {
                AdherentId       = adh.AdherentId,
                DateCreation     = dtStart,
                DateModification = Lorem.DateTime(dtStart, formule.Activite.DateFin),
                TypeReglement    = Lorem.Enum <TypeReglement>(),
                FormuleId        = formule.FormuleId,
                Formule          = formule
            });
        }
Example #21
0
        /// <summary>
        /// Insère dans la base un emprunt pour l'exemplaire et l'adhérent spécifiés à la date d'aujourd'hui.
        /// </summary>
        /// <param name="adherent"></param>
        /// <param name="exemplaire"></param>
        public static void Inserer(Adherent adherent, Exemplaire exemplaire)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.AddWithValue("@NumAdherent", adherent.Numero);
            cmd.Parameters.AddWithValue("@NumExemplaire", exemplaire.Numero);
            //cmd.Parameters.AddWithValue("@DatEmprunt", DateTime.Now);
            cmd.Parameters.AddWithValue("@DatRestitutionPrev", DateTime.Now + Emprunt.DUREE_MAXIMALE);
            cmd.CommandText = @"INSERT INTO Emprunt (numAdherent, numExemplaire, datEmprunt, datRestitutionPrev, datRestitutionEff)
                                VALUES(@NumAdherent, @NumExemplaire, GETDATE(), @DatRestitutionPrev, NULL);";
            BaseDeDonnees.Executer(cmd);
            exemplaire.Disponible = false;
            Exemplaire.MettreAJour(exemplaire);
        }
Example #22
0
        // GET: Adherents/Create
        public ActionResult Create(int?idAdherent)
        {
            Adherent adherent = db.Adherents.Find(idAdherent);

            if (idAdherent != null && adherent.Responsable == true)
            {
                ViewBag.IdAssociation = new SelectList(db.Associations, "IdAssociation", "Nom");
                return(View());
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }
        }
Example #23
0
        // GET: Adherents/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Adherent adherent = db.Adherents.Find(id);

            if (adherent == null)
            {
                return(HttpNotFound());
            }
            return(View(adherent));
        }
Example #24
0
        /// <summary>
        /// Constructeur pour le mode création
        /// </summary>
        public FormulaireAdherentVM()
        {
            this.UCParentCode = CodesUC.ConsultationAdherents;
            this.IsEditMode   = false;

            this.CreateRepositories();
            this.PopulateCombos();

            this.CurrentAdherent = new Adherent();
            this.CurrentAdherent.DateNaissance = DateTime.Now;

            this.CreateSaveAndJoinCommand();
            Messenger.Default.Register <NMRefreshDatas>(this, m => this.PopulateCombos());
        }
Example #25
0
        // GET: HistoriquePaiements
        public ActionResult Index(int?idAdherent)
        {
            Adherent adherent = db.Adherents.Find(idAdherent);

            if (idAdherent != null && adherent.Responsable == true)
            {
                var historiquePaiements = db.HistoriquePaiements.Include(h => h.Adherent).Include(h => h.Association).Include(h => h.Sortie).Where(h => h.IdAssociation == adherent.IdAssociation && h.Statut == true);
                return(View(historiquePaiements.ToList()));
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }
        }
        public void AjouterAdherentSucces()
        {
            Adherent newAdherent = new Adherent()
            {
                Nom = "Test Ajout"
            };

            serviceAdherents.Ajouter(newAdherent);
            using (ISession session = sessionFactory.OpenSession())
            {
                Adherent ad = session.Get <Adherent>(newAdherent.Id);
                Assert.IsNotNull(ad);
                Assert.AreEqual(ad.Id, newAdherent.Id);
            }
        }
Example #27
0
        public ActionResult MesSorties()
        {
            Adherent adherent = (Adherent)Session["Adherent"];

            if (adherent != null)
            {
                var mesSorties = db.SortieAdherents.Where(sa => sa.IdAdherent == adherent.IdAdherent).ToList();
                return(View(mesSorties));
            }

            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }
        }
Example #28
0
        private void buttonModifierAdherent_Click(object sender, EventArgs e)
        {
            if (listBoxAdherents.Items.Count == 0)
            {
                return;
            }
            Adherent ad = adherents[listBoxAdherents.SelectedIndex];

            if (myformModifierAdherent == null)
            {
                myformModifierAdherent             = new FenetreModifierAdherent(serviceAdherents, ad);
                myformModifierAdherent.FormClosed += new FormClosedEventHandler(OnMyFormClosed);
                myformModifierAdherent.ShowDialog();
            }
        }
Example #29
0
 void CreateFixtures()
 {
     adherent = new Adherent {
         Nom = "Mario Rossi"
     };
     ouvrage = new Ouvrage {
         Titre = "Il grande Gatsby", Auteur = "F. S. Fitzgerald"
     };
     exemplaire1 = new Exemplaire {
         Ouvrage = ouvrage, Etat = "Nuovo"
     };
     exemplaire2 = new Exemplaire {
         Ouvrage = ouvrage, Etat = "Usato"
     };
 }
Example #30
0
        // GET: Adherents/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Adherent adherent = db.Adherents.Find(id);

            if (adherent == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdAssociation = new SelectList(db.Associations, "IdAssociation", "Nom", adherent.IdAssociation);
            return(View(adherent));
        }
Example #31
0
 public void SetUp()
 {
     adherent = new Adherent {
         Id = 1, Nom = "Mario Rossi"
     };
     ouvrage = new Ouvrage {
         Id = 1, Titre = "Il grande Gatsby", Auteur = "F. S. Fitzgerald"
     };
     exemplaire1 = new Exemplaire {
         Id = 1, Ouvrage = ouvrage, Etat = "Nuovo"
     };
     exemplaire2 = new Exemplaire {
         Id = 2, Ouvrage = ouvrage, Etat = "Usato"
     };
 }
Example #32
0
        // Delete Adherent
        private async void SupprimerBtn_Click(object sender, EventArgs e)
        {
            // Get current adherent
            Adherent adhToRemove = adherentBindingSource.Current as Adherent;

            // Get adherent to remove from db
            try
            {
                using (ClubDbContext context = new ClubDbContext())
                {
                    var userToDelete = context.Users
                                       .Include(u => u.Adherent)
                                       .SingleOrDefault(u => u.AdherentId == adhToRemove.CodeAdh);
                    var correspondingAdherent = context.Adherents
                                                .Include(u => u.PreferredActivities)
                                                .Include(u => u.Seances)
                                                .SingleOrDefault(a => a.CodeAdh == adhToRemove.CodeAdh);
                    var prefActivities = correspondingAdherent.PreferredActivities.ToList();
                    foreach (var act in prefActivities)
                    {
                        correspondingAdherent.PreferredActivities.Remove(act);
                    }
                    var seances = correspondingAdherent.Seances.ToList();
                    foreach (var seance in seances)
                    {
                        correspondingAdherent.Seances.Remove(seance);
                    }
                    context.Adherents.Remove(correspondingAdherent);
                    context.SaveChanges();
                    context.Users.Remove(userToDelete);
                    context.SaveChanges();
                }
                adherents_Load(sender, e);
            }
            catch (ArgumentNullException ex)
            {
                MetroFramework.MetroMessageBox.Show(this,
                                                    "Aucun adhérent n'est séléctionnée ou bien la" +
                                                    " base de données est vide.",
                                                    "Pas d'adhérent séléctionné",
                                                    MessageBoxButtons.OK,
                                                    MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #33
0
        public void TestAdherent()
        {
            DateTime date         = new DateTime(1999, 12, 12);
            League   tennisLeague = new League(20, "tennis");
            Club     club         = new Club("un club", "une adresse", "un CP", "une ville", "un mail", "012345679", tennisLeague);
            Adherent adhtest      = new Adherent("Bertrand", "Jean", "92130", "6 square Louis Blé", "Issy-les-mx", date, 150, club);

            Assert.AreEqual("Bertrand", adhtest.LastName);
            Assert.AreEqual("Jean", adhtest.FirstName);
            Assert.AreEqual("92130", adhtest.ZipCode);
            Assert.AreEqual("6 square Louis Blé", adhtest.Address);
            Assert.AreEqual("Issy-les-mx", adhtest.City);
            Assert.AreEqual(date, adhtest.BirthDate);
            Assert.AreEqual(150, adhtest.Subscription);
            Assert.AreEqual(club, adhtest.Club);
        }
Example #34
0
        public async Task <IActionResult> Index()
        {
            Adherent stolonsUser = await this.GetCurrentAdherentAsync();

            List <ProducerBill> bills = new List <ProducerBill>();

            _context.ProducerBills
            .Include(x => x.AdherentStolon)
            .Include(x => x.AdherentStolon.Adherent)
            .Include(x => x.AdherentStolon.Stolon)
            .Where(x => x.AdherentStolon.Adherent.Email == stolonsUser.Email)
            .AsNoTracking()
            .ToList()
            .ForEach(x => bills.Add(x));
            return(View(bills));
        }
Example #35
0
    public void notifyOfAdherentRemove(Adherent adherent, Fountain fount) {
        if (m_intersectionAdherents == null) {
            return;
        }

        for (int i=0; i < m_intersectionAdherents.Count; ++i) {
            WeakReference obj = m_intersectionAdherents[i];
            if (obj.IsAlive && adherent == (Adherent)obj.Target) {
                m_intersectionAdherents.Remove(obj);
                break;
            }
        }

        if (m_intersectionAdherents.Count == 0) {
            Respawn(fount);
        }
    }
Example #36
0
	void OnTriggerEnter2D (Collider2D other) {
		switch (other.gameObject.tag) {
		case "Follower":
			if (Pos.x == -2f) {
				parent = (other.gameObject.GetComponentInParent<Adherent> ()).attach ();
			}
			break;
		case "Sink":
			parent.detach();
			(other.gameObject.GetComponent<Sink> ()).attach ();
			host.GetComponent<Collider2D> ().enabled = false;
			World wrld = World.host.GetComponent<World> ();
			if (other.gameObject.GetComponent<Sink> () == wrld.lData [World.currentLevel].Target) {
				Debug.Log ("Level Finished!");
				wrld.nextLevel ();
				Pos = new Vector2(-2f,-2f);
			}
			//TODO:WIN!
			break;
		}
	}
Example #37
0
        /// <summary>
        /// La méthode GetAdherent retourne les informations sur un adherent. 
        /// </summary>
        /// <param name="id">l'id de l'adhérent</param>
        /// <returns>un adhérent</returns>
        public Adherent GetAdherent(int id)
        {
            string connectionString = Initialisation.InitialiserConnexion();
            Adherent lAdherent = null;
            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                string query = "SELECT idAdherent, nom, prenom, codePostal, ville, dateNaissance, typeAdhesion from adherent WHERE idAdherent = @id; ";

                //Create Command
                MySqlCommand cmd = new MySqlCommand(query, connection);

                cmd.Parameters.AddWithValue("@id", id);

                //Crée un data reader et exécute la commande
                using (MySqlDataReader dataReader = cmd.ExecuteReader())
                {

                    //Lit les données
                    while (dataReader.Read())
                    {

                        int idAdherent = Convert.ToInt32(dataReader["idAdherent"]);
                        string nom = dataReader["nom"].ToString();
                        string prenom = dataReader["prenom"].ToString();
                        string cp = dataReader["codePostal"].ToString();
                        string ville = dataReader["ville"].ToString();
                        DateTime annee = Convert.ToDateTime(dataReader["dateNaissance"]);
                        int idType = Convert.ToInt32(dataReader["typeAdhesion"]);
                        TypeAdhesionDB typeDB = new TypeAdhesionDB();
                        TypeAdhesion leTypeDeAdherent = typeDB.GetTypeAdhesion(idType);
                        lAdherent = new Adherent(idAdherent, nom, prenom, cp, ville, annee, leTypeDeAdherent);

                    }
                }
            }

            return lAdherent;
        }
Example #38
0
	public override void toAdherent(Adherent target,Vector2[] points){
		target.setpath(Path.createRect(0f,0f,points[1].x-points[0].x,points[1].y-points[0].y));
	}
        protected void Button1_Click(object sender, EventArgs e)
        {
            int id = int.Parse(TextBoxnumeroArdherent.Text);





            //SqlDataSource1



            using (associationEntities1 bdd = new associationEntities1())
            {


                List<Adherent> ListAdr = new List<Adherent>();

                var Result3 = from p in bdd.Adherent                               
                              where id == p.IDAdherent
                              select new
                              {
                                  Nom = p.Nom,
                                  Prenom = p.Prenom,
                                  Genre = p.Genre,
                                  Naissance = p.Naissance,
                                  Photo = p.Photo,
                                  SituatFam = p.SituatFam,
                                  VilOrig = p.VilOrig,
                              };



                List<Adherent> listeAdherent = new List<Adherent>();

                foreach (var item in Result3)
                {
                    Adherent adr = new Adherent();

                    adr.Nom = item.Nom;
                    adr.Prenom = item.Prenom;
                    adr.Genre = item.Genre;
                    adr.Naissance = item.Naissance;
                    adr.Photo = item.Photo;
                    adr.SituatFam = item.SituatFam;
                    adr.VilOrig = item.VilOrig;


                    listeAdherent.Add(adr);
                }



                GridView1.DataSource = listeAdherent;
                GridView1.DataBind();









            }

        }
Example #40
0
 public override void toAdherent(Adherent target, Vector2[] points) {
     target.setPath(toPath(points));
     target.setType((int)Adherent.adTypes.Triangle);
 }
Example #41
0
    public void Remove(Adherent adherent) {
        if (adherentObjects.Contains(adherent)) {
            adherentObjects.Remove(adherent);
            Destroy(adherent.gameObject);

            FindIntersections();

            if (adherent.isCarrying) {
                lData[currentLevel].Fountain.generateResource();
            }
        }
    }
Example #42
0
    public void Remove(Adherent adherent) {
        if (!adherentObjects.Contains(adherent)) {
            return;
        }

        int adLevel = adherent.level;
        Resource levelRes = ResourceManager.levelResource(adLevel);
        Fountain levelFount = lData[adLevel].Fountain;

        if (adherent.isCarrying) {
            levelRes.Respawn(levelFount);
        }
        else if (!levelRes.hasParent()) {
            levelRes.notifyOfAdherentRemove(adherent, levelFount);
        }

        adherentObjects.Remove(adherent);
        Destroy(adherent.gameObject);

        FindIntersections();
    }
Example #43
0
 void OnTriggerEnter2D(Collider2D other) {
     switch (other.gameObject.tag) {
     case "Follower":
         if (!hasParent()) {
             parent = (other.gameObject.GetComponentInParent<Adherent>()).attach(this);
         }
         break;
     case "Sink":
         parent.detach(this, false);
         (other.gameObject.GetComponent<Sink>()).attach(this);
         this.canCollide = false;
         World wrld = World.host.GetComponent<World>();
         if (other.gameObject.GetComponent<Sink>() == wrld.lData[World.currentLevel].Target) {
             wrld.nextLevel();
         }
         break;
     }
 }
Example #44
0
 // Use this for initialization
 void Start() {
     parent = null;
     m_intersectionAdherents = null;
     this.canCollide = false;
     StartCoroutine ("Animate");
 }
Example #45
0
    public override void toAdherent(Adherent target, Vector2[] points)
    {
        target.setpath(toPath(points));
		target.setType((int)Adherent.adTypes.Diamond);
    }
Example #46
0
	// Use this for initialization
	void Start () {
		Pos = new Vector2(-2f,-2f);
		parent = null;
		host = gameObject;
		StartCoroutine ("Animate");
	}
Example #47
0
        /// <summary>
        /// La méthode SaveAdherent crée un nouvel adhérent s'il n'existe pas et le modifie 
        /// s'il existe déjà dans la base. 
        /// </summary>
        public void Save(Adherent unAdherent)
        {
            string connectionString = Initialisation.InitialiserConnexion();
            string query;
            if (unAdherent.GetId() == -1)
            {
                //Création d'un nouvel adhérent
                query = "insert into adherent (nom, prenom, codePostal, ville, dateNaissance, typeAdhesion) values (@nom, @prenom, @codePostal, @ville, @dateNaissance, @typeAdhesion);";
            }
            else
            {
                //Modification d'un adhérent
                query = "update adherent set  idAdherent = @id, nom = @nom, prenom = @prenom, codePostal = @prenom, ville = @ville, dateNaissance = @dateNaissance, typeAdhesion = typeAdhesion where idAdherent = @id";

            }

            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();

                //Create Command
                MySqlCommand cmd = new MySqlCommand(query, connection);

                cmd.Parameters.AddWithValue("@id", unAdherent.GetId());
                cmd.Parameters.AddWithValue("@nom", unAdherent.GetNom());
                cmd.Parameters.AddWithValue("@prenom", unAdherent.GetPrenom());
                cmd.Parameters.AddWithValue("@codePostal", unAdherent.GetCodePostal());
                cmd.Parameters.AddWithValue("@dateNaissance", unAdherent.GetDateDeNaissance().ToString("yyyy-MM-dd"));
                cmd.Parameters.AddWithValue("@ville", unAdherent.GetVille());
                cmd.Parameters.AddWithValue("@typeAdhesion", unAdherent.GetTypeAdherent().idTypeAdhesion);

                //exécution la commande
                cmd.ExecuteNonQuery();

            }
        }
Example #48
0
 public abstract void toAdherent(Adherent a,Vector2[] position);
Example #49
0
 public IntersectionData(float position, Adherent ad1, Adherent ad2) {
     pos = position;
     adherents = new List<WeakReference>();
     adherents.Add(new WeakReference(ad1));
     adherents.Add(new WeakReference(ad2));
 }