public ActionResult Ajouter() { try { //dropdown list de client List <String> noClientList = new List <String>(); noClientList = (Clientel.LectureNoClient()); ViewBag.ListOfNoClient = noClientList; //dropdown list de Vendeur List <String> noVendeurList = new List <String>(); noVendeurList = (Vendeur.LectureNoVendeur()); ViewBag.ListOfNoVendeur = noVendeurList; //dropdown list des articles List <String> noArticleList = new List <String>(); noArticleList = (Commandes.LectureNoArticle()); ViewBag.ListOfNoArticle = noArticleList; return(View("")); } catch (MonException e) { return(HttpNotFound()); } }
public void DeleteCommande(int i) { CommandeWPF wpf = Commandes.Where(p => p.commandeId == i).FirstOrDefault(); Commandes.Remove(wpf); DalCom.Delete(i); }
public ActionResult Modifier(ComVendCli cvc) { IEnumerable <Commandes> commandes = null; Commandes com = new Commandes(); try { // utilisation possible de Request // String s= Request["Societe"]; com.NoCommande = Request["NoCommande"]; com.NoClient = Clientel.getClientById(Request["NoClient"]); com.NoVendeur = Vendeur.getVendeurById(Request["NoVendeur"]); com.DateCde = Request["DateCde"]; com.Facture = Request["Facture"]; Commandes.updateCommande(com); commandes = Commandes.getCommandes(); return(View("Index", commandes)); } catch (MonException e) { return(HttpNotFound()); } }
//commandes de prod public ActionResult Add(int id) { var test = from Commandes in db.orders select Commandes; List <Commandes> otest = new List <Commandes>(); foreach (Commandes ot in test) { if (ot.Id_cli == int.Parse(Session["id"].ToString()) && ot.check == 0) { otest.Add(ot); } } if (otest.Count() == 0) { Session["coco"] = 1; Commandes c = new Commandes { Id_cli = int.Parse(Session["id"].ToString()), check = 0 }; db.orders.Add(c); db.SaveChanges(); var res = from Commandes in db.orders select Commandes; Commandes co = null; foreach (Commandes cc in res) { if (cc.Id_cli == int.Parse(Session["id"].ToString()) && cc.check == 0) { co = cc; } } Panier p = new Panier { Id_commande = co.Id_commande, Id_prod = id }; db.Paniers.Add(p); db.SaveChanges(); } else { var res = from Commandes in db.orders select Commandes; Commandes co = null; foreach (Commandes cc in res) { if (cc.Id_cli == int.Parse(Session["id"].ToString()) && cc.check == 0) { co = cc; } } Panier p = new Panier { Id_commande = co.Id_commande, Id_prod = id }; db.Paniers.Add(p); db.SaveChanges(); } return(RedirectToAction("Index")); }
public OrderModel(Commandes obj, status s) { this.Id = obj.Id; this.statusId = obj.statusId; this.UsersId = obj.UsersId; this.DateCreation = obj.DateCreation; this.DateLivraison = obj.DateLivraison; this.status = new StatusModel(s); }
// GET: Commandes/Details/5 public ActionResult Details(int?id) { var result = from Orders in db.orders select Orders; Commandes Order = null; List <Panier> CO = new List <Panier>(); foreach (Commandes o in result) { if (o.Id_cli == int.Parse(Session["id"].ToString()) && o.check == 1) { Order = o; //System.Diagnostics.Debug.WriteLine(Order.Id_commande); } } var result2 = from Panier in db.Paniers select Panier; if (Order != null) { foreach (Panier co in result2) { if (co.Id_commande == Order.Id_commande) { CO.Add(co); //System.Diagnostics.Debug.WriteLine(co.Id_commande); } } var result3 = from Produits in db.Product select Produits; for (int i = 0; i < CO.Count; i++) { foreach (Produits p in result3) { if (CO[i].Id_prod == p.Id_prod) { CO[i].p = p; //System.Diagnostics.Debug.WriteLine(CO[j].p.Name_produits); } } } for (int i = 0; i < CO.Count; i++) { if (CO[i].Id_commande == Order.Id_commande) { Order.Prod.Add(CO[i].p); } } } return(View(Order)); }
public ActionResult Edit([Bind(Include = "Id_commande,Id_cli")] Commandes commandes) { if (ModelState.IsValid) { db.Entry(commandes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("index")); } ViewBag.Id_cli = new SelectList(db.Client, "Id_cli", "Firstname", commandes.Id_cli); return(View(commandes)); }
public ActionResult Modifier(Commandes uneCde) { try { Commandes.updateCommande(uneCde); return(View()); } catch (MonException e) { return(HttpNotFound()); } }
public ActionResult Create(Commandes commande) { try { repoCommande.InsertItem(commande); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Create([Bind(Include = "Id_commande,Id_cli")] Commandes commandes) { if (ModelState.IsValid) { db.orders.Add(commandes); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id_cli = new SelectList(db.Client, "Id_cli", "Firstname", commandes.Id_cli); return(View(commandes)); }
public ActionResult Modifier(string id) { try { Commandes uneCde = Commandes.getCommande(id); return(View(uneCde)); } catch (MonException e) { return(HttpNotFound()); } }
public async Task <ActionResult <CommandesDTO> > PostCommandes(Commandes commandes) { //_context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT [dbo].[commandes] ON"); _context.Commandes.Add(commandes); await _context.SaveChangesAsync(); //_context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT [dbo].[commandes] OFF"); var commandesDTO = CommandeToCommandeDTO(commandes); return(CreatedAtAction("GetCommandes", new { id = commandes.Id }, commandesDTO)); }
public ActionResult Edit(Commandes commande) { try { repoCommande.UpdateItem(commande); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Details(String id) { try { Commandes comm = Commandes.getCommande(id); comm.ListeDetails = Models.Metier.Details.getDetails(id); return(View(comm)); } catch (MonException e) { return(HttpNotFound()); } }
// GET: Commandes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Commandes commandes = db.orders.Find(id); if (commandes == null) { return(HttpNotFound()); } return(View(commandes)); }
// GET: Commandes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Commandes commandes = db.orders.Find(id); if (commandes == null) { return(HttpNotFound()); } ViewBag.Id_cli = new SelectList(db.Client, "Id_cli", "Firstname", commandes.Id_cli); return(View(commandes)); }
public OrderDetailsModel(Details_commande obj, Commandes order, Produits product) { this.Id = obj.Id; this.Quantity = obj.Quantity; this.TotalPrice = obj.TotalPrice; this.ProduitsId = obj.ProduitsId; this.CommandesId = obj.CommandesId; this.Sub_total = obj.Sub_total; this.Order = new OrderModel(order, order.status); this.Product = new ProductModel(product, from i in product.Images select new ImagesModel(i), from r in product.reviews select new ReviewsModel(r) ); }
public ActionResult Ajouter(String noVendeur, String noClient, String noCommande, String dateCde, String Facture, String noArticle, String qteCdee, String livree) { try { Commandes uneCde = new Commandes(noCommande, noClient, noVendeur, dateCde, Facture, noArticle, qteCdee, livree); Commandes.addCommande(uneCde); return(RedirectToAction("Index", "Commande")); } catch (MonException e) { return(HttpNotFound()); } }
private CommandesDTO CommandeToCommandeDTO(Commandes commandes) { _context.Entry(commandes) .Reference(c => c.Panier) .Load(); return(new CommandesDTO { Id = commandes.Id, Livraison = commandes.Livraison, Payment = commandes.Payment, TotalQt = commandes.TotalQt, TotalPrix = commandes.TotalPrix, Panier = commandes.Panier }); }
public void EditerCommande(CommandeWPF b) { if (Commandes.Count() > 0) { for (int i = 0; i < Commandes.Count(); i++) { if (Commandes[i].commandeId == b.commandeId) { Commandes[i].biereId = b.biereId; Commandes[i].commandeQuantite = b.commandeQuantite; i = Commandes.Count() + 2; } } } DalCom.Update(b.GetCommandeDal()); }
public ActionResult Detail(string id) { IEnumerable <Commandes> uneCde = null; try { uneCde = Commandes.getListeDeCommande(id); return(View(uneCde)); } catch (MonException e) { ModelState.AddModelError("Erreur", "Erreur lors de la récupération des commandes : " + e.Message); return(View("Error")); } }
public ActionResult AjouterDetail(string noCommande, string noArticle, string qteCdee, string livree) { Commandes uneCde = new Commandes(noCommande, noArticle, qteCdee, livree); try { Commandes.addDetailCommande(uneCde); return(RedirectToAction("Detail", "Commande")); } catch (MonException e) { ModelState.AddModelError("Erreur", "Erreur lors de la récupération des commandes : " + e.Message); return(View("Error")); } }
public ActionResult Index() { IEnumerable <Commandes> commandes = null; try { commandes = Commandes.getCommandes(); } catch (MonException e) { ModelState.AddModelError("Erreur", "Erreur lors de la récupération des commandes : " + e.Message); return(View("Error")); } return(View(commandes)); }
/// <summary> /// Méthode bouton Click. Permet d'Ajouter une Commandes à la base de donnée. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click_1(object sender, RoutedEventArgs e) { try { Commandes commandes = new Commandes(Manager.UtilisateursEnCours, Manager.Panier); Manager.Ajouter(commandes); Manager.Panier.Clear(); Manager.ActualiserCountPanier(); new FenetrePopUp("Votre commande a été acceptée", "OK!"); Close(); } catch (Exception ex) { new FenetrePopUp(ex.Message, "OK!"); } }
public async Task <ActionResult> Create(Commandes cmd) { string Baseurl = "http://localhost:8080/SpringMVC/servlet/"; using (var pb = new HttpClient()) { pb.BaseAddress = new Uri(Baseurl); pb.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var response = await pb.PostAsJsonAsync("addCommande", cmd); if (response.IsSuccessStatusCode) { return(RedirectToAction("Index")); } } return(View(cmd)); }
public ActionResult Edit(Commandes cmd) { using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:8080/SpringMVC/servlet/"); //HTTP POST var putTask = client.PutAsJsonAsync <Commandes>("updateCommandes", cmd); putTask.Wait(); var result = putTask.Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("Index")); } } return(View(cmd)); }
/// <summary> /// Méthode permettant de récupérer les données du document sauvegardés dans un fichier /// </summary> private void Récupérer() { try { using (var ficArticles = File.OpenRead(NomFichierPhilatélie)) { var formateur = new BinaryFormatter(); formateur.Binder = new LierAssemblagesSimplement(); m_articles = (Stack <ArticlePhilatélique>)formateur.Deserialize(ficArticles); m_noProchainArticle = (int)formateur.Deserialize(ficArticles); Commandes.InitialiserAnnulables((Stack <ICommande>)formateur.Deserialize(ficArticles)); m_tousLesMotifs = (ICollection <string>)formateur.Deserialize(ficArticles); } } catch (FileNotFoundException) { m_articles = new Stack <ArticlePhilatélique>(); m_noProchainArticle = NoPremierArticle; } }
public ActionResult Supprimer(Commandes com) { IEnumerable <Commandes> commandes = null; try { // utilisation possible de Request // String s= Request["Societe"]; string num = Request["NoCommande"]; Commandes.deleteCommande(num); commandes = Commandes.getCommandes(); return(View("Index", commandes)); } catch (MonException e) { return(HttpNotFound()); } }
// GET: Commandes/Edit/5 public ActionResult Edit(int id) { Commandes cmd = null; using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:8080/SpringMVC/servlet/"); //HTTP GET var responseTask = client.GetAsync("updateCommandes/" + id.ToString()); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <Commandes>(); readTask.Wait(); cmd = readTask.Result; } } return(View(cmd)); }
public ActionResult DeleteConfirmed(int id) { Commandes order = db.orders.Find(id); var result2 = from Panier in db.Paniers select Panier; List <Panier> CO = new List <Panier>(); foreach (Panier co in result2) { if (co.Id_commande == order.Id_commande) { CO.Add(co); //System.Diagnostics.Debug.WriteLine(co.Id_commande); } } for (int i = 0; i < CO.Count(); i++) { db.Paniers.Remove(CO[i]); } db.orders.Remove(order); db.SaveChanges(); return(RedirectToAction("Index")); }