Exemplo n.º 1
0
 public static void Delete(Rang rang)
 {
     using (var transaction = session.BeginTransaction())
     {
         session.Delete(rang);
         transaction.Commit();
     }
 }
Exemplo n.º 2
0
 public Client(string prenom, string nom, string description,
               Sexe sexe, string adresse, string codePostal,
               string telephone, Rang rang, Province province, bool estActif)
 {
     Prenom      = prenom;
     Nom         = nom;
     Description = description;
     Sexe        = sexe;
     Adresse     = adresse;
     CodePostal  = codePostal;
     Telephone   = telephone;
     Rang        = rang;
     Province    = province;
     EstActif    = estActif;
 }
Exemplo n.º 3
0
        // Pour utiliser NHibernate, il faut surcharger Equals et GetHashCode.
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            Rang r = obj as Rang;

            if (r == null)
            {
                return(false);
            }

            return(this.IdRang == r.IdRang);
        }
Exemplo n.º 4
0
        private Rang SetRang()
        {
            Rang rang = new Rang();

            switch (cboRang.SelectedIndex + 1)
            {
            case 1: rang.Nom = "unranked"; break;

            case 2: rang.Nom = "Bronze"; break;

            case 3: rang.Nom = "Argent"; break;

            case 4: rang.Nom = "Or"; break;

            default: rang.Nom = "unranked"; break;
            }
            return(rang);
        }
Exemplo n.º 5
0
        public static void ModifierClient(Sexe sexe, Province province, Rang rang)
        {
            // Setter les champs
            LeClient.Prenom      = AjoutModifUserControl.TxtPrenom.Text.ToString();
            LeClient.Nom         = AjoutModifUserControl.TxtNom.Text.ToString();
            LeClient.Description = AjoutModifUserControl.TxtDescription.Text.ToString();


            LeClient.Adresse    = AjoutModifUserControl.TxtAdresse.Text.ToString();
            LeClient.CodePostal = AjoutModifUserControl.TxtCodePostal.Text.ToString();
            LeClient.Telephone  = AjoutModifUserControl.TxtTelephone.Text.ToString();


            // Sexe
            Sexe s;

            s             = HibernateSexeService.RetrieveByName(sexe.Nom)[0];
            LeClient.Sexe = s;

            // Rang
            Rang r;

            r             = HibernateRangService.RetrieveByName(rang.Nom)[0];
            LeClient.Rang = r;

            // Province
            //LeClient.Province.Nom = province.Nom;
            Province p;

            p = HibernateProvinceClient.RetrieveByName(province.Nom)[0];
            LeClient.Province = p;

            // Actif/Inactif

            LeClient.EstActif = (bool)AjoutModifUserControl.CbxActif.IsChecked;


            // Update en BD.
            HibernateClientService.Update(LeClient);

            // Update en liste
            LstObClients.Remove(LeClient);
            LstObClients.Add(LeClient);
        }