예제 #1
0
        //
        // GET: /VenteDetails/

        public ActionResult Index()
        {
            VENTE_DETAILS _venteDetails = new VENTE_DETAILS();

            List<Vente_Details> _list = new List<Vente_Details>(); ;
            foreach (VENTE_DETAILS item in VENTE_DETAILS.GetList())
            {
                Vente_Details ventesDetails = new Vente_Details();
                
                ventesDetails.ID_AUTO = item.ID_AUTO;
                ventesDetails.ID_CHARGEMENT = item.ID_CHARGEMENT;
                ventesDetails.ID_VENTE = item.ID_VENTE;

                VENTE vente = new VENTE();
                vente.LoadId(item.ID_VENTE);

                ventesDetails.VENTE = vente.ToString();

                CHARGERMENT charge = new CHARGERMENT();
                charge.LoadId(item.ID_CHARGEMENT);

                ventesDetails.CHARGEMENT = charge.ToString();

                ventesDetails.PRIX_UNITAIRE= item.PRIX_UNITAIRE;
                ventesDetails.QTE = item.QTE;
                ventesDetails.TOTAL = item.TOTAL;
                _list.Add(ventesDetails);
            }

            return View(_list);
        }
예제 #2
0
        public ActionResult Create(Vente_Details VenteDetailsToCreate)
        {
            if (!ModelState.IsValid)
                return View();

            try
            {
                VENTE_DETAILS _venteDetails = new VENTE_DETAILS();
                _venteDetails.ID_CHARGEMENT = VenteDetailsToCreate.ID_CHARGEMENT;
                _venteDetails.ID_VENTE = VenteDetailsToCreate.ID_VENTE;
                _venteDetails.PRIX_UNITAIRE = VenteDetailsToCreate.PRIX_UNITAIRE;
                _venteDetails.QTE = VenteDetailsToCreate.QTE;
                _venteDetails.TOTAL = VenteDetailsToCreate.TOTAL;
               
                _venteDetails.Save();
                return RedirectToAction("../VenteDetails/Index");
            }
            catch
            {
                return View();
            }
        }
예제 #3
0
        public ActionResult Delete(Vente_Details VenteDetailsToDel)
        {
            int id = Int32.Parse(RouteData.Values["id"].ToString());

            if (!ModelState.IsValid)
                return View();

            try
            {
                VENTE_DETAILS _venteDetails = new VENTE_DETAILS();
                _venteDetails.SetId(id);
                _venteDetails.Delete();
                return RedirectToAction("../VenteDetails/Index");//reafficher l liste
            }
            catch
            {
                return View();
            }
        }
예제 #4
0
        //
        // GET: /VenteDetails/Delete/5
 
        public ActionResult Delete()
        {
            int id = Int32.Parse(RouteData.Values["id"].ToString());
          
            Vente_Details ventesDetails = new Vente_Details();
            VENTE_DETAILS _venteDetails = new VENTE_DETAILS();
            _venteDetails.LoadId(id);
            ventesDetails.TOTAL = _venteDetails.TOTAL;
            ventesDetails.QTE = _venteDetails.QTE;
            ventesDetails.PRIX_UNITAIRE = _venteDetails.PRIX_UNITAIRE;
            ventesDetails.ID_VENTE = _venteDetails.ID_VENTE;
            ventesDetails.ID_CHARGEMENT = _venteDetails.ID_CHARGEMENT;

            VENTE vente = new VENTE();
            vente.LoadId(_venteDetails.ID_VENTE);

            ventesDetails.VENTE = vente.ToString();

            CHARGERMENT charge = new CHARGERMENT();
            charge.LoadId(_venteDetails.ID_CHARGEMENT);

            ventesDetails.CHARGEMENT = charge.ToString();


            IEnumerable<SelectListItem> list = ToSelectListItems();
            list.ToList().Find(x => x.Text.Equals(ventesDetails.VENTE)).Selected = true;
            ViewData["ID_VENTE"] = list;

            IEnumerable<SelectListItem> list1 = ToSelectListItems1();
            list1.ToList().Find(x => x.Text.Equals(ventesDetails.CHARGEMENT)).Selected = true;
            ViewData["ID_CHARGEMENT"] = list1;

            return View(ventesDetails);
        }
예제 #5
0
        public ActionResult Edit(Vente_Details ventesDetails)
        {
            int id = Int32.Parse(RouteData.Values["id"].ToString());

            if (!ModelState.IsValid)
                return View();

            try
            {
                VENTE_DETAILS _venteDetails = new VENTE_DETAILS();
                _venteDetails.TOTAL = ventesDetails.TOTAL;
                _venteDetails.PRIX_UNITAIRE = ventesDetails.PRIX_UNITAIRE;
                _venteDetails.QTE = ventesDetails.QTE;
                _venteDetails.ID_VENTE = ventesDetails.ID_VENTE;
                _venteDetails.ID_CHARGEMENT = ventesDetails.ID_CHARGEMENT;
                _venteDetails.SetId(id);
                _venteDetails.Save();
                return RedirectToAction("../VenteDetails/Index");
            }
            catch
            {
                return View();
            }

        }