Ejemplo n.º 1
0
        public eshFitting MountFittingFromFittingAnalysed(FittingAnalyzed fit)
        {
            RepositorioItems repo = new RepositorioItems();

            eshFitting salida = new eshFitting();

            salida.name        = fit.Name;
            salida.description = fit.Description;
            invType shipType = repo.SelectItemTypePorName(fit.Ship);

            if (shipType == null)
            {
                throw new ApplicationException(Messages.err_nombreItemAnalizadaNoExiste);
            }
            salida.shipTypeID = shipType.typeID;
            salida.shipVolume = RepositorioItems.GetVolume(shipType);

            double totalVol = salida.shipVolume;

            foreach (var item in fit.Items)
            {
                eshFittingHardware fhwd = MountFittingHardware(item, repo);
                salida.eshFittingHardwares.Add(fhwd);
                totalVol += fhwd.volume;
            }
            salida.volume = totalVol;


            return(salida);
        }
Ejemplo n.º 2
0
        public MarketItem SelectMarketItemByID(string publicID, int id, IImageResolver imageResolver)
        {
            EveShoppingContext context = new EveShoppingContext();


            var query =
                (from sl in context.eshShoppingLists
                 join slit in context.eshShoppingListInvTypes on sl.shoppingListID equals slit.shoppingListID
                 join it in context.invTypes on slit.typeID equals it.typeID
                 join p in context.eshPrices on new { sl.tradeHubID, slit.typeID } equals new { tradeHubID = p.solarSystemID, p.typeID }
                 where sl.publicID == publicID && slit.typeID == id
                 select new
            {
                ItemID = slit.typeID,
                Name = it.typeName,
                Units = slit.units,
                TotalPrice = p.avg * slit.units,
                Volume = it.volume.Value * slit.units,
                ItemType = it
            });
            var        qmi = query.FirstOrDefault();
            MarketItem mi  = new MarketItem()
            {
                ItemID     = qmi.ItemID,
                Name       = qmi.Name,
                Units      = qmi.Units,
                TotalPrice = qmi.TotalPrice,
                UnitPrice  = qmi.TotalPrice / qmi.Units,
                Volume     = RepositorioItems.GetVolume(qmi.ItemType) * qmi.Units,
                ImageUrl32 = imageResolver != null?imageResolver.GetImageURL(qmi.ItemID) : string.Empty
            };

            return(mi);
        }
Ejemplo n.º 3
0
        public eshFittingHardware MountFittingHardware(FittingHardwareAnalyzed fithwd, RepositorioItems repo)
        {
            invType tipo = repo.SelectItemTypePorName(fithwd.Name);

            if (tipo == null)
            {
                throw new ApplicationException(string.Format("{0}: {1}", Messages.err_nombreItemAnalizadaNoExiste, fithwd.Name));
            }
            eshFittingHardware salida = new eshFittingHardware();

            salida.typeID         = tipo.typeID;
            salida.positionInSlot = 0;
            salida.slotID         = fithwd.Slot;
            salida.units          = fithwd.Units;
            salida.volume         = RepositorioItems.GetVolume(tipo) * fithwd.Units;

            return(salida);
        }
Ejemplo n.º 4
0
        public IList <MarketItem> SelectMarketItemsEnShoppingList(string publicID, IImageResolver imageResolver)
        {
            EveShoppingContext context = new EveShoppingContext();

            IList <MarketItem> miList = new List <MarketItem>();

            var qlistaItems =
                (from sl in context.eshShoppingLists
                 join slit in context.eshShoppingListInvTypes on sl.shoppingListID equals slit.shoppingListID
                 join it in context.invTypes on slit.typeID equals it.typeID
                 join p in context.eshPrices on new { sl.tradeHubID, slit.typeID } equals new { tradeHubID = p.solarSystemID, p.typeID }
                 where sl.publicID == publicID
                 select new
            {
                ItemID = slit.typeID,
                Name = it.typeName,
                Units = slit.units,
                TotalPrice = p.avg * slit.units,
                invType = it
            });

            foreach (var item in qlistaItems)
            {
                MarketItem mi =
                    new MarketItem()
                {
                    ItemID     = item.ItemID,
                    Name       = item.Name,
                    Units      = item.Units,
                    TotalPrice = item.TotalPrice,
                    UnitPrice  = item.TotalPrice / item.Units,
                    Volume     = RepositorioItems.GetVolume(item.invType) * item.Units,
                    ImageUrl32 = imageResolver != null?imageResolver.GetImageURL(item.ItemID) : string.Empty
                };
                miList.Add(mi);
            }

            return(miList);
        }
Ejemplo n.º 5
0
        internal IEnumerable <EVFitting> MountFittingCommon(EveShoppingContext contexto, IEnumerable <QFitting> qfittings, IImageResolver imageResolver, int tradeHubID)
        {
            List <EVFitting> fittings = new List <EVFitting>();

            foreach (var qfit in qfittings)
            {
                if (string.IsNullOrEmpty(qfit.PublicID))
                {
                    qfit.PublicID = Guid.NewGuid().ToString();
                }
                EVFitting fit = new EVFitting
                {
                    Description = qfit.Description,
                    PublicID    = qfit.PublicID,
                    ItemID      = qfit.FittingID,
                    Name        = qfit.Name,
                    ShipID      = qfit.ShipID,
                    ShipName    = qfit.ShipName,
                    ShipVolume  = qfit.ShipVolume,
                    Units       = qfit.Units,
                    ShipPrice   = qfit.ShipPrice,
                    TotalPrice  = qfit.Price,
                };

                fit.ImageUrl32 = imageResolver != null?imageResolver.GetImageURL(qfit.ShipID) : string.Empty;;
                fit.ShipVolume = RepositorioItems.GetVolume(qfit.InvType);
                fit.Volume     = fit.ShipVolume * fit.Units;
                fittings.Add(fit);



                AddFittingHardwaresToFitting(contexto, imageResolver, tradeHubID, fit);
            }

            return(fittings);
        }