//Data.API.Gw2Spidy.ItemResult result = null; public TradingPostData GetTradingPostData() { Data.API.Gw2Spidy.Item item = Data.DataProvider.GetGw2SpidyItem((int)this.Id); //if (item != null) //{ // result= item.result; //} //return new TradingPostData((int)id, result.max_offer_unit_price, result.min_sale_unit_price, result.offer_availability, result.sale_availability); return(new TradingPostData((int)this.Id, item)); }
//public TradingPostData(int itemId, string buyPrice, string sellPrice, string buy, string sale) public TradingPostData(int itemId, Data.API.Gw2Spidy.Item item) { this._ItemId = itemId; if (item == null) { this._Exception = new NullReferenceException("Trading post data not found"); return; } if (item.exception != null) { this._Exception = item.exception; return; } API.Gw2Spidy.ItemResult result = item.result; this._maxBuyCopperPart = int.Parse(result.max_offer_unit_price) % 100; this._maxBuySilverPart = (int.Parse(result.max_offer_unit_price) % 10000 - this._maxBuyCopperPart) / 100; this._maxBuyGoldPart = int.Parse(result.max_offer_unit_price) / 10000; //this._silverPart = int.Parse(price) / 100 - _goldPart * 100; this._minSellCopperPart = int.Parse(result.min_sale_unit_price) % 100; this._minSellSilverPart = (int.Parse(result.min_sale_unit_price) % 10000 - this._minSellCopperPart) / 100; this._minSellGoldPart = int.Parse(result.min_sale_unit_price) / 10000; //this._silverPart = int.Parse(price) / 100 - this._goldPart * 100; this._havingMaxBuyGoldPart = this._maxBuyGoldPart > 0; this._havingMaxBuySilverPart = this._maxBuySilverPart > 0 | this._havingMaxBuyGoldPart; this._havingMaxBuyCopperPart = this._maxBuyCopperPart > 0 | this._havingMaxBuySilverPart; this._havingMinSellGoldPart = _minSellGoldPart > 0; this._havingMinSellSilverPart = this._minSellSilverPart > 0 | this._havingMinSellGoldPart; this._havingMinSellCopperPart = this._minSellCopperPart > 0 | this._havingMinSellSilverPart; this._buyCount = int.Parse(result.offer_availability); this._sellCount = int.Parse(result.sale_availability); }