Пример #1
0
        static public void calcularFechaSiguiente(Entidades.Seccion seccion)
        {
            Entidades.Seccion           s = buscarSeccion(seccion.IdSeccion, seccion.IdLote, seccion.IdBloque);
            Entidades.DetalleAplicacion a = DAO.DetalleAplicacion.getDetallePaquetePosicion(s.Paquete, s.Posicion + 1);
            DateTime dt = s.FechaInicial.AddDays(a.Tiempo);

            Conexion.OpenConnection();
            string       query   = "UPDATE seccion set fechaProgramada = @fechaProgramada  WHERE idSeccion = @idSeccion and idBloque = @idBloque and idLote = @idLote";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@fechaProgramada", dt);
            comando.Parameters.AddWithValue("@idSeccion", s.IdSeccion);
            comando.Parameters.AddWithValue("@idBloque", s.IdBloque);
            comando.Parameters.AddWithValue("@idLote", s.IdLote);
            comando.Prepare();
            comando.ExecuteNonQuery();
            Conexion.CloseConnection();
        }
Пример #2
0
        static public void editPaquete(Entidades.Seccion seccion)
        {
            Entidades.DetalleAplicacion a = DAO.DetalleAplicacion.getDetallePaquetePosicion(seccion.Paquete, seccion.Posicion + 1);
            seccion.FechaProgramada = buscarSeccion(seccion.IdSeccion, seccion.IdLote, seccion.IdBloque).FechaInicial.AddDays(a.Tiempo);
            Conexion.OpenConnection();

            string       query   = "UPDATE seccion set grupoForza = 'Sin Grupo', idPaquete = @idPaquete, posicion = -1, fechaProgramada = @fechaProgramada WHERE idSeccion = @idSeccion AND idBloque = @idBloque AND idLote = @idLote";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idSeccion", seccion.IdSeccion);
            comando.Parameters.AddWithValue("@idBloque", seccion.IdBloque);
            comando.Parameters.AddWithValue("@idLote", seccion.IdLote);
            comando.Parameters.AddWithValue("@fechaProgramada", seccion.FechaProgramada);
            comando.Parameters.AddWithValue("@idPaquete", seccion.Paquete);
            comando.Prepare();
            comando.ExecuteNonQuery();

            Conexion.CloseConnection();
        }
Пример #3
0
        static public void agregarGrupo(Entidades.Seccion s, Entidades.GrupoForza g)
        {
            Entidades.DetalleAplicacion da = DAO.DetalleAplicacion.getDetallePaquetePosicion(g.Paquete, 0);

            Conexion.OpenConnection();
            string       query   = "UPDATE seccion set grupoForza = @grupoForza, posicion = @pos, idPaquete = @paquete,  fechaInicial = @fechaInicial, fechaProgramada = @fechaProgramada  WHERE idSeccion = @idSeccion and idBloque = @idBloque and idLote = @idLote";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idSeccion", s.IdSeccion);
            comando.Parameters.AddWithValue("@idBloque", s.IdBloque);
            comando.Parameters.AddWithValue("@idLote", s.IdLote);
            comando.Parameters.AddWithValue("@pos", -1);
            comando.Parameters.AddWithValue("@grupoForza", g.IdGrupo);
            comando.Parameters.AddWithValue("@paquete", g.Paquete);
            comando.Parameters.AddWithValue("@fechaInicial", g.Fecha);
            comando.Parameters.AddWithValue("@fechaProgramada", g.Fecha.AddDays(da.Tiempo));
            comando.Prepare();
            comando.ExecuteNonQuery();
            Conexion.CloseConnection();


            //calcularFechaSiguiente(s);
        }
Пример #4
0
        static public void insertar(Entidades.Seccion s)
        {
            Entidades.DetalleAplicacion da = DAO.DetalleAplicacion.getDetallePaquetePosicion(s.Paquete, s.Posicion);
            Conexion.OpenConnection();

            string       query   = "call insertarSeccion(@idSeccion, @idLote, @idBloque, @area, @numPlantas, @posX, @posY,@fechaSiembra,@tipoSemilla,@pesoSemilla)";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idSeccion", s.IdSeccion);
            comando.Parameters.AddWithValue("@idLote", s.IdLote);
            comando.Parameters.AddWithValue("@idBloque", s.IdBloque);
            comando.Parameters.AddWithValue("@area", s.Area);
            comando.Parameters.AddWithValue("@numPlantas", s.NumPlantas);
            comando.Parameters.AddWithValue("@posX", s.PosX);
            comando.Parameters.AddWithValue("@posY", s.PosY);
            comando.Parameters.AddWithValue("@fechaSiembra", s.FechaSiembra);
            comando.Parameters.AddWithValue("@tipoSemilla", s.TipoSemilla);
            comando.Parameters.AddWithValue("@pesoSemilla", s.PesoSemilla);
            comando.Prepare();
            comando.ExecuteNonQuery();

            Conexion.CloseConnection();
            //calcularFechaSiguiente(s);
        }