private void button4_Click(object sender, EventArgs e) { ID_Produit.ResetText(); Nom_Produit.ResetText(); Description.ResetText(); Prix.ResetText(); }
public async Task <IActionResult> PutPrix(int id, Prix prix) { if (id != prix.Id_Prix) { return(BadRequest()); } _context.Entry(prix).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrixExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void DeletePrix(long id) { Prix prix = GetPrix(id); prixtEntity.Remove(prix); context.SaveChanges(); }
private void augmenterLesPrixToolStripMenuItem_Click(object sender, EventArgs e) { Prix modifprix = new Prix(); if (modifprix.ShowDialog() == DialogResult.OK) { } }
public string PrixToString() { if (Prix == 0) { return("--"); } return(Prix.ToString("C2")); }
private void btnAjouterPrix_Click(object sender, EventArgs e) { string iDPrix = txtIDPrixCommanditaire.Text.Trim(); string description = txtDescriptionPrix.Text.Trim(); double valeur; if (!Double.TryParse(txtValeurPrix.Text, out valeur)) { DialogResult reponse = MessageBox.Show("La valeur doit etre en chiffres", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information); } double donMinimum; if (!Double.TryParse(txtDonMinimumPrix.Text, out donMinimum)) { DialogResult reponse = MessageBox.Show("Le don minimum doit etre en chiffres", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information); } int qnte_Originale; if (!Int32.TryParse(txtQuantitePrix.Text, out qnte_Originale)) { DialogResult reponse = MessageBox.Show("Le quantite doit etre en chiffres", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information); } string iDCommanditaire = txtIDCommanditaire.Text.Trim(); if (!String.IsNullOrEmpty(iDPrix) && !String.IsNullOrEmpty(description) && valeur > 0 && donMinimum > 0 && qnte_Originale > 0 && !String.IsNullOrEmpty(iDCommanditaire)) { Prix pentraindentre = new Prix(iDPrix, description, valeur, donMinimum, qnte_Originale, iDCommanditaire); if (gste.VerifierPrix(pentraindentre)) { gste.Prix.Add(pentraindentre); Prix.All_file += pentraindentre.ToFile() + "\r\n";; rtbArea.Text = "Le commanditaire est ajoute"; txtIDPrixCommanditaire.Text = String.Empty; txtDescriptionPrix.Text = String.Empty; txtValeurPrix.Text = String.Empty; txtDonMinimumPrix.Text = String.Empty; txtQuantitePrix.Text = String.Empty; txtIDCommanditaire.Text = String.Empty; txtIDPrixCommanditaire.Focus(); rtbArea.Text = gste.AfficherPrix(); } else { DialogResult reponse = MessageBox.Show("Le prix n'est pas ajoute. Vous pouvez entrer un prix avec un ID de prix nouveau et si le numero de commanditaire existe deja", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { DialogResult reponse = MessageBox.Show("Vous devez remplir tous les donnes! ", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public int CompareTo(object v) { if (v is Véhicule) { return(Prix.CompareTo(((Véhicule)v).Prix)); } else { throw new ArgumentException(); } }
//public abstract int CompareTo(object obj); public int CompareTo(object obj) { if (obj is Véhicules) { return(Prix.CompareTo(((Véhicules)obj).Prix)); } else { throw new ArgumentException(); } }
private void AfficherNiveauEtPrix() { string niveauEnemy = "Niveau " + Niveau.ToString(); string prixEnemy; if (Niveau >= 2) { prixEnemy = Prix.ToString() + " Pts"; } else { prixEnemy = Prix.ToString() + " Or"; } GestionSprite.DrawString(Arial, niveauEnemy, Position + new Vector2(76, 0), Color.White); GestionSprite.DrawString(Arial, prixEnemy, Position + new Vector2(76, 32), Color.Yellow); }
//[ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = "IdProduit,IdVille,NbPlaces,Adresse,Description")] Produits produits, double Prix, HttpPostedFileBase postedFile, string e1) { if (e1 == null) { return(RedirectToAction("Index")); } if (postedFile == null || postedFile.ContentLength <= 0) { return(RedirectToAction("Index")); } var fileName = Path.GetFileName(postedFile.FileName); if (fileName == null) { return(RedirectToAction("Index")); } var path = Path.Combine(Server.MapPath("~/Images/"), fileName); postedFile.SaveAs(path); string[] tab = e1.Trim().Split('-'); if (ModelState.IsValid) { db.Produits.Add(produits); db.SaveChanges(); var prix = new Prix() { IdProduit = produits.IdProduit, Montant = (int)Prix, DateDebut = Convert.ToDateTime(tab[0]), DateFin = Convert.ToDateTime(tab[1]) }; db.Prix.Add(prix); db.SaveChanges(); var photo = new Photos { IdProduit = produits.IdProduit, Path = path }; db.Photos.Add(photo); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdVille = new SelectList(db.Villes, "idVille", "name", produits.IdVille); return(View(produits)); }
/// <summary> /// Méthode servant à supprimer un prix /// </summary> private void miSupprimer_Click(object sender, RoutedEventArgs e) { // Le sender est le menu item MenuItem mi = sender as MenuItem; // On va chercher le parent du menu item (c'est donc un ContextMenu) ContextMenu cm = mi.Parent as ContextMenu; // Avec le context menu, on peut trouver la datagrid qui a "fabriqué" le context menu DataGrid dg = cm.PlacementTarget as DataGrid; // On peut ainsi aller chercher le prix à supprimer à partir de la datagrid (le SelectedItem) Prix p = dg.SelectedItem as Prix; // Supprimer l'objet Prix ((Tournoi)DataContext).LstPrix.Remove(p); }
protected override void OnMouseOver() { if (GameManager.isPaused) { return; } if (isDestroyed) { return; } string message = "Temps: +" + SatisfactionGénérée.ToString() + " s" + System.Environment.NewLine + System.Environment.NewLine + "Prix: " + Prix.ToString("0.00") + " €" + System.Environment.NewLine + System.Environment.NewLine + Description; PopUp.Show(Nom, message); }
public async Task <ActionResult <Prix> > PostPrix(Prix prix) { if (prix.Etat == "actuelle") { var prixList = await _context.Prix.Where(p => p.Etat == "actuelle").ToListAsync(); if (prixList != null) { foreach (var item in prixList) { item.Etat = "non actuelle"; _context.Entry(item).State = EntityState.Modified; } } } _context.Prix.Add(prix); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPrix", new { id = prix.Id_Prix }, prix)); }
public IActionResult AddProduct(ProductFormulaire model) { if (ModelState.IsValid) { Product product = new Product(); product.Nom = model.Nom; product.Image = utils.GetValueWithIndexAfterSplit('\\', 1, model.FileImage.FileName); product.Marque = model.Marque; productRepository.SaveProduct(ref product); Prix prix = new Prix(); prix.PrixUniraire = model.PrixUniraire; prixRepository.SavePrix(ref prix); Relationprix relationprix = new Relationprix(); relationprix.IdProduit = product.Id; relationprix.IdPrix = prix.Id; relationPrixRepository.SaveRelationPrix(relationprix); fileApplication.UploadFile(model.FileImage); return(RedirectToAction("ListProduct", "Product")); } return(View()); }
private void OnMouseUp() { if (GameManager.isPaused) { return; } if (GameManager.TenterAchat(Prix)) { PopUp.Hide(); GameManager.instance.PopUpTemps.enabled = true; GameManager.instance.PopUpTemps.text = "+" + SatisfactionGénérée + "s"; CancelInvoke("effacerPopUpTemps"); GameManager.instance.Invoke("effacerPopUpTemps", 2); GameManager.instance.PopUpArgent.enabled = true; GameManager.instance.PopUpArgent.text = "-" + Prix.ToString("0.00") + "€"; CancelInvoke("effacerPopUpArgent"); GameManager.instance.Invoke("effacerPopUpArgent", 2); isDestroyed = true; GameManager.AddSatisfaction(SatisfactionGénérée); GameManager.GenerateDéchet(DéchetGénérés); GameManager.GetNextAchat(); } }
/// <summary> /// returns a hash code in order to use this class in hash table /// </summary> /// <returns>hash code</returns> public override int GetHashCode() { return(Nom.GetHashCode() + Prix.GetHashCode() + DegreAlcool.GetHashCode()); }
public void SavePrix(ref Prix prix) { prixtEntity.Add(prix); context.SaveChanges(); }
private void importerToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { string nomFichier = openFileDialog1.FileName; StreamReader lecteur; string switch_ = nomFichier.Substring(nomFichier.LastIndexOf("\\"), nomFichier.Length - 1); //"commanditaires.txt", "prix.txt", "donnateurs.txt", "dons.txt" string[] donne; string ligne; switch (switch_) { case "commanditaires.txt": lecteur = new StreamReader(nomFichier); Commandiatire Commandiatire_pour_verification; while ((ligne = lecteur.ReadLine()) != null) { donne = ligne.Split(','); Commandiatire_pour_verification = new Commandiatire(donne); if (gste.VerifierCommanditaire(Commandiatire_pour_verification)) { gste.Commanditaires.Add(Commandiatire_pour_verification); Commandiatire.All_file += Commandiatire_pour_verification.ToFile() + "\r\n"; } } lecteur.Close(); break; case "prix.txt": lecteur = new StreamReader(nomFichier); Prix Prix_pour_verification; while ((ligne = lecteur.ReadLine()) != null) { donne = ligne.Split(','); Prix_pour_verification = new Prix(donne); if (gste.VerifierPrix(Prix_pour_verification)) { gste.Prix.Add(Prix_pour_verification); // Prix. = Prix_pour_verification.ToFile(); MembreSTE.Prix.All_file += Prix_pour_verification.ToFile() + "\r\n";; } } lecteur.Close(); break; case "donnateurs.txt": lecteur = new StreamReader(nomFichier); Donnateur Donnateur_pour_verification; while ((ligne = lecteur.ReadLine()) != null) { donne = ligne.Split(','); Donnateur_pour_verification = new Donnateur(donne); if (gste.VerifierDonnateur(Donnateur_pour_verification)) { gste.Donnateurs.Add(Donnateur_pour_verification); Donnateur.All_file += Donnateur_pour_verification.ToFile() + "\r\n";; } } lecteur.Close(); break; case "dons.txt": lecteur = new StreamReader(nomFichier); Don Don_pour_verification; while ((ligne = lecteur.ReadLine()) != null) { donne = ligne.Split(','); Don_pour_verification = new Don(donne); if (gste.VerifierDon(Don_pour_verification)) { gste.Dons.Add(Don_pour_verification); Don.All_file += Don_pour_verification.ToFile() + "\r\n";; } } lecteur.Close(); break; default: DialogResult reponse = MessageBox.Show("Vous devez chois un fichiet possedant l'un des nom suivant : 'commanditaires.txt', 'prix.txt', 'donnateurs.txt', 'dons.txt' ", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } } }
public void UpdatePrix(ref Prix prix) { context.Entry(prix).State = EntityState.Modified; context.SaveChanges(); }
public Tournoi ChargerTournoi() { var task = TournoiHelper.SelectLast(); task.Wait(); tournois t = task.Result; Tournoi T = new Tournoi(); if (t == null) { return(null); } else { var prix = PrixHelper.SelectAllPrixTournoiAsync(); prix.Wait(); if (prix.Result != null) { foreach (prix unPrix in prix.Result) { Prix obj; if (unPrix.equipes == null) { obj = new Prix(unPrix.nom); } else { obj = new Prix(unPrix.nom, unPrix.equipes.nom); } T.LstPrix.Add(obj); } } } // Tournoi T.Nom = t.nom; T.Date = t.dateEvenement.Date; T.Heure = t.dateEvenement.TimeOfDay; T.Description = t.description; T.TypeTournoi = t.typestournois.nom; // Locaux T.LstLocaux = ChargerLocaux(); //Tours T.LstTours = ChargerTours(); //T.VerifieGenerationValide(); // Volontaires T.LstVolontaires = ChargerVolontaires(); // Équipes T.LstEquipes = ChargerEquipes(); // Participants T.LstJoueurs = new ObservableCollection <Joueur>(); foreach (Equipe e in T.LstEquipes) { foreach (Joueur j in e.LstJoueurs) { T.LstJoueurs.Add(j); } } return(T); }
public static void init(MyDbContext myDbContext) { myDbContext.Database.EnsureDeleted(); myDbContext.Database.EnsureCreated(); //Categories var categories = new Categorie[] { new Categorie { Nom = "Ordinateur" }, new Categorie { Nom = "Portable" }, new Categorie { Nom = "Montre" }, new Categorie { Nom = "Casque" }, new Categorie { Nom = "TV" }, new Categorie { Nom = "Caméra" } }; foreach (Categorie c in categories) { myDbContext.Categories.Add(c); } myDbContext.SaveChanges(); //Villes var villes = new Ville[] { new Ville { Nom = "Agadir" }, new Ville { Nom = "Rabat" }, new Ville { Nom = "Casa" }, new Ville { Nom = "Marrakech" }, new Ville { Nom = "Tanger" }, new Ville { Nom = "Oujda" } }; foreach (Ville v in villes) { myDbContext.Villes.Add(v); } myDbContext.SaveChanges(); //Prix var prix = new Prix[] { new Prix { Price = 10000 }, new Prix { Price = 9000 }, new Prix { Price = 8000 }, new Prix { Price = 7000 }, new Prix { Price = 6000 }, new Prix { Price = 5000 } }; foreach (Prix p in prix) { myDbContext.Prix.Add(p); } myDbContext.SaveChanges(); //Vendeurs var vendeurs = new Vendeur[] { new Vendeur { Nom = "Bestmark", VilleID = 1 }, new Vendeur { Nom = "Electroplanet", VilleID = 2 }, new Vendeur { Nom = "Technoplace", VilleID = 3 }, new Vendeur { Nom = "Bestmark", VilleID = 3 }, new Vendeur { Nom = "ETCEINFO", VilleID = 4 }, new Vendeur { Nom = "Electroplanet", VilleID = 5 }, new Vendeur { Nom = "EVIMAS", VilleID = 6 }, }; foreach (Vendeur v in vendeurs) { myDbContext.Vendeurs.Add(v); } myDbContext.SaveChanges(); //Produits var produits = new Produit[] { new Produit { Designation = "HP Elitebook 840", CategorieID = 1, PrixID = 1, VendeurID = 1 }, new Produit { Designation = "iPhone 11 Pro", CategorieID = 2, PrixID = 2, VendeurID = 2 }, new Produit { Designation = "Garmin Venu", CategorieID = 3, PrixID = 3, VendeurID = 3 }, new Produit { Designation = "Bose casque", CategorieID = 4, PrixID = 6, VendeurID = 4 }, new Produit { Designation = "Samsung TV", CategorieID = 5, PrixID = 5, VendeurID = 5 }, new Produit { Designation = "SONY DSC-HX350", CategorieID = 6, PrixID = 4, VendeurID = 6 }, new Produit { Designation = "Sony ILCE-6000L", CategorieID = 6, PrixID = 1, VendeurID = 7 } }; foreach (Produit p in produits) { myDbContext.Produits.Add(p); } myDbContext.SaveChanges(); //Clients var clients = new Client[] { new Client { Nom = "Mohamed", VilleID = 1 }, new Client { Nom = "Aziz", VilleID = 2 }, new Client { Nom = "Karim", VilleID = 3 }, new Client { Nom = "Imad", VilleID = 4 }, new Client { Nom = "omar", VilleID = 5 }, new Client { Nom = "brahim", VilleID = 6 } }; foreach (Client c in clients) { myDbContext.Clients.Add(c); } myDbContext.SaveChanges(); //Commandes var Commandes = new Commande[] { new Commande { Quantite = 2, ProduitID = 1, ClientID = 1 }, new Commande { Quantite = 3, ProduitID = 2, ClientID = 2 }, new Commande { Quantite = 4, ProduitID = 3, ClientID = 3 }, new Commande { Quantite = 1, ProduitID = 4, ClientID = 4 }, new Commande { Quantite = 2, ProduitID = 5, ClientID = 5 }, new Commande { Quantite = 3, ProduitID = 6, ClientID = 6 }, new Commande { Quantite = 1, ProduitID = 7, ClientID = 4 } }; foreach (Commande c in Commandes) { myDbContext.Commandes.Add(c); } myDbContext.SaveChanges(); //Distances var distances = new Distance[] { new Distance { distance = 549, VilleDepartID = 1, VilleArriveID = 2 }, new Distance { distance = 465, VilleDepartID = 1, VilleArriveID = 3 }, new Distance { distance = 248, VilleDepartID = 1, VilleArriveID = 4 }, new Distance { distance = 803, VilleDepartID = 1, VilleArriveID = 5 }, new Distance { distance = 1075, VilleDepartID = 1, VilleArriveID = 6 }, new Distance { distance = 90, VilleDepartID = 2, VilleArriveID = 3 }, new Distance { distance = 327, VilleDepartID = 2, VilleArriveID = 4 }, new Distance { distance = 308, VilleDepartID = 2, VilleArriveID = 5 }, new Distance { distance = 518, VilleDepartID = 2, VilleArriveID = 6 }, new Distance { distance = 241, VilleDepartID = 3, VilleArriveID = 4 }, new Distance { distance = 342, VilleDepartID = 3, VilleArriveID = 5 }, new Distance { distance = 618, VilleDepartID = 3, VilleArriveID = 6 }, new Distance { distance = 577, VilleDepartID = 4, VilleArriveID = 5 }, new Distance { distance = 851, VilleDepartID = 4, VilleArriveID = 6 }, new Distance { distance = 722, VilleDepartID = 5, VilleArriveID = 6 }, }; foreach (Distance d in distances) { myDbContext.Distances.Add(d); } myDbContext.SaveChanges(); }
private void spComm_DataReceived(object sender, SerialDataReceivedEventArgs e) { string Trame = ((SerialPort)sender).ReadTo(((char)03).ToString()) + (char)03; Invoke(new Action(() => { #if Encryption Ecriture(Trame, "reception.txt", FileMode.Create, true); string Texte = Lecture("reception.txt", true); #else Ecriture(Trame, "reception.txt", FileMode.Create); string Texte = Lecture("reception.txt"); #endif ResultatTrame RTrame = new ResultatTrame(Texte); if (RTrame.Valide) { spComm.Write(((char)06).ToString()); //Envoie un ACK m_Abandon = 0; //s'assure que le compteur de trame invalide recue est a 0 //Le code pour la verification de la date est ici: bool DateValide = true; if (RTrame.Heure < 8 || RTrame.Heure > 17) { DateValide = false; } else { if ((RTrame.Mois == 1 && RTrame.Jour == 1) || (RTrame.Mois == 10 && RTrame.Jour == 14) || (RTrame.Mois == 12 && RTrame.Jour == 25)) { DateValide = false; } } if (DateValide) { int Quantite; decimal Prix; if (InventaireUpdate(RTrame.Data, out Quantite, out Prix)) { txtCheckSum.Text = RTrame.CheckSum; txtDate.Text = RTrame.DateHeure; txtNomArt.Text = RTrame.Data; //Changer pour des vrai nom txtPrixArt.Text = Prix.ToString("C"); txtQuantitéRest.Text = Quantite.ToString(); txtTaxe.Text = Math.Round((Prix * 0.14975M), 2, MidpointRounding.AwayFromZero).ToString("C"); txtTotal.Text = Math.Round((Prix * 1.14975M), 2, MidpointRounding.AwayFromZero).ToString("C"); } } else { MessageBox.Show("Merci pour votre travail hors des heures rémunérées"); } } else { //code NAK goes here m_Abandon++; //incremente la variable qui compte le nombre de trame invalide recue #if Encryption Ecriture(Texte + '\n', "ArchiveErreur.txt", FileMode.Append, false); #else Ecriture(Texte + '\n', "ArchiveErreur.txt", FileMode.Append); #endif if (m_Abandon > 10) //Verifie combien de fois la trame recue est invalide { spComm.Write(((char)24).ToString()); //Envoie un Cancel m_Abandon = 0; } else { spComm.Write(((char)21).ToString());//Garde espoire que le lecteur de barre code vas dire quelque chose qui va faire du sens et lui demande de repeter (envoie un NAK) } } })); }