示例#1
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);
        }
示例#2
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);
        }
示例#3
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);
        }
示例#5
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);
        }
示例#6
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);
        }
示例#7
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);
        }
示例#8
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);
        }