public static string fnNombreCategoria(long categoria) { string nombre = ""; RepuestosDeMovilesDbContext dbcontext = new RepuestosDeMovilesDbContext(); EBAY_CATEGORIAS ebay_categorias = dbcontext.EBAY_CATEGORIAS.Where(w => w.CategoryID == categoria).FirstOrDefault(); if (ebay_categorias == null) { Debug.WriteLine("No encuentro la categoria"); return(""); } nombre = ebay_categorias.CategoryName; while (ebay_categorias.CategoryLevel > 1) { ebay_categorias = dbcontext.EBAY_CATEGORIAS.Where(w => w.CategoryID == ebay_categorias.CategoryParentID).FirstOrDefault(); if (ebay_categorias == null) { Debug.WriteLine("No encuentro la categoria padre"); return(""); } nombre += "->" + ebay_categorias.CategoryName; } return(nombre); }
public static SiNo fnCategoriaTecnologica(long categoria) { RepuestosDeMovilesDbContext dbcontext = new RepuestosDeMovilesDbContext(); EBAY_CATEGORIAS ebay_categorias = dbcontext.EBAY_CATEGORIAS.Where(w => w.CategoryID == categoria).FirstOrDefault(); if (ebay_categorias == null) { Debug.WriteLine("No encuentro la categoria"); return(SiNo.No); } while (ebay_categorias.CategoryLevel > 1) { ebay_categorias = dbcontext.EBAY_CATEGORIAS.Where(w => w.CategoryID == ebay_categorias.CategoryParentID).FirstOrDefault(); if (ebay_categorias == null) { Debug.WriteLine("No encuentro la categoria padre"); return(SiNo.No); } } return(ebay_categorias.Tecnologico); }