示例#1
0
        public static List <LigneFrais> chargerLignesFrais(int unIdFiche)
        {
            List <LigneFrais> uneListeLignessFrais = new List <LigneFrais>();
            String            uneRequete           = "SELECT idFiche, idTypeFrais, quantiteDeclaree FROM lignefrais where idFiche = " + unIdFiche;

            MySqlDataReader unDataReader = DbConnexion.GetDataReader(uneRequete);
            LigneFrais      uneLigneFrais;

            int?uneQuantiteDeclaree;

            while (unDataReader.Read())
            {
                TypeFrais unTypeFrais = LesTypesFrais.chercherTypeFrais(unDataReader.GetString(1));

                uneQuantiteDeclaree = null;
                if (!unDataReader.IsDBNull(2))
                {
                    uneQuantiteDeclaree = unDataReader.GetInt32(2);
                }



                uneLigneFrais = new LigneFrais(unDataReader.GetInt32(0), unDataReader.GetString(1), uneQuantiteDeclaree, unTypeFrais);

                uneListeLignessFrais.Add(uneLigneFrais);
            }
            unDataReader.Close();
            return(uneListeLignessFrais);
        }
示例#2
0
        public static List <TypeFrais> chargerTypesFrais()
        {
            List <TypeFrais> uneListeFraisForfait = new List <TypeFrais>();
            String           uneRequete           = "Select Id, libelle, montant from TYPEFRAIS";

            try
            {
                MySqlDataReader unDataReader = DbConnexion.GetDataReader(uneRequete);

                while (unDataReader.Read())
                {
                    TypeFrais unTypeFrais = new TypeFrais(unDataReader.GetString(0), unDataReader.GetString(1), unDataReader.GetDecimal(2));
                    uneListeFraisForfait.Add(unTypeFrais);
                }

                unDataReader.Close();
                return(uneListeFraisForfait);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Erreur chargement liste typeFrais : ", ex.Message);
                return(null);
            }
        }