public QuickLookResponseParser(String rawResponse, EveItem item) { _parsedMarketOrders = new List <MarketOrder>(); _rawRequestResponse = rawResponse; _item = item; }
public Material(EveItem it) { Id = it.Id; Name = it.Name; Price = it.Price; Ammount = 1; }
private static void UpdateMaterials(MaterialDetails matInfo) { var matIds = new List<int>(); using (var repos=Core.Resolve<IEveItemRepository>()) { if (matInfo != null) foreach (var materialDto in matInfo.materialDtos) { var material = new EveItem(); if (repos.Query.Any(s => s.EveId == materialDto.materialTypeID)) { var found = repos.Query.First(s => s.EveId == materialDto.materialTypeID); if (found != null) { material = found; } } else { repos.Store(material); } material.Name = materialDto.materialTypeName; material.Volume = materialDto.materialVolume; material.MaterialDto = materialDto; material.EveId = materialDto.materialTypeID; matIds.Add(material.EveId); } repos.SaveChanges(); } Core.Resolve<EveCentalApi>().UpdatePrices(matIds); }
public void Init() { Load(); Commands = new List<PageCommand>() { new PageCommand { Name = "Сохранить", Action = p => { using (var r = _eveItemRepos()) { using (var transaction = new TransactionScope()) { var toStore = _items.Where(it => _itemsToDelete.All(toRem => it.Guid != toRem.Guid)) .ToArray(); foreach (var eveItem in toStore.Where(i => i.NeedsPriceUpdate)) { r.UpdatePrice(eveItem.Guid, eveItem.Price); eveItem.NeedsPriceUpdate = false; } r.StoreBulk(toStore); r.SaveChanges(); foreach (var toDelete in _itemsToDelete) { r.Delete(r.Find(toDelete.Guid)); } r.SaveChanges(); _itemsToDelete = new List<EveItem>(); transaction.Complete(); } } } }, new PageCommand { Name = "Загрузить", Action = p => { using (var r = EveItemRepos()) { _items = new EveItems(r.GetAll().ToList()); } ItemsGrid.ItemsSource = _items; _itemsToDelete = new List<EveItem>(); } }, new PageCommand { Name = "Новый", Action = p => { var newItem = new EveItem() { Name = "новый пердмет" }; _items.Add(newItem); ItemsGrid.SelectedItem = newItem; ItemsGrid.ScrollIntoView(newItem); } }, new PageCommand { Name = "Удалить", Action = p => { var item = (EveItem) ItemsGrid.SelectedItem; _items.Remove(item); _itemsToDelete.Add(item); } } }.ToArray(); }