private void UpdateDisplay() { if (comboBox1.SelectedIndex < 0) { dataRowEditor1.SetDataRow(m_sites.NewsitecatalogRow()); dataGridViewSiteProperties.DataSource = null; return; } var row = m_sites[comboBox1.SelectedIndex]; this.dataRowEditor1.SetDataRow(row); var siteid = row["siteid"].ToString(); m_props.Columns["siteid"].DefaultValue = siteid; m_props.Columns["id"].AutoIncrement = true; m_props.Columns["id"].AutoIncrementSeed = m_props.NextID(); m_props.DefaultView.RowFilter = "siteid = '" + siteid + "'"; this.dataGridViewSiteProperties.DataSource = m_props; dataGridViewSiteProperties.Columns["siteid"].Visible = false; dataGridViewSiteProperties.Columns["id"].Visible = false; }
private static void UpdateGPSiteInfo(TimeSeriesDatabaseDataSet.sitecatalogDataTable sc) { Console.WriteLine("reading gp excel"); var fn = @"U:\water.usbr.gov\data\GPsitesTESSELAPP_kt.xlsx"; var xls = new NpoiExcel(fn); var tbl = xls.ReadDataTable(0); //var tbl = ExcelDB.Read(fn, 0); for (int i = 0; i < tbl.Rows.Count; i++) { var desc = tbl.Rows[i]["Description"].ToString(); var lat = tbl.Rows[i]["Latitude"].ToString().Trim(); var lon = tbl.Rows[i]["Longitude"].ToString().Trim(); var state = tbl.Rows[i]["State"].ToString().Trim(); if (lon[0] != '-') { lon = "-" + lon; } //var office = tbl.Rows[i]["office"].ToString(); var siteid = tbl.Rows[i]["Site Name"].ToString().ToLower().Trim(); var siteType = tbl.Rows[i]["type"].ToString().ToLower().Trim(); var siteRow = sc.FindBysiteid(siteid); if (siteRow == null) { Console.WriteLine("new site : " + siteid); siteRow = sc.NewsitecatalogRow(); siteRow.siteid = siteid; sc.AddsitecatalogRow(siteRow); } else { Console.WriteLine("existing site : " + siteRow.siteid); } siteRow.description = desc; siteRow.state = state; siteRow.latitude = lat; siteRow.longitude = lon; //siteRow.responsibility = office; siteRow.type = siteType; siteRow.agency_region = "GP"; } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex < 0) { dataRowEditor1.SetDataRow(m_sites.NewsitecatalogRow()); return; } var row = m_sites[comboBox1.SelectedIndex]; this.dataRowEditor1.SetDataRow(row); var siteid = row["siteid"].ToString(); m_props.Columns["siteid"].DefaultValue = siteid; m_props.Columns["id"].AutoIncrement = true; m_props.Columns["id"].AutoIncrementSeed = m_props.NextID(); m_props.DefaultView.RowFilter = "siteid = '" + siteid + "'"; this.dataGridViewSiteProperties.DataSource = m_props; }