Пример #1
0
        public List <Articles> GetAllArticles()
        {
            Query = "select * from Articles;";
            SQLiteCommand Command = new SQLiteCommand(Query, Connection);

            Command.ExecuteNonQuery();

            var             Reader          = Command.ExecuteReader();
            var             Articles        = new List <Articles>();
            MarquesDao      MarquesDao      = new MarquesDao();
            FamillesDao     FamillesDao     = new FamillesDao();
            SousFamillesDao SousFamillesDao = new SousFamillesDao();


            while (Reader.Read())
            {
                var RefArticle  = Reader.GetString(0);
                var Description = Reader.GetString(1);
                var SousFamille = SousFamillesDao.FindSousFamilleByRefSousFamille(Reader.GetInt32(2));
                var Marque      = MarquesDao.FindMarqueByRefMarque(Reader.GetInt32(3));

                var PrixHTs = Reader.GetString(4);
                var PrixHT  = double.Parse(PrixHTs);

                var Quantite = Reader.GetInt32(5);
                Articles.Add(new Articles(RefArticle, Description, FamillesDao.FindFamillesByRefSousFamille(SousFamille.RefSousFamille), SousFamille, Marque, PrixHT, Quantite));
            }

            Reader.Close();

            return(Articles);
        }
Пример #2
0
        public Articles FindArticlesByRefArticle(string RefArticle)
        {
            Query = "SELECT * FROM Articles WHERE RefArticle = '" + RefArticle + "'";
            SQLiteCommand Command = new SQLiteCommand(Query, Connection);
            var           Reader  = Command.ExecuteReader();

            if (Reader.Read())
            {
                var             Description     = Reader.GetString(1);
                var             RefSousFamille  = Reader.GetInt32(2);
                var             RefMarque       = Reader.GetInt32(3);
                var             PrixHTs         = Reader.GetString(4);
                var             PrixHT          = double.Parse(PrixHTs);
                var             Quantite        = Reader.GetInt32(5);
                FamillesDao     FamillesDao     = new FamillesDao();
                SousFamillesDao SousFamillesDao = new SousFamillesDao();
                MarquesDao      MarquesDao      = new MarquesDao();

                Articles Article = new Articles(RefArticle, Description, FamillesDao.FindFamillesByRefSousFamille(RefSousFamille),
                                                SousFamillesDao.FindSousFamilleByRefSousFamille(RefSousFamille),
                                                MarquesDao.FindMarqueByRefMarque(RefMarque), PrixHT, Quantite);
                Reader.Close();
                return(Article);
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
        public List <Articles> FindArticlesBySousFamilleName(string SousFamilleName)
        {
            Query = "SELECT * FROM Articles WHERE RefSousFamille = (SELECT RefSousFamille FROM SousFamilles WHERE Nom = '" + SousFamilleName + "')";
            SQLiteCommand Command = new SQLiteCommand(Query, Connection);
            var           Reader  = Command.ExecuteReader();

            List <Articles> Articles        = new List <Articles>();
            FamillesDao     FamillesDao     = new FamillesDao();
            SousFamillesDao SousFamillesDao = new SousFamillesDao();
            MarquesDao      MarquesDao      = new MarquesDao();

            while (Reader.Read())
            {
                var RefArticle     = Reader.GetString(0);
                var Description    = Reader.GetString(1);
                var RefSousFamille = Reader.GetInt32(2);
                var RefMarque      = Reader.GetInt32(3);
                var PrixHTs        = Reader.GetString(4);
                var PrixHT         = double.Parse(PrixHTs);
                var Quantite       = Reader.GetInt32(5);

                Articles Article = new Articles(RefArticle, Description, FamillesDao.FindFamillesByRefSousFamille(RefSousFamille),
                                                SousFamillesDao.FindSousFamilleByRefSousFamille(RefSousFamille),
                                                MarquesDao.FindMarqueByRefMarque(RefMarque), PrixHT, Quantite);
                Articles.Add(Article);
            }
            Reader.Close();
            return(Articles);
        }
Пример #4
0
 /// <summary>
 /// The constructor of SousFamillesDao.
 /// </summary>
 public SousFamillesDao()
 {
     this.Connection = Util.GetConnection.ConnectionSQLite();
     this.FamilleDao = new FamillesDao();
     this.Query      = null;
 }