private void tmProgresaBar_Tick(object sender, EventArgs e) { progressBar1.Value = progressBar1.Value + 2; if (progressBar1.Value <= 50) { lbCARGANDO.Text = "Analizando datos..." + progressBar1.Value + " %"; } else { lbCARGANDO.Text = "Cargando Ventas..." + progressBar1.Value + " %"; } if (progressBar1.Value == 100) { tmProgresaBar.Enabled = false; progressBar1.Value = 0; lbCARGANDO.Text = ""; DateTime fecha = DateTime.Today; string fecha_Actual = Convert.ToString(fecha.ToString("dd-MM-yyyy")); string hora = DateTime.Now.Hour.ToString("D2") + ":" + DateTime.Now.Minute.ToString("D2") + ":" + DateTime.Now.Second.ToString("D2"); resp = Nregistro_exportacion.RegistrarDW("1", cbMEShasta.Text, cbAÑOHasta.Text, hora, fecha_Actual); MessageBox.Show("Cargado de Datos Exitoso", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void BtnAceptar_Click(object sender, EventArgs e) { try { int resultado = Convert.ToInt16(txtMES.Text) + 1; int ultimoAño = Convert.ToInt16(txtAÑO.Text); if (lbMES.Text == "Mes" || txtAÑOEX.Text == "") { MessageBox.Show("Error, Verifique los campos para exportar", "Sistema DW Future", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int resultadoB = Convert.ToInt16(txtMESEX.Text); int ultimoAño2 = Convert.ToInt16(txtAÑOEX.Text); if (txtMES.Text == "12") { ultimoAño = ultimoAño + 1; resultado = 1; } if ((resultado == resultadoB) && (ultimoAño == ultimoAño2)) { int mes = Convert.ToInt16(txtMESEX.Text); int año = Convert.ToInt16(txtAÑOEX.Text); Guardar_archivo_tiempo(ruta_tiempo, mes, año.ToString()); tabla = Ntabla_dimensiones.Hventa(mes, año); Guardar_archivo_hventa(ruta_venta, tabla); if (tabla.Rows.Count == 0) { MessageBox.Show("Error, No se ha encontrado datos en el periodo para exportar", "Sistema DW Future", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DateTime fecha = DateTime.Today; string fecha_Actual = Convert.ToString(fecha.ToString("dd-MM-yyyy")); string hora = DateTime.Now.Hour.ToString("D2") + ":" + DateTime.Now.Minute.ToString("D2") + ":" + DateTime.Now.Second.ToString("D2"); MessageBox.Show("Datos exportados correctamente", "Sistema DW Future", MessageBoxButtons.OK, MessageBoxIcon.Information); resp = Nregistro_exportacion.RegistrarDW("1", lbMES.Text, txtAÑOEX.Text, hora, fecha_Actual); ultimo_exportado(); sugerir(); cambiar_mes(); } } else { MessageBox.Show("Error, se debe exportar el año con los meses continuos", "Sistema DW Future", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception) { if (lbMES.Text == "Mes" || txtAÑOEX.Text == "") { MessageBox.Show("Verifique los Campos para Exportar", "Sistema DW Future", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int mes = Convert.ToInt16(txtMESEX.Text); int año = Convert.ToInt16(txtAÑOEX.Text); Guardar_archivo_tiempo(ruta_tiempo, mes, año.ToString()); tabla = Ntabla_dimensiones.Hventa(mes, año); Guardar_archivo_hventa(ruta_venta, tabla); if (tabla.Rows.Count == 0) { MessageBox.Show("No se ha encontrado datos en el periodo para exportar", "Sistema DW Future", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DateTime fecha = DateTime.Today; string fecha_Actual = Convert.ToString(fecha.ToString("dd-MM-yyyy")); string hora = DateTime.Now.Hour.ToString("D2") + ":" + DateTime.Now.Minute.ToString("D2") + ":" + DateTime.Now.Second.ToString("D2"); MessageBox.Show("Datos exportados correctamente", "Sistema DW Future", MessageBoxButtons.OK, MessageBoxIcon.Error); resp = Nregistro_exportacion.RegistrarDW("1", lbMES.Text, txtAÑOEX.Text, hora, fecha_Actual); ultimo_exportado(); sugerir(); cambiar_mes(); } } } }
public void ultimo_exportado() { try { tabla = Nregistro_exportacion.Mostrar_ULTI(); txtAÑO.Text = tabla.Rows[0][1].ToString(); string mes = tabla.Rows[0][0].ToString(); if (mes == "Enero") { txtMES.Text = "1"; lbMES2.Text = "Enero"; } else if (mes == "Febrero") { txtMES.Text = "2"; lbMES2.Text = "Febrero"; } else if (mes == "Marzo") { txtMES.Text = "3"; lbMES2.Text = "Marzo"; } else if (mes == "Abril") { txtMES.Text = "4"; lbMES2.Text = "Abril"; } else if (mes == "Mayo") { txtMES.Text = "5"; lbMES2.Text = "Mayo"; } else if (mes == "Junio") { txtMES.Text = "6"; lbMES2.Text = "Junio"; } else if (mes == "Julio") { txtMES.Text = "7"; lbMES2.Text = "Julio"; } else if (mes == "Agosto") { txtMES.Text = "8"; lbMES2.Text = "Agosto"; } else if (mes == "Septiembre") { txtMES.Text = "9"; lbMES2.Text = "Septiembre"; } else if (mes == "Octubre") { txtMES.Text = "10"; lbMES2.Text = "Octubre"; } else if (mes == "Noviembre") { txtMES.Text = "11"; lbMES2.Text = "Noviembre"; } else if (mes == "Diciembre") { txtMES.Text = "12"; lbMES2.Text = "Diciembre"; } else { txtMES.Text = "Mes"; } } catch (Exception) { } }