private void CompaniesButon_Click(object sender, RibbonControlEventArgs e) { // insert companies into spreadsheet CrunchBaseConnect cbc = new CrunchBaseConnect(); InsertCompaniesAtCell(cbc.Companies, "company", Globals.ThisAddIn.Application.ActiveCell); }
private void button2_Click(object sender, RibbonControlEventArgs e) { CrunchBaseConnect cbc = new CrunchBaseConnect(); List <cbCompanyObject> financeorgs = cbc.FinanceOrgs; InsertCompaniesAtCell(financeorgs, "financial-organization", Globals.ThisAddIn.Application.ActiveCell); }
private void SearchButton_Click(object sender, EventArgs e) { // Companies // Financial Organizations String entity = EntityCombo.Text == "Companies"? "company":"financial-organization"; String querystring = ""; if (NameTextBox.Text != "") // then create a query { querystring = "query=" + NameTextBox.Text + "&entity=" + entity + (checkBoxTags.Checked ?"&field=tag_list":"&field=name"); CrunchBaseConnect cbc = new CrunchBaseConnect(); DiagnosticTimer.StartTimer("SearchCrunch"); List <cbSearchResults> myresults = cbc.SearchResults(querystring); resultslist = myresults; SearchResultsGrid.DataSource = myresults; SearchResultsGrid.Columns[0].Width = 8 * 20; SearchResultsGrid.Columns[1].Width = 8 * 20; SearchResultsGrid.Columns[2].Width = 8 * 12; SearchResultsGrid.Columns[3].Width = 8 * 60; DiagnosticTimer.StopTimer("SearchCrunch"); } }
private void button1_Click(object sender, RibbonControlEventArgs e) { string company = FreeSearch.Text; CrunchBaseConnect cbc = new CrunchBaseConnect(); CrunchBase cbentry = cbc.GetCrunchCompany(company); if (cbentry != null) { int num_cols = 18; Object[,] companyrow = new Object[1, num_cols]; //headerstring if needed /* string[] cpny ={"Company Logo URL","Company Name","Homepage URL","Crunchbase URL", * "Short Description","Category","Number of Employees","City","State", * "Country","Year Founded","Total Funding",,"keyword tags"}; */ companyrow[0, 0] = cbentry.GetImageURL(); companyrow[0, 1] = cbentry.name; companyrow[0, 2] = cbentry.homepage_url; companyrow[0, 3] = cbentry.crunchbase_url; companyrow[0, 4] = cbentry.description; companyrow[0, 5] = cbentry.category_code; companyrow[0, 6] = cbentry.number_of_employees; companyrow[0, 7] = cbentry.offices[0].city; companyrow[0, 8] = cbentry.offices[0].state_code; companyrow[0, 9] = cbentry.offices[0].country_code; companyrow[0, 10] = cbentry.founded_year; companyrow[0, 11] = cbentry.GetAggregateFunding(); companyrow[0, 12] = cbentry.tag_list; var curr = Globals.ThisAddIn.Application.ActiveSheet; var startCell = Globals.ThisAddIn.Application.ActiveCell; var endCell = curr.Cells[startCell.Row, startCell.Column + num_cols]; var writeRange = curr.Range[startCell, endCell]; writeRange.Value2 = companyrow; } else // it's not a company { CrunchFinancial cfc = cbc.GetCrunchFinanceOrg(company); } }
private void CompanyDetailsButton_Click_1(object sender, RibbonControlEventArgs e) { Range permalinkrange = Globals.ThisAddIn.Application.Selection; CrunchBaseConnect cbc = new CrunchBaseConnect(); foreach (Range c in permalinkrange.Cells) { if (c != null) { CrunchBase company = cbc.GetCrunchCompany(c.Value2); if (company != null) { object[,] detailrow = new object[1, company.aggregateheaders.Count()]; for (int i = 0; i < company.aggregaterow.Count(); i++) { detailrow[0, i] = company.aggregaterow[i]; } Range startCell = c.Worksheet.Cells[c.Row, c.Column + 1]; Range details = ThisAddIn.OutputArrayToExcel(startCell, detailrow); } } } }
private void AggregateButton_Click(object sender, EventArgs e) { var reportsheet = Globals.ThisAddIn.Application.ActiveSheet; if (NewSheetCheck.Checked) { reportsheet = Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets.Add(); reportsheet.Activate(); } var startCell = Globals.ThisAddIn.Application.ActiveCell; // normalize into entity lists companies and finance orgs; ignore others for now SearchResultsList financecompanies = new SearchResultsList(); SearchResultsList nonfincompanies = new SearchResultsList(); SearchResultsList entitiesnotfound = new SearchResultsList(); // add companies that we can't find in crunchbase to this list foreach (cbSearchResults entry in EntityList) { switch (entry.Namespace) { case "financial-organization": { financecompanies.Add(entry); break; } case "company": { nonfincompanies.Add(entry); break; } default: break; } } // output the finance org table startCell.Value2 = "Crunchbase Search on " + DateTime.Now.ToLongTimeString() + " Scope: " + ScopeDesc.Text; // move startcell one cell lower startCell = reportsheet.Cells[startCell.Row + 1, startCell.Column]; if (financecompanies.Count > 0) { // output a finance orgs table, first the headers CrunchFinancial cfh = new CrunchFinancial(); object[,] excelout = new object[financecompanies.Count + 1, cfh.headersaggregate.Count()]; // put the header in row 0 for (int i = 0; i < cfh.headersaggregate.Count(); i++) { excelout[0, i] = cfh.headersaggregate[i]; } int currrow = 1; CrunchBaseConnect cbc = new CrunchBaseConnect(); foreach (cbSearchResults f in financecompanies) { CrunchFinancial fc = cbc.GetCrunchFinanceOrg(f.permalink); if (fc != null) { for (int i = 0; i < fc.headersaggregate.Count(); i++) { excelout[currrow, i] = fc.aggregateitems[i]; } currrow++; } else { // add to not found list entitiesnotfound.Add(f); } } //now output to excel Range financerange = ThisAddIn.OutputArrayToExcel(startCell, excelout); // now move startCell below the financerange startCell = reportsheet.Cells[startCell.Row + financerange.Rows.Count + 1, startCell.Column]; } // now do companies entity if (nonfincompanies.Count > 0) { CrunchBaseConnect cbc = new CrunchBaseConnect(); CrunchBase cb = new CrunchBase(); int currow = 1; // 0 has the header object[,] excelout = new object[nonfincompanies.Count + 1, cb.aggregateheaders.Count()]; // output headers to row 0 for (int i = 0; i < cb.aggregateheaders.Count(); i++) { excelout[0, i] = cb.aggregateheaders[i]; } foreach (cbSearchResults c in nonfincompanies) { CrunchBase cp = cbc.GetCrunchCompany(c.permalink); if (cp != null) { for (int i = 0; i < cp.aggregateheaders.Count(); i++) { excelout[currow, i] = cp.aggregaterow[i]; } currow++; } else { entitiesnotfound.Add(c); } } Range companyrange = ThisAddIn.OutputArrayToExcel(startCell, excelout); this.Close(); } } //aggregate button click method