Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         return;
     }
     try
     {
         var dtst   = (DtstFilingSearchResult)Session["dtst"];
         var resId  = int.Parse(Request.QueryString["resultId"]);
         var result = dtst.MPSresults.FindByrowID(resId);
         LabelSnippet.Text       = result.Paragraph;
         TextCompany.Text        = Dbo.FilterName(result.Company);
         Calendar1.SelectedDate  = result.Date;
         Calendar1.VisibleDate   = result.Date;
         TextBoxYear.Text        = result.Date.Year.ToString();
         TextBoxMonth.Text       = result.Date.Month.ToString();
         TextEvent.Text          = result.Keyword;
         TextBoxDescription.Text = "";
         TextBoxKeywords.Text    = result.Keyword;
         Panel1.Visible          = true;
         LabelAlarm.Visible      = false;
         var evnts = new CompanyManager().GetEventTypes();
         DropDownEvents.DataSource     = evnts;
         DropDownEvents.DataTextField  = evnts.event_typeColumn.ColumnName;
         DropDownEvents.DataValueField = evnts.event_typeColumn.ColumnName;
         DropDownEvents.DataBind();
     }
     catch (Exception ex)
     {
         Panel1.Visible     = false;
         LabelAlarm.Text    = "ERROR: most likely cause, your session has expired." + "<br /><br /><br />" + ex.ToString();
         LabelAlarm.Visible = true;
     }
 }
Esempio n. 2
0
        private void CreateEvents(IList <string> acts, IList <DateTime> dates, string companynName, DtstCOI.documentRow doc)
        {
            companynName = Dbo.FilterName(companynName);
            var dal    = new CompanyManager();
            var events = dal.GetEventsByCo(companynName);

            for (var i = 0; i < acts.Count; i++)
            {
                var row = events.FindBycompany_nameevent_typeevent_date(companynName, acts[i], dates[i]);
                if (row == null)
                {
                    events.Addcompany_eventRow(companynName, acts[i], acts[i], dates[i], doc.document_id, SourceId, string.Empty, false);
                }
            }
            dal.SaveEvents(events);
        }
Esempio n. 3
0
        private string CreateSharesTraded(List <string> trades, string companyName, DtstCOI.documentRow dbDoc)
        {
            companyName = Dbo.FilterName(companyName);
            if (ReadOnly)
            {
                return("Readonly mode detected, Not saving share trade information");
            }
            var log   = new StringWriter();
            var dal   = new SharesManager();
            var table = dal.GetIndividualSharesTradedByCo(companyName);

            foreach (var trade in trades)
            {
                try
                {
                    var     details = trade.Split('|');
                    var     date    = DateTime.Parse(details[1]);
                    var     traded  = decimal.Parse(details[2]);
                    var     owned   = decimal.Parse(details[3]);
                    var     form    = int.Parse(details[5]);
                    var     no      = int.Parse(details[6]);
                    decimal price;
                    try
                    {
                        price = decimal.Parse(details[4]);
                    }
                    catch
                    {
                        price = 0;
                    }
                    var row = table.FindByindividual_namecompany_namedateformnumber
                                  (details[0], companyName, date, form, no);
                    if (row == null)
                    {
                        table.Addindividual_company_sharesRow(details[0], companyName,
                                                              date, form, no, dbDoc.document_id, traded, owned, SourceId, price);
                    }
                }catch
                {
                }
            }
            dal.Save(table);
            return(log.ToString());
        }
