Exemplo n.º 1
0
        public EDDN.CommodityObject GetCommodityFromFDevIDs(IBE.SQL.Datasets.dsEliteDB.tbcommoditybaseDataTable basedata, Newtonsoft.Json.Linq.JToken commodityItem, bool param1)
        {
            EDDN.CommodityObject commodityObject = null;
            String skuString = null;

            try
            {
                if (commodityItem != null)
                {
                    if (commodityItem.SelectToken("id", false) == null)
                    {
                        throw new NotSupportedException(String.Format("Missing id : {0}", commodityItem));
                    }

                    SQL.Datasets.dsEliteDB.tbcommoditybaseRow itemData = basedata.FindByid((Int32)commodityItem.SelectToken("id", false));

                    if (itemData != null)
                    {
                        commodityObject = new EDDN.CommodityObject();

                        commodityObject.Id       = itemData.id;
                        commodityObject.Name     = itemData.name;
                        commodityObject.Category = itemData.category;
                        commodityObject.Symbol   = itemData.symbol;
                    }
                    else
                    {
                        throw new NotSupportedException(String.Format("Unknown commodity : {0}", commodityItem));
                    }
                }
                else
                {
                    Debug.Print("!");
                }

                return(commodityObject);
            }
            catch (NotSupportedException ex)
            {
                Program.MainLog.Log(String.Format("Converting error: {0}", ex.Message));
            }
            catch (Exception ex)
            {
                throw new Exception("Error while converting companion data to commodity object", ex);
            }

            return(null);
        }
Exemplo n.º 2
0
        public EDDN.CommodityObject GetCommodityFromFDevIDs(IBE.SQL.Datasets.dsEliteDB.tbcommoditybaseDataTable basedata, Newtonsoft.Json.Linq.JToken commodityItem, bool param1)
        {
            EDDN.CommodityObject commodityObject = null;  
            String skuString = null;

            try
            {
               
                if(commodityItem != null)
                { 
                    if (commodityItem.SelectToken("id", false) == null)
                        throw new NotSupportedException(String.Format("Missing id : {0}", commodityItem));

                    SQL.Datasets.dsEliteDB.tbcommoditybaseRow itemData = basedata.FindByid((Int32)commodityItem.SelectToken("id", false));

                    if(itemData != null)
                    {
                        commodityObject = new EDDN.CommodityObject();

                        commodityObject.Id         = itemData.id;
                        commodityObject.Name       = itemData.name;
                        commodityObject.Category   = itemData.category;
                        commodityObject.Average    = itemData.average;
                    }
                    else
                        throw new NotSupportedException(String.Format("Unknown commodity : {0}", commodityItem));

                }
                else
                    Debug.Print("!");

                return commodityObject;

            }
            catch (NotSupportedException ex)
            {
                Program.MainLog.Log(String.Format("Converting error: {0}", ex.Message));
            }
            catch (Exception ex)
            {
                throw new Exception("Error while converting companion data to commodity object", ex);
            }

            return null;
        }