예제 #1
0
        protected void ButtonSearchPar_Click(object sender, EventArgs e)
        {
            if (TextSearchForms.Text.Trim() == string.Empty || TextSearchPars.Text.Trim() == string.Empty || TextFormsList.Text.Trim() == string.Empty)
            {
                Literal1.Text = "<span class=alarm>Please enter search parameters and make sure the first search returns at least 1 filing</span>";
                return;
            }
            if (RadioOutFormat.SelectedValue == "Excel")
            {
                ParSearchToXLS();
                return;
            }
            var gennerateControls = RadioOutFormat.SelectedValue == "Event";
            var d = new DtstFilingSearchResult();

            if (DropSort.SelectedValue == "2")
            {
                var sort = d.MPSresults.DateColumn.ColumnName + " asc, "
                           + d.MPSresults.CompanyColumn.ColumnName + " asc, "
                           + d.MPSresults.rowIDColumn + " asc";
                ParSearchToHTMLBySortOrder(sort, false, gennerateControls);
            }
            else
            {
                var sort = d.MPSresults.CompanyColumn.ColumnName + " asc, "
                           + d.MPSresults.DateColumn.ColumnName + " asc, "
                           + d.MPSresults.rowIDColumn + " asc";
                ParSearchToHTMLBySortOrder(sort, true, gennerateControls);
            }
        }
예제 #2
0
        private DtstFilingSearchResult GetDtst()
        {
            Companies     = new List <string>();
            MinDates      = new List <DateTime>();
            MaxDates      = new List <DateTime>();
            KeywordsPerCo = new List <List <string> >();
            var manager  = new SECFormsManager();
            var analyzer = new SECFormsDocAnalyzer();
            var addPars  = int.Parse(DropProximityAdd.SelectedValue);
            var keywords = this.TextSearchPars.Text.Replace("\r", "").Split('\n');
            var dtst     = new DtstFilingSearchResult();
            var table    = dtst.MPSresults;
            var i        = 0;

            foreach (var line in this.TextFormsList.Text.Replace("\r\n", "\n").Split('\n'))
            {
                try
                {
                    if (string.IsNullOrEmpty(line))
                    {
                        continue;
                    }
                    var formID       = new Guid(line);
                    var form         = manager.GetFormsByFormID(formID)[0];
                    var companyIndex = Companies.IndexOf(form.CompanyName);
                    if (companyIndex == -1)
                    {
                        Companies.Add(form.CompanyName);
                        MinDates.Add(form.FormDate);
                        MaxDates.Add(form.FormDate);
                        KeywordsPerCo.Add(new List <string>());
                        companyIndex = Companies.IndexOf(form.CompanyName);
                    }
                    else //keep min and max date per company
                    {
                        if (form.FormDate < MinDates[companyIndex])
                        {
                            MinDates[companyIndex] = form.FormDate;
                        }
                        if (form.FormDate > MaxDates[companyIndex])
                        {
                            MaxDates[companyIndex] = form.FormDate;
                        }
                    }
                    var keywordsThisCo = KeywordsPerCo[companyIndex];
                    foreach (var keyword in keywords)
                    {
                        if (keyword.Trim() == string.Empty)
                        {
                            continue;
                        }
                        var pars = analyzer.GetFormSubDocParagraphsWithSearch(
                            formID, -1, keyword, addPars, CheckMultiple.Checked);
                        if (pars.Count == 0)
                        {
                            continue;
                        }
                        i++;
                        if (keywordsThisCo.IndexOf(keyword) == -1)
                        {
                            keywordsThisCo.Add(keyword);
                        }
                        foreach (var par in pars)
                        {
                            if (par.Trim() != string.Empty)
                            {
                                table.AddMPSresultsRow(i, form.FormDate, form.CompanyName,
                                                       form.FormType, keyword, par, form.FormPartialURL, formID);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Literal1.Text = ex.ToString();
                }
            }
            return(dtst);
        }