private void ProcessShareBatch(IEnumerable <XElement> elements, string nameSpace, Filing filing) { foreach (XElement element in elements) { var infoTableItem = new InfoTableItem(element, nameSpace); ProccessShare(infoTableItem, filing); } }
private Share AddShare(InfoTableItem infoTableItem, int filingId, int securityId) { var db = new StockScraperEntities(); var share = new Share { FilingId = filingId, Number = infoTableItem.NumberOfShares, Type = infoTableItem.TypeOfShares, Value = infoTableItem.Value, SecurityId = securityId }; db.Shares.Add(share); db.SaveChanges(); return(share); }
private Share ProccessShare(InfoTableItem infoTableItem, Filing filing) { Share share = null; var securityHelper = new SecurityHelper(); Security security = FindSecurity(infoTableItem.NameOfIssuer, infoTableItem.Cusip); if (security != null) { security = securityHelper.SaveSecurity(security); securityHelper.SaveSecurityMap(security, infoTableItem.Cusip); share = AddShare(infoTableItem, filing.FilingId, security.SecurityId); } else { securityHelper.AddUnknownShare(infoTableItem, filing.FilingId); } return(share); }