public static void AddItem(EVEItem item)
        {
            var result = (from t in _pricesContext.tblActiveItems
                          where (t.itemID == item.TypeID)
                          select t).ToList();

            if (result.Count == 0)
            {
                tblActiveItem newItem = new tblActiveItem();
                newItem.itemID      = item.TypeID;
                newItem.isActive    = true;
                newItem.lastUpdated = null;

                _pricesContext.tblActiveItems.InsertOnSubmit(newItem);

                _pricesContext.SubmitChanges();
            }
            else
            {
                tblActiveItem foundItem = result.First();
                if (foundItem.isActive == false)
                {
                    foundItem.isActive = true;
                    _pricesContext.SubmitChanges();
                }
            }
        }
        public static void AddItem(EVEItem item)
        {
            var result = (from t in _pricesContext.tblActiveItems
                          where (t.itemID == item.TypeID)
                          select t).ToList();

            if (result.Count == 0)
            {
                tblActiveItem newItem = new tblActiveItem();
                newItem.itemID = item.TypeID;
                newItem.isActive = true;
                newItem.lastUpdated = null;

                _pricesContext.tblActiveItems.InsertOnSubmit(newItem);

                _pricesContext.SubmitChanges();
            }
            else
            {
                tblActiveItem foundItem = result.First();
                if (foundItem.isActive == false)
                {
                    foundItem.isActive = true;
                    _pricesContext.SubmitChanges();
                }
            }
        }
        public static decimal? JitaBuyPrice(EVEItem item)
        {
            if (_jitaBuyCache.ContainsKey(item.TypeID))
                return _jitaBuyCache[item.TypeID];

            decimal? result = (from t in _pricesContext.vwBestPrices
                               where (t.typeId == item.TypeID && t.stationId == _jitaStationID)
                               select t.buyPrice).FirstOrDefault();

            if (result.HasValue)
                _jitaBuyCache.Add(item.TypeID, result.Value);

            AddItem(item);

            return result;
        }
        public static decimal?JitaSellPrice(EVEItem item)
        {
            if (_jitaSellCache.ContainsKey(item.TypeID))
            {
                return(_jitaSellCache[item.TypeID]);
            }

            decimal?result = (from t in _pricesContext.vwBestPrices
                              where (t.typeId == item.TypeID && t.stationId == _jitaStationID)
                              select t.sellPrice).FirstOrDefault();

            if (result.HasValue)
            {
                _jitaSellCache.Add(item.TypeID, result.Value);
            }

            AddItem(item);

            return(result);
        }
Example #5
0
        static void Main(string[] args)
        {
            Logger.Level["App"].Push("InvCalc");

            //doInventionPhase("800mm Repeating Artillery II");

            TextWriter writer = new StreamWriter("output.csv");

            writer.WriteLine("Name,InventionCost,InventionChance,SuccessfulInventionCost,ManufactureCost,ItemPrice,ProfitPerRun,ProfitPerDay,ProductionTime");

            foreach (int typeID in PricesHelper.GetInventedTypes())
            {
                EVEItem item = EVECache.GetItem(typeID);

                doWork(item.TypeName, writer);
            }

            writer.Flush();
            writer.Close();

            Logger.Log.InfoFormat("Cached items: {0}", EVECache.CachedItemCount);
        }