Esempio n. 1
0
        /// <summary>
        /// maj article
        /// </summary></returns>

        /// <returns>indique si l action a reussi
        public static bool UpdateArticle(Article ArticleToUpdate)
        {
            bool ok;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //maj de l'atrticle ds l entitee
                    Article unArticle = bdd.Article.Where(x => x.idArticle == ArticleToUpdate.idArticle).FirstOrDefault();

                    unArticle.designationArticle = ArticleToUpdate.designationArticle;
                    unArticle.prixArticle        = ArticleToUpdate.prixArticle;
                    unArticle.photoArticle       = ArticleToUpdate.photoArticle;
                    unArticle.idCatArticle       = ArticleToUpdate.idCatArticle;

                    //save les modifs dans la base
                    bdd.SaveChanges();
                    ok = true;
                }
                catch (Exception)
                {
                    ok = false;
                }
            }
            return(ok);
        }
Esempio n. 2
0
        /// <summary>
        /// maj CategorieArticle
        /// </summary></returns>

        /// <returns>indique si l action a reussi
        public static bool UpdateCategorieArticle(CategorieArticle CategorieArticleToUpdate)
        {
            bool ok;

            using (BDDRestaurantEntities Bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //maj du user ds l entitee
                    CategorieArticle unArticle = Bdd.CategorieArticle.Where(x => x.idCatArticle == CategorieArticleToUpdate.idCatArticle).FirstOrDefault();

                    unArticle.idCatArticle      = CategorieArticleToUpdate.idCatArticle;
                    unArticle.libelleCatArticle = CategorieArticleToUpdate.libelleCatArticle;


                    //save les modifs dans la base
                    Bdd.SaveChanges();
                    ok = true;
                }
                catch (Exception)
                {
                    ok = false;
                }
            }
            return(ok);
        }
        /// <summary>
        /// maj Table
        /// </summary>

        /// <returns>indique si l action a reussi</returns>
        public static bool UpdateTablee(Tablee TableeToUpdate)
        {
            bool ok;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //maj de l'atrticle ds l entitee
                    Tablee unTablee = bdd.Tablee.Where(x => x.numTablee == TableeToUpdate.numTablee).FirstOrDefault();

                    unTablee.numTablee     = TableeToUpdate.numTablee;
                    unTablee.nbPlaceTablee = TableeToUpdate.nbPlaceTablee;

                    //save les modifs dans la base
                    bdd.SaveChanges();
                    ok = true;
                }
                catch (Exception)
                {
                    ok = false;
                }
            }
            return(ok);
        }
Esempio n. 4
0
        /// <summary>
        /// maj Table
        /// </summary>

        /// <returns>indique si l action a reussi</returns>
        public static bool UpdateCommande(Commande CommandeToUpdate)
        {
            bool ok;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //maj de l'atrticle ds l entitee
                    Commande unCommande = bdd.Commande.Where(x => x.numCommande == CommandeToUpdate.numCommande).FirstOrDefault();

                    unCommande.dateHeureCommance = CommandeToUpdate.dateHeureCommance;
                    unCommande.numTablee         = CommandeToUpdate.numTablee;
                    unCommande.idServeur         = CommandeToUpdate.idServeur;
                    unCommande.termine           = CommandeToUpdate.termine;

                    //save les modifs dans la base
                    bdd.SaveChanges();
                    ok = true;
                }
                catch (Exception)
                {
                    ok = false;
                }
            }
            return(ok);
        }
Esempio n. 5
0
        public static List <CategorieArticle> GetCategoriePlats()
        {
            List <CategorieArticle> DesCategorieArticles;

            using (BDDRestaurantEntities Bdd = new BDDRestaurantEntities())

                try
                {
                    DesCategorieArticles = Bdd.CategorieArticle.Where(x => x.idCatArticle != 0).ToList();
                }
                catch (Exception)
                {
                    DesCategorieArticles = new List <CategorieArticle>();
                }
            return(DesCategorieArticles);
        }
Esempio n. 6
0
        internal static List <Article> GetArticleByCateg(int idCat)
        {
            List <Article> DesArticles;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    DesArticles = bdd.Article.Where(x => x.idCatArticle == idCat).ToList();
                }
                catch (Exception)
                {
                    DesArticles = new List <Article>();
                }
            }
            return(DesArticles);
        }
        /// <summary>
        /// recup un Table a partir de son numéro
        /// </summary>
        /// <param name="unIDTablee">id de la Table recherché</param>
        /// <returns></returns>

        public static Tablee GetInstance(int unIdTablee)
        {
            Tablee unTablee;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    unTablee = bdd.Tablee.Where(x => x.numTablee == unIdTablee).FirstOrDefault();
                }
                catch (Exception)
                {
                    unTablee = new Tablee();
                }
            }
            return(unTablee);
        }
Esempio n. 8
0
        /// <summary>
        /// recup un Table a partir de son numéro
        /// </summary>
        /// <param name="unIDCommande">id de la Table recherché</param>
        /// <returns></returns>

        public static Commande GetInstance(int unIdCommande)
        {
            Commande unCommande;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    unCommande = bdd.Commande.Where(x => x.numCommande == unIdCommande).FirstOrDefault();
                }
                catch (Exception)
                {
                    unCommande = new Commande();
                }
            }
            return(unCommande);
        }
