Esempio n. 1
0
        private string CreateOwnerLinks(List <string> owners, string companyName, DtstCOI.documentRow dbdoc)
        {
            if (ReadOnly)
            {
                return("Readonly mode detected, Not creating links");
            }
            var log = new StringWriter();
            var dal = new LinkManager();

            foreach (var owner in owners)
            {
                try
                {
                    var details   = owner.Split('|');
                    var date      = DateTime.Parse(details[1]);
                    var positions =
                        details[2].ToLower().Replace("&", ",").Replace(" and ", ",").Replace(":", ",").Split(',');
                    foreach (var p in positions)
                    {
                        if (!NameAnalyzer.IsCompanyName(details[0]))
                        {
                            dal.CreateOrUpdate(InvestigationId, companyName, details[0], details[0],
                                               SourceId, dbdoc.document_id, "Owner", date, p.Trim());
                        }
                        else
                        {
                            dal.CreateOrUpdateCoCoLink(companyName, details[0], 10, dbdoc.document_id, "Owner", p.Trim(), date);
                        }
                    }
                }
                catch (Exception ex)
                { log.WriteLine(ex.Message); }
            }
            return(log.ToString());
        }
Esempio n. 2
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");
            }
        }