Beispiel #1
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     Entidades.GrupoForza g = new Entidades.GrupoForza();
     g.IdGrupo        = txtIdGrupo.Text;
     g.Paquete        = comboBox1.Text;
     g.Fecha          = dateTimePicker1.Value;
     g.PeriodoCosecha = dateTimePicker2.Value;
     this.padre.crearGrupo(g);
     this.Close();
 }
Beispiel #2
0
        public VerGrupo(Entidades.GrupoForza grupo)


        {
            InitializeComponent();
            this.grupo = grupo;
            dt         = DAO.Seccion.buscarSeccionTabla(grupo.IdGrupo, grupo.Lote);
            dataGridView1.DataSource = dt;
            lblLote.Text             = grupo.Lote;
            lblNombre.Text           = grupo.IdGrupo;
        }
        public NombreGrupoForza(Entidades.GrupoForza g, List <Entidades.Seccion> seccion)
        {
            InitializeComponent();

            modificar          = true;
            btnGuardar.Text    = "Modificar";
            txtGrupo.Text      = g.IdGrupo;
            txtGrupo.Enabled   = false;
            comboPaquetes.Text = g.Paquete;
            grupo.Lote         = g.Lote;
            //dateTimePicker1.Value = g.Fecha;
            this.seccion = seccion;
        }
Beispiel #4
0
        public EditarGrupo(Grupos padre, string g)
        {
            this.padre = padre;
            grupo      = DAO.GrupoForza.getGrupo(g);
            InitializeComponent();

            cargarPaquetes();

            txtIdGrupo.Text       = grupo.IdGrupo;
            comboBox1.Text        = grupo.Paquete;
            dateTimePicker1.Value = grupo.Fecha;
            dateTimePicker2.Value = grupo.PeriodoCosecha;
        }
Beispiel #5
0
        static public void actualizarGrupo(Entidades.GrupoForza g)
        {
            Conexion.OpenConnection();

            string       query   = "update grupoForza set fechaInicio=@fecha, paquete = @paquete, periodoCosecha = @PeriodoCosecha where idgrupo = @grupo";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@grupo", g.IdGrupo);
            comando.Parameters.AddWithValue("@fecha", g.Fecha);
            comando.Parameters.AddWithValue("@paquete", g.Paquete);
            comando.Parameters.AddWithValue("@PeriodoCosecha", g.PeriodoCosecha);
            comando.ExecuteNonQuery();
            Conexion.CloseConnection();
        }
Beispiel #6
0
        public void editarGrupo(Entidades.GrupoForza g)
        {
            DAO.GrupoForza.actualizarGrupo(g);
            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {
                Entidades.Seccion s = new Entidades.Seccion();
                s.IdSeccion = dataGridView2.Rows[i].Cells["Seccion"].Value.ToString();
                s.IdBloque  = dataGridView2.Rows[i].Cells["Bloque"].Value.ToString();
                s.IdLote    = dataGridView2.Rows[i].Cells["Lote"].Value.ToString();

                DAO.Seccion.agregarGrupo(s, g);
            }
            cargarComboGrupos();
        }
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     grupo = new Entidades.GrupoForza()
     {
         IdGrupo = txtGrupo.Text,
         Fecha   = dateTimePicker1.Value.Date,
         Paquete = comboPaquetes.Text
     };
     if (modificar)
     {
         DAO.GrupoForza.actualizarGrupo(grupo);
         foreach (Entidades.Seccion s in seccion)
         {
             DAO.Seccion.agregarGrupo(s, grupo.IdGrupo, grupo.Paquete, -1, grupo.Fecha);
         }
     }
 }
Beispiel #8
0
        static public bool comprobarGrupo(Entidades.GrupoForza g)
        {
            Conexion.OpenConnection();
            string       query   = "select * from grupoForza where lote = @lote and idGrupo = @idGrupo ";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idGrupo", g.IdGrupo);
            comando.Parameters.AddWithValue("@lote", g.Lote);
            comando.ExecuteNonQuery();
            MySqlDataReader reader = comando.ExecuteReader();

            if (reader.Read())
            {
                Conexion.CloseConnection();
                return(true);
            }
            Conexion.CloseConnection();
            return(false);
        }
Beispiel #9
0
        static public bool insertarGrupo(Entidades.GrupoForza g)
        {
            if (!comprobarGrupo(g))
            {
                Conexion.OpenConnection();

                string       query   = "insert into grupoForza (idGrupo,fechaInicio,paquete,periodoCosecha) values(@grupo,@fecha,@paquete,@PeriodoCosecha)";
                MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

                comando.Parameters.AddWithValue("@grupo", g.IdGrupo);
                comando.Parameters.AddWithValue("@fecha", g.Fecha);
                comando.Parameters.AddWithValue("@lote", g.Lote);
                comando.Parameters.AddWithValue("@paquete", g.Paquete);
                comando.Parameters.AddWithValue("@PeriodoCosecha", g.PeriodoCosecha);
                comando.ExecuteNonQuery();
                Conexion.CloseConnection();
                return(true);
            }
            return(false);
        }
Beispiel #10
0
 private void txtIdGrupo_TextChanged(object sender, EventArgs e)
 {
     Entidades.GrupoForza g = new Entidades.GrupoForza {
         IdGrupo = txtIdGrupo.Text
     };
     if (txtIdGrupo.Text == "" || DAO.GrupoForza.comprobarGrupo(g))
     {
         txtIdGrupo.BackColor = Color.Red;
         btnAceptar.Enabled   = false;
         label2.Text          = "Nombre no diponible";
         label2.ForeColor     = Color.DarkRed;
     }
     else
     {
         label2.Text          = "Nombre disponible";
         label2.ForeColor     = Color.Green;
         txtIdGrupo.BackColor = SystemColors.Window;
         btnAceptar.Enabled   = true;
     }
 }
Beispiel #11
0
        static public Entidades.GrupoForza getGrupo(string id)
        {
            Entidades.GrupoForza g = new Entidades.GrupoForza();
            Conexion.OpenConnection();
            string       query   = "select * from grupoForza where idGrupo = @idGrupo ";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idGrupo", id);
            comando.ExecuteNonQuery();
            MySqlDataReader reader = comando.ExecuteReader();

            if (reader.Read())
            {
                g.IdGrupo        = id;
                g.Paquete        = reader.GetString("paquete");
                g.Fecha          = reader.GetDateTime("fechaInicio");
                g.PeriodoCosecha = reader.GetDateTime("periodoCosecha");
                Conexion.CloseConnection();
                return(g);
            }
            Conexion.CloseConnection();
            return(g);
        }
Beispiel #12
0
        static public List <Entidades.GrupoForza> buscarGrupo()
        {
            List <Entidades.GrupoForza> grupos = new List <Entidades.GrupoForza>();

            Conexion.OpenConnection();
            Entidades.GrupoForza b = new Entidades.GrupoForza();

            string       query   = "Select DISTINCT grupoForza from cedulaIdentidad ORDER BY grupoForza";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

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

            while (reader.Read())
            {
                b         = new Entidades.GrupoForza();
                b.IdGrupo = reader.GetString("grupoForza");
                grupos.Add(b);
            }
            //retorna valores nulos en caso de no encontrar coincidencias
            Conexion.CloseConnection();
            return(grupos);
        }
Beispiel #13
0
 public void crearGrupo(Entidades.GrupoForza g)
 {
     DAO.GrupoForza.insertarGrupo(g);
     cargarComboGrupos();
 }