Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.62 KB | None | 0 0
  1.         // TRI DES ITEMS PAR FOURNISSEUR + COMPARAISON
  2.         public void ListProdLienProv()
  3.         {
  4.             List<Product> ListEprom = new List<Product>();
  5.             List<Product> ListSynnex = new List<Product>();
  6.             List<Product> ListDH = new List<Product>();
  7.             List<Product> ListUpdate = new List<Product>();
  8.  
  9.             tempProdLienProv = RetrieveProdLienProv();
  10.             //listBoxSQL.Items.Clear();
  11.  
  12.             var dictionary = new Dictionary<string, Product>();
  13.  
  14.             // TRI DES PRODUITS DANS LEUR LISTE CORRESPONDANTE
  15.             foreach (var item in tempProdLienProv)
  16.             {
  17.                 if (item.Dispo != "ACTIF")
  18.                     continue;
  19.                
  20.                 if (dictionary.ContainsKey(item.ProductID))
  21.                 {
  22.  
  23.                     //TODO : Changer le champ string Price pour un champ en decimal
  24.                     decimal.TryParse(dictionary[item.ProductID].Price, out var currentPrice);
  25.                     decimal.TryParse(dictionary[item.ProductID].Qte, out var Quantite);
  26.                     decimal.TryParse(item.Price, out var newPrice);
  27.                     decimal.TryParse(item.Qte, out var newQuantite);
  28.  
  29.                     if (newPrice < currentPrice && newQuantite < Quantite)
  30.                         dictionary[item.ProductID] = item;
  31.                 }
  32.                 else
  33.                     dictionary.Add(item.ProductID, item);
  34.             }
  35.  
  36.             //Ta nouvelle list est dans le dictionary:)
  37.             foreach (var item in dictionary)
  38.             {
  39.                 //item.Value
  40.             }
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement