Exemplo n.º 1
0
        static public List <Entidades.Notificacion> Notificaciones()
        {
            List <Entidades.Notificacion> l = new List <Entidades.Notificacion>();

            Conexion.OpenConnection();
            string       query   = "call eventosProximos()";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Prepare();
            MySqlDataReader reader = comando.ExecuteReader();

            while (reader.Read())
            {
                string idLote           = reader.GetString("idLote");
                string idBloque         = reader.GetString("idBloque");
                string idSeccion        = reader.GetString("idSeccion");
                string fecha            = reader.GetDateTime("fechaProgramada").ToString("MMMM dd, yyyy");
                string posicion         = reader.GetInt32("posicion").ToString();
                string nombreAplicacion = reader.GetString("nombre");

                Entidades.Notificacion notificacion = new Entidades.Notificacion();

                Entidades.Seccion s = new Entidades.Seccion();
                s.IdSeccion       = reader.GetString("idSeccion");
                s.IdBloque        = reader.GetString("idBloque");
                s.IdLote          = reader.GetString("idLote");
                s.FechaProgramada = reader.GetDateTime("fechaProgramada");
                s.Posicion        = reader.GetInt32("posicion");


                Entidades.Notificacion n = new Entidades.Notificacion();
            }
            Conexion.CloseConnection();
            return(l);
        }
Exemplo n.º 2
0
        /*    public BotonMapa(Entidades.Seccion s)
         *  {
         *     // padreForm = padre;
         *      DoubleClick += new EventHandler(DClickSeccion);
         *      Seccion = s;
         *
         *      FlatAppearance.MouseOverBackColor = Color.Transparent;
         *      FlatAppearance.MouseDownBackColor = Color.Transparent;
         *      Name = "S" + s.IdSeccion;
         *      Text = "S" + s.IdBloque + "." + s.IdSeccion;
         *      Location = new Point(s.PosX, s.PosY);
         *      Width = 60;
         *      Height = 60;
         *      ForeColor = Color.White;
         *      Font = new Font("Comic Sans MS", 11, FontStyle.Bold);
         *      Image = Vistas.Properties.Resources.pineappleicon;
         *      ImageAlign = ContentAlignment.TopCenter;
         *      TextAlign = ContentAlignment.BottomCenter;
         *      FlatStyle = FlatStyle.Flat;
         *      BackColor = Color.Transparent;
         *      FlatAppearance.BorderSize = 0;
         *
         *  }*/
        public BotonMapa(Entidades.Seccion s)
        {
            DoubleClick += new EventHandler(DClickSeccion);
            Seccion      = s;
            Bloque       = new Bloque();
            FlatAppearance.MouseOverBackColor = Color.Transparent;
            FlatAppearance.MouseDownBackColor = Color.Transparent;
            Text     = "S" + Seccion.IdBloque + "." + Seccion.IdSeccion;
            Location = new Point(Seccion.PosX, Seccion.PosY);
            //Width = 120;
            //Height = 60;
            AutoSize     = true;                       //
            AutoSizeMode = AutoSizeMode.GrowAndShrink; //
            AutoEllipsis = false;                      //


            ForeColor = Color.Black;//

            Font                      = new Font("Comic Sans MS", 11, FontStyle.Bold);
            Image                     = Vistas.Properties.Resources.pineappleicon4;
            ImageAlign                = ContentAlignment.TopLeft;
            TextAlign                 = ContentAlignment.BottomLeft;
            TextImageRelation         = TextImageRelation.ImageBeforeText;//
            FlatStyle                 = FlatStyle.Flat;
            BackColor                 = Color.Transparent;
            FlatAppearance.BorderSize = 0;
        }
Exemplo n.º 3
0
        /*    static public obtenerFechaSiembra(Entidades.Seccion s) {
         *      string query = "Select * from fechaSiembra where idLote like @idLote and idBloque = @idBloque";
         *      MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);
         *      comando.Parameters.AddWithValue("@idLote", s.IdLote);
         *      comando.Parameters.AddWithValue("@idBloque", s.IdBloque);
         *      return
         *  }*/
        static public void aumentarPosicion(Entidades.Seccion seccion)
        {
            Conexion.OpenConnection();
            string       query   = "UPDATE seccion set posicion = posicion +1 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.ExecuteNonQuery();
            Conexion.CloseConnection();
            calcularFechaSiguiente(seccion);
        }