Esempio n. 9
0
        /// <summary>
        /// recup la liste des Commande
        /// </summary>
        /// <returns>la liste des Table qu on recherche et si il existe pas une liste vide</returns>

        public static List <Commande> GetCommande()
        {
            List <Commande> DesCommandes;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    DesCommandes = bdd.Commande.ToList();
                }
                catch (Exception)
                {
                    DesCommandes = new List <Commande>();
                }
            }
            return(DesCommandes);
        }
Esempio n. 10
0
        /// <summary>
        /// recup la liste des article
        /// </summary>
        /// <returns>la liste des articles qu on recherche et si il existe pas une liste vide</returns>

        public static List <Article> GetArticle()
        {
            List <Article> DesArticles;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    DesArticles = bdd.Article.ToList();
                }
                catch (Exception)
                {
                    DesArticles = new List <Article>();
                }
            }
            return(DesArticles);
        }
Esempio n. 11
0
        /// <summary>
        /// recup un article a partir de son identifiant
        /// </summary>
        /// <param name="unIDarticle">id de l'article recherché</param>
        /// <returns>user qu on recherche et si il existe pas un nouveau article</returns>

        public static Article GetInstance(int unIdArticle)
        {
            Article unArticle;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    unArticle = bdd.Article.Where(x => x.idArticle == unIdArticle).FirstOrDefault();
                }
                catch (Exception)
                {
                    unArticle = new Article();
                }
            }
            return(unArticle);
        }
Esempio n. 12
0
        /// <summary>
        /// recup la liste des Tablee
        /// </summary>
        /// <returns>la liste des Table qu on recherche et si il existe pas une liste vide</returns>

        public static List <Tablee> GetTablee()
        {
            List <Tablee> DesTablees;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    DesTablees = bdd.Tablee.ToList();
                }
                catch (Exception)
                {
                    DesTablees = new List <Tablee>();
                }
            }
            return(DesTablees);
        }
Esempio n. 13
0
        /// <summary>
        /// recup une catarticle a partir de son id
        /// </summary>

        /// <returns>catArticle qu on recherche et si il existe pas un nv catarticle0</returns>

        public static CategorieArticle GetInstance(int unIdCatArticle)
        {
            CategorieArticle uneCategorieArticle;

            using (BDDRestaurantEntities Bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //select * from daluser where daluserid=iduser;
                    uneCategorieArticle = Bdd.CategorieArticle.Where(x => x.idCatArticle == unIdCatArticle).FirstOrDefault();
                }
                catch (Exception)
                {
                    uneCategorieArticle = new CategorieArticle();
                }
            }
            return(uneCategorieArticle);
        }
Esempio n. 14
0
        /// <summary>
        /// recup la liste des CategorieArticle
        /// </summary>
        /// <returns>la liste des CategorieArticle qu on recherche et si il existe pas une liste vide</returns>

        public static List <CategorieArticle> GetCategorieArticle()
        {
            List <CategorieArticle> DesCategorieArticles;

            using (BDDRestaurantEntities Bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //select * from daluser where Article=iduser;
                    DesCategorieArticles = Bdd.CategorieArticle.ToList();
                }
                catch (Exception)
                {
                    DesCategorieArticles = new List <CategorieArticle>();
                }
            }
            return(DesCategorieArticles);
        }
Esempio n. 15
0
        /// <summary>
        /// ajoute une Table
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static bool AddCommande(Commande Commande)
        {
            bool ok;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //ajoute le user a l entitee
                    bdd.Commande.Add(Commande);
                    //save les modifs dans la base
                    bdd.SaveChanges();
                    ok = true;
                }
                catch (Exception)
                {
                    ok = false;
                }
            }
            return(ok);
        }
Esempio n. 16
0
        /// <summary>
        /// supp l Table
        /// </summary>

        /// <returns>indique si l action a reussi</returns>
        public static bool TermineCommande(Commande CommandeToTermine)
        {
            bool ok;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //maj de l'Commande ds l entitee
                    Commande unCommande = bdd.Commande.Where(x => x.numCommande == CommandeToTermine.numCommande).FirstOrDefault();
                    unCommande.termine = CommandeToTermine.termine;
                    //save les modifs dans la base
                    bdd.SaveChanges();
                    ok = true;
                }
                catch (Exception)
                {
                    ok = false;
                }
            }
            return(ok);
        }
Esempio n. 17
0
        /// <summary>
        /// ajoute un CategorieArticle
        /// </summary>

        public static bool AddCategorieArticle(CategorieArticle categorieArticle)
        {
            bool ok;

            using (BDDRestaurantEntities Bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //ajoute le categorieArticle a l entitee
                    Bdd.CategorieArticle.Add(categorieArticle); //.AddObject(categorieArticle);

                    //save les modifs dans la base
                    Bdd.SaveChanges();
                    ok = true;
                }
                catch (Exception)
                {
                    ok = false;
                }
            }
            return(ok);
        }
Esempio n. 18
0
        /// <summary>
        /// supp l article
        /// </summary></returns>

        /// <returns>indique si l action a reussi
        public static bool DeleteArticle(Article ArticleToDelete)
        {
            bool ok;

            using (BDDRestaurantEntities bdd = new BDDRestaurantEntities())
            {
                try
                {
                    //maj de l'article ds l entitee
                    Article unArticle = bdd.Article.Where(x => x.idArticle == ArticleToDelete.idArticle).FirstOrDefault();
                    bdd.Article.Remove(unArticle);
                    //save les modifs dans la base
                    bdd.SaveChanges();
                    ok = true;
                }
                catch (Exception)
                {
                    ok = false;
                }
            }
            return(ok);
        }