public decimal?GetMyCurrentPriceFor(PricesDataAccess.PriceType type) { using (var dao = new PricesDataAccess()) { return(dao.GetPrice("1005", type)); } }
private Price GetPricesForLDU(string provider) { using (var pda = new PricesDataAccess()) { return(pda.GetPrice(provider)); } }
public decimal?GetPriceForReceipt(string provider) { using (var pda = new PricesDataAccess()) { var prices = pda.GetPrice(provider); if (prices == null) { log.Error(string.Format("GetPriceForReceipt: price not found for LDU {0}", provider)); return(null); } return(prices.PositionReport); } }
internal void Import(MemoryStream s) { var zipFile = new ICSharpCode.SharpZipLib.Zip.ZipFile(s); Stream stream = zipFile.GetInputStream(0); DBDataContext context = null; try { XmlDocument ddpxml = new XmlDocument(); ddpxml.Load(stream); context = new DBDataContext(Config.ConnectionString); //--------------------------------------------------- XmlNamespaceManager nsmanager = new XmlNamespaceManager(ddpxml.NameTable); nsmanager.AddNamespace("pr", "http://gisis.imo.org/XML/LRIT/pricingFile/2008"); //--------------------------------------------------- var prices = new List <Price>(); foreach (XmlNode price in ddpxml.SelectNodes("/pr:PricingFile/pr:PriceList", nsmanager)) { var p = new Price(); //Effective date p.effectiveDate = DateTime.Parse(price.Attributes["effectiveDate"].Value, CultureInfo.InvariantCulture); //Issue date p.issueDate = null; if (price.Attributes["issueDate"] != null) { p.issueDate = DateTime.Parse(price.Attributes["issueDate"].Value, CultureInfo.InvariantCulture); } //Datacenter ID p.dataCentreID = price.Attributes["dataCentreID"].Value; //Data Providers (list) if (price["dataProviderID"] != null) { foreach (string dataProvider in price["dataProviderID"].InnerText.Split(' ')) { var pup = new PriceUserProvider(); pup.dataProviderID = dataProvider; p.PriceUserProviders.Add(pup); } } var bd = price["BreakDown"]; p.currency = bd.Attributes["currency"].Value; p.ArchivePositionReport = decimal.Parse(bd["ArchivePositionReport"].InnerText, CultureInfo.InvariantCulture); p.PeriodicRateChange = decimal.Parse(bd["PeriodicRateChange"].InnerText, CultureInfo.InvariantCulture); p.Poll = decimal.Parse(bd["Poll"].InnerText, CultureInfo.InvariantCulture); p.PositionReport = decimal.Parse(bd["PositionReport"].InnerText, CultureInfo.InvariantCulture); prices.Add(p); } var pdao = new PricesDataAccess(context); pdao.Create(prices.ToArray()); } catch (Exception ex) { if (context != null) { context.Dispose(); } throw new Exception("Unable to Import Pricing File", ex); } finally { if (context != null) { context.Dispose(); } } }