Exemplo n.º 4
0
        static public void cambiarBloqueo(Entidades.Seccion s, bool opcion)
        {
            Conexion.OpenConnection();
            string       query   = "UPDATE seccion set bloqueo = @bloqueo 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("@bloqueo", opcion);
            comando.Prepare();
            comando.ExecuteNonQuery();
            Conexion.CloseConnection();
            //calcularFechaSiguiente(s);
        }
Exemplo n.º 5
0
        static public void quitarGrupo(Entidades.Seccion s)
        {
            Conexion.OpenConnection();
            string       query   = "UPDATE seccion set grupoForza = 'Sin Grupo', bloqueo = false, posicion = -1, idPaquete = 'Sin Paquete' 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.Prepare();
            comando.ExecuteNonQuery();
            Conexion.CloseConnection();


            //calcularFechaSiguiente(s);
        }
Exemplo n.º 6
0
        static public void eliminar(Entidades.Seccion s)
        {
            Conexion.OpenConnection();

            string       query   = "call eliminarSeccion(@idLote, @idBloque, @idSeccion)";
            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.Prepare();

            comando.ExecuteNonQuery();

            Conexion.CloseConnection();
        }
Exemplo n.º 7
0
        static public void cambiarLocation(Entidades.Seccion s)
        {
            Conexion.OpenConnection();

            string       query   = "UPDATE seccion set posX = @posX, posY = @posY 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("@posX", s.PosX);
            comando.Parameters.AddWithValue("@posY", s.PosY);
            comando.Prepare();
            comando.ExecuteNonQuery();

            Conexion.CloseConnection();
        }
Exemplo n.º 8
0
        static public List <Entidades.Seccion> buscarSeccionLista(string lote, string bloque, bool forza)
        {
            List <Entidades.Seccion> secciones = new List <Entidades.Seccion>();

            Conexion.OpenConnection();
            Entidades.Seccion s = new Entidades.Seccion();

            string query = "Select* from seccion where idLote like @idLote AND idBloque LIKE @idBloque ";

            if (forza)
            {
                query = query + "AND posicion >= 20 ";
            }
            query = query + "Order by idSeccion";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idLote", lote);
            comando.Parameters.AddWithValue("@idBloque", bloque);
            comando.Prepare();
            MySqlDataReader reader = comando.ExecuteReader();

            while (reader.Read())
            {
                s                 = new Entidades.Seccion();
                s.IdSeccion       = reader.GetString("idSeccion");
                s.IdLote          = reader.GetString("idLote");
                s.IdBloque        = reader.GetString("idBloque");
                s.Area            = reader.GetDouble("area");
                s.Posicion        = reader.GetInt32("posicion");
                s.NumPlantas      = reader.GetInt32("numPlantas");
                s.PosX            = reader.GetInt32("posX");
                s.PosY            = reader.GetInt32("posY");
                s.FechaSiembra    = reader.GetDateTime("fechaSiembra");
                s.FechaProgramada = reader.GetDateTime("fechaProgramada");
                s.Detalle         = reader.GetString("detalle");
                s.TipoSemilla     = reader.GetString("tipoSemilla");
                s.PesoSemilla     = reader.GetString("pesoSemilla");
                s.GrupoForza      = reader.GetString("grupoForza");
                s.Paquete         = reader.GetString("idPaquete");
                secciones.Add(s);
            }
            //retorna valores nulos en caso de no encontrar coincidencias
            Conexion.CloseConnection();
            return(secciones);
        }
Exemplo n.º 9
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();
        }
Exemplo n.º 10
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();
        }
Exemplo n.º 11
0
        static public List <string> comprobarSeccion(Entidades.Seccion seccion)
        {
            Conexion.OpenConnection();
            string        query   = "select c.idCedula,c.estadoAplicacion from cedulaidentidad c inner join detalleseccioncedula d on c.idCedula = d.idCedula where d.lote = @idLote and d.bloque = @idBloque and d.seccion = @idSeccion and c.estadoAplicacion = 1";
            MySqlCommand  comando = new MySqlCommand(query, Conexion.Connection);
            List <string> cedulas = new List <string>();

            comando.Parameters.AddWithValue("@idSeccion", seccion.IdSeccion);
            comando.Parameters.AddWithValue("@idBloque", seccion.IdBloque);
            comando.Parameters.AddWithValue("@idLote", seccion.IdLote);
            comando.Prepare();
            MySqlDataReader reader = comando.ExecuteReader();

            while (reader.Read())
            {
                cedulas.Add(reader.GetString("idCedula"));
            }
            Conexion.CloseConnection();
            return(cedulas);
        }