Esempio n. 4
0
        private void CreateLinks(DtstCOI.documentRow doc,
                                 IList <string> officers, string registeredAgent, string companyName)
        {
            //officers
            var dal = new LinkManager();

            for (var i = 0; i < officers.Count; i++)
            {
                var pos  = officers[i].Split('-')[0].Trim().ToLower();
                var name = NameAnalyzer.NameCapitalizer(officers[i].Split('-')[1].Trim());
                dal.CreateOrUpdate(InvestigationId, companyName, name, name, SourceId, doc.document_id,
                                   "Officer", doc.document_date, pos);
            }
            //registred agent
            if (NameAnalyzer.IsCompanyName(registeredAgent))
            {
                registeredAgent = Dbo.FilterName(registeredAgent);
                companyName     = Dbo.FilterName(companyName);
                var table = dal.GetLinksByCoDateAndLinkType(companyName, registeredAgent, doc.document_id, RegistredAgent);
                if (table.Rows.Count == 0)
                {
                    table.Addcompany_company_linkRow(companyName, registeredAgent, SourceId, doc.document_id,
                                                     RegistredAgent, RegistredAgent, doc.document_date, doc.document_date
                                                     );
                    dal.Save(table);
                }
                var dal3      = new CompanyManager();
                var companies = dal3.SearchCompanies(registeredAgent);
                if (companies.FindBycompany_name(registeredAgent) == null)
                {
                    companies.AddcompanyRow(registeredAgent);
                    dal3.Save(companies);
                }
            }
            else
            {
                dal.CreateOrUpdate(InvestigationId, companyName, registeredAgent, registeredAgent, SourceId, doc.document_id,
                                   "Registered Agent", doc.document_date, "Registered Agent");
            }
        }
Esempio n. 5
0
        public string SaveNameSymbolChanges()
        {
            var log = new StringWriter();
            //if the linkg goes to a disambiguation page, run the process for each of the options in said page
            var doc = GetDoc(log);

            if (doc.Contains(MultiMAtch))
            {
                var urls = ExtractMultipleSymbols(doc);
                log.WriteLine(string.Format("multiple symbols found: {0}", urls.Count));
                foreach (var url in urls)
                {
                    log.WriteLine(url);
                }
                log.WriteLine("parsing every individual symbol");
                foreach (var url in urls)
                {
                    Url = url;
                    log.WriteLine(SaveNameSymbolChanges());
                }
                return(log.ToString());
            }
            const string    s0      = "<b>NAME/SYMBOL CHANGES</b>";
            const string    s1      = "<hr>";
            const string    symbol  = "symbol";
            var             dal     = new CompanyManager();
            var             dalL    = new LinkManager();
            IFormatProvider culture = new CultureInfo("en-US", true);
            var             dbDoc   = GetOrCreateDbDoc();
            var             subdoc  = GetSubDoc(doc, s0, s1);
            var             rows    = GetRows(subdoc);

            foreach (var row in rows)
            {
                var cells = GetCells(row);
                if (cells.Count < 6)
                {
                    continue;
                }
                try
                {
                    DateTime dateOfChange;
                    try{ dateOfChange = DateTime.Parse(cells[1].Replace("&nbsp;", ""), culture); }catch { continue; }
                    var oldSymbol = cells[2].Replace("&nbsp;", "").Replace("*", "");
                    var newSymbol = cells[4].Replace("&nbsp;", "").Replace("*", "");
                    var oldName   =
                        cells[3].Replace("&nbsp;", "").Replace("New Common Stock", "").Replace("Common Stock", "");
                    var newName =
                        cells[5].Replace("&nbsp;", "").Replace("New Common Stock", "").Replace("Common Stock", "");
                    oldName = Dbo.FilterName(oldName);
                    newName = Dbo.FilterName(newName);
                    log.WriteLine(CreateDbRecordsForNameChange(dal, dalL, oldName, newName, dateOfChange, dbDoc));
                    //identifiers
                    var oldIden = dal.GetOrCreateIdentifier(oldName, symbol, oldSymbol, SourceId);
                    log.WriteLine("In date {2:yyyy-MM-dd} Company name/symbol: {0}/{1}", oldIden.company_name,
                                  oldIden.identifier, dateOfChange);
                    var newIden = dal.GetOrCreateIdentifier(newName, symbol, newSymbol, SourceId);
                    log.WriteLine("Changed to: {0}/{1}", newIden.company_name, newIden.identifier);
                }
                catch (Exception ex)
                {
                    log.WriteLine("unable to parse this line");
                    foreach (var cell in cells)
                    {
                        log.Write(cell + "|");
                    }
                    log.WriteLine();
                    log.WriteLine(ex.Message);
                }
            }
            return(log.ToString());
        }