private void btnCargar_Click(object sender, EventArgs e) { CN_DatosClimaMes _DatosClimaMes = new CN_DatosClimaMes(); tablaDatosClimaMes = _DatosClimaMes.MostrarDatosClimaMes(); dgvDatosClimaMes.DataSource = tablaDatosClimaMes; }
private void InsertarDatosClimaMes() { try { Cursor.Current = Cursors.WaitCursor; CN_DatosClimaMes _DatosClimaMes = new CN_DatosClimaMes(); String[] aux1 = _DatosClimaMes.top_fecha().Split(' '); int parametro = intervalos(aux1[0]); foreach (DataGridViewRow item in dtgDatosElMante.Rows) { String aux = item.Cells["Fecha Local"].Value.ToString().Replace(@"""", ""); aux = aux.Replace("-", "/"); aux = aux.Replace("\"", ""); String[] aux2 = aux.Split(' '); int intervalo2 = intervalos(acomodarfecha(aux2[0])); if (parametro > intervalo2 && intervalo2 != 0) { String fecha = item.Cells["Fecha Local"].Value.ToString().Replace(@"""", ""); String fechautc = item.Cells["Fecha UTC"].Value.ToString().Replace(@"""", ""); _DatosClimaMes.InsertarDatosClimaMes(item.Cells["Estación"].Value.ToString(), fecha, fechautc, item.Cells["Dirección del Viento (grados)"].Value.ToString(), item.Cells["Dirección de ráfaga (grados)"].Value.ToString(), item.Cells["Rapidez de viento (km/h)"].Value.ToString(), item.Cells["Rapidez de ráfaga (km/h)"].Value.ToString(), item.Cells["Temperatura del Aire (°C)"].Value.ToString(), item.Cells["Humedad relativa (%)"].Value.ToString(), item.Cells["Presión Atmosférica"].Value.ToString(), item.Cells["Precipitación (mm)"].Value.ToString(), item.Cells["Radiación Solar (W/m²)"].Value.ToString()); } /* if (Convert.ToDateTime(item.Cells["Fecha Local"].Value.ToString().Replace(@"""", "")).ToString("yy-MM-dd") == DateTime.Now.AddDays(-1).ToString("yy-MM-dd")) * { * * * /* String fechautc = item.Cells["Fecha UTC"].Value.ToString().Replace(@"""", ""); * _DatosClimaMes.InsertarDatosClimaMes(item.Cells["Estación"].Value.ToString(), fecha, fechautc, item.Cells["Dirección del Viento (grados)"].Value.ToString(), item.Cells["Dirección de ráfaga (grados)"].Value.ToString(), * item.Cells["Rapidez de viento (km/h)"].Value.ToString(), item.Cells["Rapidez de ráfaga (km/h)"].Value.ToString(), item.Cells["Temperatura del Aire (°C)"].Value.ToString(), item.Cells["Humedad relativa (%)"].Value.ToString(), * item.Cells["Presión Atmosférica"].Value.ToString(), item.Cells["Precipitación (mm)"].Value.ToString(), item.Cells["Radiación Solar (W/m²)"].Value.ToString()); * }*/ } Cursor.Current = Cursors.Default; } catch (Exception a) { MessageBox.Show("Ha ocurrido un error " + a.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Cursor.Current = Cursors.Default; } }
private void LlenarDataTableDatosClimaMes() { CN_DatosClimaMes _DatosClimaMes = new CN_DatosClimaMes(); tablaDatosClimaMes = _DatosClimaMes.MostrarDatosClimaMes(); }