Ejemplo n.º 1
0
        public void SetCardCredit(Entity.Usager usager, float newCredit)
        {
            var query = "UPDATE Carte SET Credit=\"" + newCredit + "\"" + " WHERE MatriculeCarte=(SELECT MatriculeCarte FROM Usager WHERE Matricule=\"" + usager.Matricule + "\"" + ")";

            Debug.WriteLine(query);
            MySqlDataReader mySqlDataReader = _sQLService.Load(query);

            mySqlDataReader.Close();
        }
Ejemplo n.º 2
0
 public void SetCardCredit(Entity.Usager usager, float newCredit)
 {
     try
     {
         _usagerDAL.SetCardCredit(usager, newCredit);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 3
0
 public float GetCardCredit(Entity.Usager usager)
 {
     try
     {
         return(_usagerDAL.GetCardCredit(usager));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 4
0
        public float GetCardCredit(Entity.Usager usager)
        {
            float credit = 0;

            var query = "SELECT Credit FROM Carte WHERE MatriculeCarte=\"" + usager.MatriculeCarte + "\"";

            MySqlDataReader mySqlDataReader = _sQLService.Load(query);

            try
            {
                while (mySqlDataReader.Read())
                {
                    credit = (float)mySqlDataReader["Credit"];
                }
            }
            catch
            {
                throw new Exception("Problème(s) lors de l'accès au crédit de l'usager !");
            }

            mySqlDataReader.Close();
            return(credit);
        }
Ejemplo n.º 5
0
        public List <Entity.Usager> GetAllUsagersNonUtilisateur()
        {
            var             query           = "SELECT * FROM Usager WHERE Matricule NOT IN (SELECT idUtilisateur FROM Utilisateur)";
            MySqlDataReader mySqlDataReader = _sQLService.Load(query);

            try
            {
                List <Entity.Usager> list = new List <Entity.Usager>();

                while (mySqlDataReader.Read())
                {
                    Entity.Usager usager = new Entity.Usager(
                        (DateTime)mySqlDataReader["DateEntree"],
                        (int)mySqlDataReader["Matricule"],
                        (int)mySqlDataReader["CodeFonction"],
                        (int)mySqlDataReader["Service"],
                        mySqlDataReader["Nom"] as string,
                        mySqlDataReader["Prenom"] as string,
                        mySqlDataReader["Titre"] as string,
                        mySqlDataReader["Paiement"] as string,
                        (int)mySqlDataReader["MatriculeCarte"],
                        mySqlDataReader["DateFinC"] as DateTime?
                        );

                    list.Add(usager);
                }
                return(list);
            }
            catch (MySqlException)
            {
                throw new Exception("Problème(s) lors du chargement des usagers !");
            }
            finally
            {
                mySqlDataReader.Close();
            }
        }
Ejemplo n.º 6
0
        public Entity.Usager GetUsagerByMatriculeCarte(int matricule)
        {
            var             query           = "SELECT * FROM Usager WHERE MatriculeCarte=" + "\"" + matricule + "\"";
            MySqlDataReader mySqlDataReader = _sQLService.Load(query);

            try
            {
                List <Entity.Usager> list = new List <Entity.Usager>();

                while (mySqlDataReader.Read())
                {
                    Entity.Usager usager = new Entity.Usager(
                        (DateTime)mySqlDataReader["DateEntree"],
                        (int)mySqlDataReader["Matricule"],
                        (int)mySqlDataReader["CodeFonction"],
                        (int)mySqlDataReader["Service"],
                        mySqlDataReader["Nom"] as string,
                        mySqlDataReader["Prenom"] as string,
                        mySqlDataReader["Titre"] as string,
                        mySqlDataReader["Paiement"] as string,
                        (int)mySqlDataReader["MatriculeCarte"],
                        mySqlDataReader["DateFinC"] as DateTime?
                        );

                    list.Add(usager);
                }
                return(list[0]);
            }
            catch (MySqlException)
            {
                throw new Exception("Problème(s) lors l'obtention de l'usager !");
            }
            finally
            {
                mySqlDataReader.Close();
            }
        }