Beispiel #1
0
        // GET: Commande/Create
        public ActionResult Create()
        {
            CommandeViewModel      commandeVM;
            Commande               commande = new Commande();
            IEnumerable <Clientel> clients  = new ClientelDAO().GetAll();
            IEnumerable <Vendeur>  vendeurs = new VendeurDAO().GetAll();

            commandeVM          = new CommandeViewModel(commande);
            commandeVM.Clients  = GetClients(clients, commande.Client);
            commandeVM.Vendeurs = GetVendeurs(vendeurs, commande.Vendeur);
            return(View("~/Views/Commande/Modifier.cshtml", commandeVM));
        }
Beispiel #2
0
        public DetailCdeViewModel(DetailCde detailCde)
        {
            CommandeVM = new CommandeViewModel(detailCde.Commande);
            List <Article> ListArticle = (List <Article>)detailCde.Articles;

            DetailArticle = new List <DetailArticleCommandeViewModel>();
            for (int i = 0; i < ListArticle.Count; i++)
            {
                DetailArticle.Add(
                    new DetailArticleCommandeViewModel(
                        ListArticle[i].NoArtcile,
                        ListArticle[i].LibArticle,
                        ListArticle[i].PrixArt,
                        ((List <int>)detailCde.QteCdees)[i],
                        ((List <int>)detailCde.QteCdees)[i] * ListArticle[i].PrixArt,
                        ((List <bool>)detailCde.Livrees)[i]));
            }
            foreach (DetailArticleCommandeViewModel detailArt in DetailArticle)
            {
                PrixTotal += detailArt.PrixTotalArticle;
            }
        }
Beispiel #3
0
        // GET: Commande/Edit/5
        public ActionResult Modifier(int?id)
        {
            CommandeViewModel commandeVM = null;

            try
            {
                if (id == null)
                {
                    throw new Exception();
                }
                Commande commande = new CommandeDAO().GetSingleById((int)id);
                IEnumerable <Clientel> clients  = new ClientelDAO().GetAll();
                IEnumerable <Vendeur>  vendeurs = new VendeurDAO().GetAll();
                commandeVM          = new CommandeViewModel(commande);
                commandeVM.Clients  = GetClients(clients, commande.Client);
                commandeVM.Vendeurs = GetVendeurs(vendeurs, commande.Vendeur);
            }
            catch (Exception e)
            {
                ModelState.AddModelError("Erreur", "Erreur lors de la récupération du client : " + e.Message);
            }
            return(View(commandeVM));
        }
Beispiel #4
0
 public DetailCdeViewModel()
 {
     CommandeVM    = new CommandeViewModel();
     DetailArticle = new List <DetailArticleCommandeViewModel>();
 }