Guest User

Untitled

a guest
Jun 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. private List<ItemsExport> MapTradeItems(List<TradeItems> tradeItem)
  2. {
  3. var retList = new List<ItemsExport>();
  4.  
  5. try
  6. {
  7.  
  8. List<StandardLookUpList > _AnalsisCodes = GetAnayalsisCodesForExportCode();
  9.  
  10.  
  11. foreach (var item in tradeItem)
  12. {
  13. retList.Add(new FuelImportSage.Classes.Export.TradeItemsExport()
  14. {
  15. ItemCode = item.ItemCode,
  16. BarCode = item.BarCode,
  17. Description = item.Description,
  18. SupplierCode = item.SupplierCode,
  19. SupplierStockCode = item.SupplierStockCode,
  20. Product_Group_Code = "",
  21. Product_Group_Desc = "",
  22. SportCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Sport).FirstOrDefault().code.ToString(),
  23. SportDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Sport).FirstOrDefault().description.ToString(),
  24. GenderCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Gender).FirstOrDefault().code.ToString(),
  25. GenderDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Gender).FirstOrDefault().description.ToString(),
  26. ColourCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Colour).FirstOrDefault().code.ToString(),
  27. ColourDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Colour).FirstOrDefault().description.ToString(),
  28. SizeCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Size).FirstOrDefault().code.ToString(),
  29. SizeDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Size).FirstOrDefault().description.ToString(),
  30. CategoryCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Category).FirstOrDefault().code.ToString(),
  31. CategoryDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Category).FirstOrDefault().description.ToString(),
  32. SearchCategoryCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.SubCategory).FirstOrDefault().code.ToString(),
  33. SeearchCategoryDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.SubCategory).FirstOrDefault().description.ToString(),
  34. Vat = item.Vat,
  35. GrossWeight = item.Weight,
  36. CommodityCode = item.CommodityCode,
  37. price_exVAT = item.price_exVAT,
  38. price_incVAT = item.price_incVAT,
  39. currentprice_exVAT = item.currentprice_exVAT,
  40. currentprice_incVAT = item.currentprice_incVAT,
  41. creation_date = item.creation_date,
  42. Inactive_date = item.Inactive_date,
  43. status = 1
  44.  
  45.  
  46.  
  47. });
  48. }
  49. }catch (Exception ex)
  50. {
  51.  
  52.  
  53. }
  54.  
  55. return retList;
  56.  
  57. }
  58.  
  59. private List<StandardLookUpList> GetAnayalsisCodesForExportCode()
  60. {
  61.  
  62.  
  63. List<StockItemSearchCategoryDescriptions_Result> _list = new List<StockItemSearchCategoryDescriptions_Result>();
  64. var retList = new List<StandardLookUpList>();
  65.  
  66. using (var db = new podium_liveEntities1())
  67. {
  68.  
  69. _list = db.Database.SqlQuery<Fuel_StockItemSearchCategoryDescriptions_Result>("Fuel_StockItemSearchCategoryDescriptions").ToList();
  70.  
  71. foreach (var item in _list)
  72. {
  73. retList.Add(new FuelImportSage.Classes.StandardLookUpList()
  74. {
  75. ItemCode = item.Code,
  76. code = item.ProductGroupCategory,
  77. description = item.ProductGroupValue
  78.  
  79.  
  80.  
  81.  
  82. });
  83. }
  84.  
  85.  
  86. }
  87. return retList;
  88. }
Add Comment
Please, Sign In to add comment