Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private List<ItemsExport> MapTradeItems(List<TradeItems> tradeItem)
- {
- var retList = new List<ItemsExport>();
- try
- {
- List<StandardLookUpList > _AnalsisCodes = GetAnayalsisCodesForExportCode();
- foreach (var item in tradeItem)
- {
- retList.Add(new FuelImportSage.Classes.Export.TradeItemsExport()
- {
- ItemCode = item.ItemCode,
- BarCode = item.BarCode,
- Description = item.Description,
- SupplierCode = item.SupplierCode,
- SupplierStockCode = item.SupplierStockCode,
- Product_Group_Code = "",
- Product_Group_Desc = "",
- SportCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Sport).FirstOrDefault().code.ToString(),
- SportDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Sport).FirstOrDefault().description.ToString(),
- GenderCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Gender).FirstOrDefault().code.ToString(),
- GenderDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Gender).FirstOrDefault().description.ToString(),
- ColourCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Colour).FirstOrDefault().code.ToString(),
- ColourDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Colour).FirstOrDefault().description.ToString(),
- SizeCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Size).FirstOrDefault().code.ToString(),
- SizeDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Size).FirstOrDefault().description.ToString(),
- CategoryCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Category).FirstOrDefault().code.ToString(),
- CategoryDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.Category).FirstOrDefault().description.ToString(),
- SearchCategoryCode = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.SubCategory).FirstOrDefault().code.ToString(),
- SeearchCategoryDesc = _AnalsisCodes.Where(w => w.ItemCode == item.ItemCode && w.code == Constants.SubCategory).FirstOrDefault().description.ToString(),
- Vat = item.Vat,
- GrossWeight = item.Weight,
- CommodityCode = item.CommodityCode,
- price_exVAT = item.price_exVAT,
- price_incVAT = item.price_incVAT,
- currentprice_exVAT = item.currentprice_exVAT,
- currentprice_incVAT = item.currentprice_incVAT,
- creation_date = item.creation_date,
- Inactive_date = item.Inactive_date,
- status = 1
- });
- }
- }catch (Exception ex)
- {
- }
- return retList;
- }
- private List<StandardLookUpList> GetAnayalsisCodesForExportCode()
- {
- List<StockItemSearchCategoryDescriptions_Result> _list = new List<StockItemSearchCategoryDescriptions_Result>();
- var retList = new List<StandardLookUpList>();
- using (var db = new podium_liveEntities1())
- {
- _list = db.Database.SqlQuery<Fuel_StockItemSearchCategoryDescriptions_Result>("Fuel_StockItemSearchCategoryDescriptions").ToList();
- foreach (var item in _list)
- {
- retList.Add(new FuelImportSage.Classes.StandardLookUpList()
- {
- ItemCode = item.Code,
- code = item.ProductGroupCategory,
- description = item.ProductGroupValue
- });
- }
- }
- return retList;
- }
Add Comment
Please, Sign In to add comment