/// <summary> /// Inserts a product and creates exchange and venue if needed /// </summary> /// <param name="p"></param> /// <param name="deleteExisting"></param> public void Insert(K2DataObjects.Product p, bool deleteExisting) { try { K2DS.K2ProductDS productDS = new K2DS.K2ProductDS(); List<K2DataObjects.Product> products = productDS.GetProducts(p.TradeVenue, p.Mnemonic); foreach (K2DataObjects.Product x in products) { } if (products.Count() == 0) { productDS.Insert(p); if (productDS.GetExchange(p.Exchange).Count() == 0) { K2DataObjects.Exchange e = new K2DataObjects.Exchange(); e.ExchangeCode = p.Exchange; e.Name = p.Exchange; productDS.Insert(e); } if (productDS.GetVenue(p.TradeVenue).Count() == 0) { K2DataObjects.TradeVenue v = new K2DataObjects.TradeVenue(); v.Code = p.TradeVenue; v.Name = p.TradeVenue; productDS.Insert(v); } } else { if (deleteExisting) { productDS.Delete(p); productDS.Insert(p); } } } catch (Exception myE) { } }
public void Update(Product product) { K2DS.K2ProductDS productDS = new K2DS.K2ProductDS(); productDS.Insert(product); }