Ejemplo n.º 1
0
        public BE_bac_bac rechercher(string code)
        {
            BE_bac_bac u = new BE_bac_bac();

            try
            {
                u = db.BE_bac_bac.First(x => x.codeBE_BAC_BAC == code);

                //verification de l'existence de l'objet dans la bd
                if (u != null)
                {
                    return(u);
                }

                else
                {
                    u.libelle = "Aucun enregistrement trouve.";
                    return(null);
                }
            }
            catch (Exception ex)
            {
                u.libelle = ex.StackTrace;
            }

            return(u);
        }
Ejemplo n.º 2
0
        public BE_bac_bac supprimer(BE_bac_bac u)
        {
            if (u == null)
            {
                u = new BE_bac_bac();
            }
            try
            {
                if (db.BE_bac_bac.First(x => x.codeBE_BAC_BAC == u.codeBE_BAC_BAC) != null)
                {
                    //sauvegarde des nouvelles informations

                    db.supprimerBE_bac_bac(u.codeBE_BAC_BAC, u.codeCOMMANDE_MARKET, u.codeDEPOT, u.codeU);
                }

                else
                {
                    u.libelle = "Cet enregistrement n'existe pas dans la base de donnees.";
                }
            }
            catch (Exception ex)
            {
                u.libelle = ex.StackTrace;
            }
            return(u);
        }
Ejemplo n.º 3
0
        public ActionResult Edit(BE_bac_bac x)
        {
            try
            {
                dao.modifier(x);
                // TODO: Add update logic here

                return(RedirectToAction("afficherTous"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 4
0
        public BE_bac_bac ajouter(BE_bac_bac u)
        {
            if (u == null)
            {
                u = new BE_bac_bac();
            }
            try
            {
                db.creerBE_bac_bac(u.libelle, u.quantite, u.codeCOMMANDE_MARKET, u.codeDEPOT, u.codeU);
            }
            catch (Exception ex)
            {
                u.libelle = ex.StackTrace;
            }

            return(u);
        }
Ejemplo n.º 5
0
        public List <BE_bac_bac> rechercherTous()
        {
            List <BE_bac_bac> us = new List <BE_bac_bac>();

            try
            {
                us = db.BE_bac_bac.ToList();
            }
            catch (Exception ex)
            {
                BE_bac_bac p = new BE_bac_bac();
                p.libelle = ex.StackTrace;
                us.Add(p);
            }

            return(us);
        }
Ejemplo n.º 6
0
        public BE_bac_bac rechercherUnique(BE_bac_bac m)
        {
            BE_bac_bac u = new BE_bac_bac();

            try
            {
                u = db.BE_bac_bac.First(x => x.libelle == m.libelle && x.quantite == m.quantite);
            }

            catch (Exception ex)
            {
                u.libelle = ex.StackTrace;
            }


            return(u);
        }
Ejemplo n.º 7
0
        public List <BE_bac_bac> rechercherParMC(Func <BE_bac_bac, bool> predicate)
        {
            List <BE_bac_bac> us = new List <BE_bac_bac>();

            try
            {
                us = db.BE_bac_bac.Where(predicate).ToList();
            }
            catch (Exception ex)
            {
                BE_bac_bac p = new BE_bac_bac();
                p.libelle = ex.StackTrace;
                us.Add(p);
            }

            return(us);
        }
Ejemplo n.º 8
0
        // GET: BE_bac_bac/Details/5
        public ActionResult Details(string code)
        {
            BE_bac_bac x = dao.rechercher(code);

            BEBacBacModel pm = new BEBacBacModel
            {
                codeBE_BAC_BAC = x.codeBE_BAC_BAC,
                quantite       = x.quantite,
                libelle        = x.libelle
            };

            if (x == null)
            {
                return(HttpNotFound());
            }
            return(View(pm));
        }
Ejemplo n.º 9
0
        // GET: BE_bac_bac/Edit/5
        public ActionResult Edit(string code)
        {
            BE_bac_bac x = dao.rechercher(code);

            BEBacBacModel pm = new BEBacBacModel
            {
                quantite = x.quantite,
                libelle  = x.libelle,


                ///*******
                ///
                codeU = x.codeU,
                codeCOMMANDE_MARKET = x.codeCOMMANDE_MARKET,
                codeDEPOT           = x.codeDEPOT
            };

            return(View(pm));
        }
Ejemplo n.º 10
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                string s = "";
                s = collection["quantite"];
                char decimalSymbol = ',';
                var  curr          = System.Windows.Forms.Application.CurrentCulture.NumberFormat.NumberDecimalSeparator;

                s = s.Replace(".", curr).Replace(decimalSymbol.ToString(), curr);

                BE_bac_bac x = new BE_bac_bac
                {
                    libelle  = collection["libelle"],
                    quantite = decimal.Parse(s),


                    //*******

                    codeU = collection["codeU"],
                    codeCOMMANDE_MARKET = collection["codeCOMMANDE_MARKET"],
                    codeDEPOT           = collection["codeDEPOT"]
                                          //date_c = DateTime.Now
                };

                dao.ajouter(x);


                return(RedirectToAction("afficherTous"));
            }
            catch (Exception ex)
            {
                ViewBag.Erreur = ex.Message;
                return(View());
            }
        }