public EVFitting SelectFitSummaryByPublicID(string fittingPublicId, IImageResolver imageResolver, int tradeHubID) { EveShoppingContext contexto = new EveShoppingContext(); EVFitting fit = (from f in contexto.eshFittings join it in contexto.invTypes on f.shipTypeID equals it.typeID join p in contexto.eshPrices on new { tradeHubID = tradeHubID, it.typeID } equals new { tradeHubID = tradeHubID, p.typeID } where f.publicID == fittingPublicId select new EVFitting { Description = f.description, ItemID = f.fittingID, Name = f.name, ShipID = f.shipTypeID.Value, ShipName = f.invType.typeName, ShipVolume = f.shipVolume, Units = 1, ShipPrice = p.avg, TotalPrice = p.avg, Volume = f.shipVolume, PublicID = f.publicID }).FirstOrDefault(); fit.ImageUrl32 = imageResolver.GetImageURL(fit.ShipID); LogicaFittings logicaFits = new LogicaFittings(); logicaFits.AddFittingHardwaresToFitting(contexto, imageResolver, tradeHubID, fit); //AddFittingHardwareToFittingSummary(imageResolver, contexto, fit); return(fit); }
public IEnumerable <EVFitting> SelectFitsInShoppingList(string publicID, IImageResolver imageResolver) { EveShoppingContext contexto = new EveShoppingContext(); List <EVFitting> fittings = new List <EVFitting>(); IEnumerable <QFitting> qfittings = (from sl in contexto.eshShoppingLists join slf in contexto.eshShoppingListFittings on sl.shoppingListID equals slf.shoppingListID join f in contexto.eshFittings on slf.fittingID equals f.fittingID join it in contexto.invTypes on f.shipTypeID equals it.typeID join p in contexto.eshPrices on new { sl.tradeHubID, it.typeID } equals new { tradeHubID = p.solarSystemID, p.typeID } where sl.publicID == publicID select new QFitting { Description = f.description, PublicID = f.publicID, FittingID = f.fittingID, Name = f.name, ShipID = f.shipTypeID.Value, ShipName = f.invType.typeName, ShipVolume = f.shipVolume, Units = slf.units, ShipPrice = p.avg, Price = p.avg * slf.units, Volume = f.shipVolume * slf.units, InvType = it }); int tradeHubID = contexto.eshShoppingLists.Where(s => s.publicID == publicID).FirstOrDefault().tradeHubID; LogicaFittings logicaFittings = new LogicaFittings(); return(logicaFittings.MountFittingCommon(contexto, qfittings, imageResolver, tradeHubID)); }
public EVFitting SelectFitSummary(string publicID, int fittingID, IImageResolver imageResolver) { EveShoppingContext contexto = new EveShoppingContext(); eshShoppingList shlist = contexto.eshShoppingLists.Where(s => s.publicID == publicID).FirstOrDefault(); EVFitting fit = (from slf in contexto.eshShoppingListFittings join f in contexto.eshFittings on slf.fittingID equals f.fittingID join it in contexto.invTypes on f.shipTypeID equals it.typeID join p in contexto.eshPrices on new { tradeHubID = slf.eshShoppingList.tradeHubID, it.typeID } equals new { tradeHubID = p.solarSystemID, p.typeID } where slf.eshShoppingList.publicID == publicID && slf.fittingID == fittingID select new EVFitting { Description = f.description, ItemID = f.fittingID, Name = f.name, ShipID = f.shipTypeID.Value, ShipName = f.invType.typeName, ShipVolume = f.shipVolume, Units = slf.units, ShipPrice = p.avg, TotalPrice = p.avg * slf.units, Volume = f.shipVolume * slf.units, PublicID = f.publicID }).FirstOrDefault(); fit.ImageUrl32 = imageResolver.GetImageURL(fit.ShipID); //AddFittingHardwareToFittingSummary(imageResolver, contexto, fit); LogicaFittings logicafit = new LogicaFittings(); logicafit.AddFittingHardwaresToFitting(contexto, imageResolver, shlist.tradeHubID, fit); return(fit); }