Exemplo n.º 12
0
        static public void modificar(Entidades.Seccion s)
        {
            Conexion.OpenConnection();

            string       query   = "call modificarSeccion(@idSeccion, @idLote, @idBloque, @area, @numPlantas,@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("@fechaSiembra", s.FechaSiembra);
            comando.Parameters.AddWithValue("@tipoSemilla", s.TipoSemilla);
            comando.Parameters.AddWithValue("@pesoSemilla", s.PesoSemilla);
            comando.Prepare();
            comando.ExecuteNonQuery();

            Conexion.CloseConnection();
        }
Exemplo n.º 13
0
        static public List <Entidades.Seccion> buscarSeccionPorLote(string lote)
        {
            List <Entidades.Seccion> secciones = new List <Entidades.Seccion>();

            Conexion.OpenConnection();
            string query;

            Entidades.Seccion b = new Entidades.Seccion();

            query = "Select * from seccion where idLote = @lote";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@lote", lote);
            comando.Prepare();
            MySqlDataReader reader = comando.ExecuteReader();

            while (reader.Read())
            {
                b                 = new Entidades.Seccion();
                b.IdSeccion       = reader.GetString("idSeccion");
                b.IdLote          = reader.GetString("idLote");
                b.IdBloque        = reader.GetString("idBloque");
                b.Area            = reader.GetDouble("area");
                b.Posicion        = reader.GetInt32("posicion");
                b.NumPlantas      = reader.GetInt32("numPlantas");
                b.PosX            = reader.GetInt32("posX");
                b.PosY            = reader.GetInt32("posY");
                b.FechaSiembra    = reader.GetDateTime("fechaSiembra");
                b.FechaInicial    = reader.GetDateTime("fechaInicial");
                b.FechaProgramada = reader.GetDateTime("fechaProgramada");
                b.Detalle         = reader.GetString("detalle");
                b.GrupoForza      = reader.GetString("grupoForza");
                b.Paquete         = reader.GetString("idPaquete");
                b.Bloqueo         = reader.GetBoolean("bloqueo");
                secciones.Add(b);
            }
            //retorna valores nulos en caso de no encontrar coincidencias
            Conexion.CloseConnection();
            return(secciones);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
0
        static public Entidades.Seccion buscarSeccion(string idSeccion, string lote, string bloque)
        {
            Conexion.OpenConnection();
            Entidades.Seccion s = new Entidades.Seccion();

            string       query   = "Select * from seccion WHERE idSeccion = @idSeccion and idBloque = @idBloque and idLote = @idLote";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idSeccion", idSeccion);
            comando.Parameters.AddWithValue("@idBloque", bloque);
            comando.Parameters.AddWithValue("@idLote", lote);
            comando.Prepare();
            MySqlDataReader reader = comando.ExecuteReader();

            while (reader.Read())
            {
                s.IdSeccion       = reader.GetString("idSeccion");
                s.IdLote          = reader.GetString("idLote");
                s.IdBloque        = reader.GetString("idBloque");
                s.Area            = reader.GetDouble("area");
                s.Posicion        = reader.GetInt32("posicion");
                s.NumPlantas      = reader.GetInt32("numPlantas");
                s.PosX            = reader.GetInt32("posX");
                s.PosY            = reader.GetInt32("posY");
                s.FechaSiembra    = reader.GetDateTime("fechaSiembra");
                s.FechaProgramada = reader.GetDateTime("fechaProgramada");
                s.FechaInicial    = reader.GetDateTime("fechaInicial");
                s.Detalle         = reader.GetString("detalle");
                s.GrupoForza      = reader.GetString("grupoForza");
                s.Paquete         = reader.GetString("idPaquete");
                Conexion.CloseConnection();
                return(s);
            }
            //retorna valores nulos en caso de no encontrar coincidencias
            Conexion.CloseConnection();
            return(s);
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
0
 public BotonSeccion(Mapa padreForm, Entidades.Seccion seccion)
 {
     this.padreForm = padreForm;
     this.Seccion   = seccion;
     Configuracion();
 }