static public List <Entidades.Fecha> obtenerFechas(List <Entidades.Seccion> secciones) { List <Entidades.DetalleAplicacion> detalle; List <Entidades.Fecha> fechas = new List <Entidades.Fecha>(); foreach (Entidades.Seccion s in secciones) { detalle = DetalleAplicacion.lista(s.Paquete); foreach (Entidades.DetalleAplicacion d in detalle) { Entidades.Fecha f = new Entidades.Fecha(); f.Bloqueo = s.Bloqueo; f.Siguiente = false; if ((s.Posicion + 1) == d.Posicion) { f.Siguiente = true; } f.FechaProgramada = s.FechaInicial.AddDays(d.Tiempo); f.Lote = s.IdLote; f.Seccion = s.IdSeccion; f.Bloque = s.IdBloque; f.Paquete = s.Paquete; f.IdAplicacion = d.IdAplicacion; f.Aplicacion = d.NombreAplicacion; f.Posicion = d.Posicion; f.Area = s.Area; f.grupoForza = s.GrupoForza; f.Semana = Entidades.conf.weekNumber(f.FechaProgramada); fechas.Add(f); } } return(fechas); }
static public List <Entidades.Fecha> Eventos() { int dias = DAO.Configuracion.getConfiguracion().FrecuenciaCorreos; List <Entidades.Fecha> eventos = new List <Entidades.Fecha>(); Conexion.OpenConnection(); string query = "call eventosProximos(@dias)"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@dias", dias); comando.Prepare(); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { Entidades.Fecha fecha = new Entidades.Fecha(); fecha.Lote = reader.GetString("idLote"); fecha.Bloque = reader.GetString("idBloque"); fecha.Seccion = reader.GetString("idSeccion"); fecha.FechaProgramada = reader.GetDateTime("fechaProgramada"); fecha.Posicion = reader.GetInt32("posicion"); fecha.Aplicacion = reader.GetString("nombre"); eventos.Add(fecha); } Conexion.CloseConnection(); return(eventos); }
static public List <Entidades.Fecha> fechaPorMes(DateTime fecha) { Conexion.OpenConnection(); List <Entidades.Fecha> list = new List <Entidades.Fecha>(); string query = "obtenerFechasPorMes"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.CommandType = System.Data.CommandType.StoredProcedure; comando.Parameters.AddWithValue("_fecha", fecha.AddDays(-fecha.Day)); comando.Parameters.AddWithValue("_fecha2", new DateTime(fecha.Year, fecha.Month, DateTime.DaysInMonth(fecha.Year, fecha.Month))); comando.Prepare(); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { Entidades.Fecha f = new Entidades.Fecha(); f.FechaProgramada = reader.GetDateTime("FechaProgramada"); f.Lote = reader.GetString("Lote"); f.Seccion = reader.GetString("Seccion"); f.Posicion = reader.GetInt32("Posicion"); f.Paquete = reader.GetString("Paquete"); f.Bloque = reader.GetString("Bloque"); f.IdAplicacion = reader.GetInt32("IdAplicacion"); f.Aplicacion = reader.GetString("NombreAplicacion"); list.Add(f); } Conexion.CloseConnection(); return(list); }