public void eliminarSeccion(Entidades.Seccion seccion) { DAO.Seccion.eliminar(seccion); lote = DAO.Lote.BuscarLote(lote.IdLote); cargarBloques(zoom); cargarSecciones(zoom); }
static public List <Entidades.Seccion> obtenerSeccionesConPaquete() { Conexion.OpenConnection(); List <Entidades.Seccion> list = new List <Entidades.Seccion>(); string query = "select idLote, idBloque, idSeccion,idPaquete,fechaProgramada,posicion,fechaInicial,area,grupoForza,bloqueo from seccion where idPaquete <> @paquete"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@paquete", "Sin Paquete"); comando.Prepare(); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { Entidades.Seccion s = new Entidades.Seccion(); s.FechaProgramada = reader.GetDateTime("fechaProgramada"); s.IdLote = reader.GetString("IdLote"); s.IdSeccion = reader.GetString("IdSeccion"); s.Posicion = reader.GetInt32("posicion"); s.Paquete = reader.GetString("idPaquete"); s.IdBloque = reader.GetString("IdBloque"); s.FechaInicial = reader.GetDateTime("fechaInicial"); s.Area = reader.GetDouble("area"); s.GrupoForza = reader.GetString("grupoForza"); s.Bloqueo = reader.GetBoolean("bloqueo"); list.Add(s); } Conexion.CloseConnection(); return(list); }
public static Entidades.DetalleAplicacion buscarForza(Entidades.Seccion s) { Conexion.OpenConnection(); Entidades.DetalleAplicacion paquete = new Entidades.DetalleAplicacion(); DataTable dtDatos = new DataTable(); string query = "select * from aplicacion a inner join detalleaplicacion d on a.idAplicacion = d.idAplicacion where d.idPaquete = @idPaquete and a.tipo = 'Forza' and posicion > @posicion"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@idPaquete", s.Paquete); comando.Parameters.AddWithValue("@posicion", s.Posicion); comando.Prepare(); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { paquete.IdPaquete = reader.GetString("idPaquete"); paquete.IdAplicacion = reader.GetInt32("idAplicacion"); paquete.Posicion = reader.GetInt32("posicion"); paquete.Tiempo = reader.GetInt32("tiempo"); break; } Conexion.CloseConnection(); return(paquete); }
private void btnLimpiarGrupo_Click(object sender, EventArgs e) { List <Entidades.Seccion> lista = new List <Entidades.Seccion>(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (getValue(dataGridView1.Rows[i])) { Entidades.Seccion s = new Entidades.Seccion(); s.IdSeccion = dataGridView1.Rows[i].Cells["idSeccion"].Value.ToString(); s.IdBloque = dataGridView1.Rows[i].Cells["idBloque"].Value.ToString(); s.IdLote = lote.IdLote; if (comprobarSeccion(s)) { return; } else { DAO.Seccion.quitarGrupo(s); } } } cargarTabla(); checkBox1.Checked = false; }
public void guardarSeccion(Entidades.Seccion seccion) { DAO.Seccion.insertar(seccion); lote = DAO.Lote.BuscarLote(lote.IdLote); cargarBloques(zoom); cargarSecciones(zoom); }
void imprimir(List <Entidades.Fecha> fechas) { string paquete = fechas[0].Paquete; int pos = fechas[0].Posicion; List <Entidades.Seccion> se = new List <Entidades.Seccion>(); foreach (var f in fechas) { Entidades.Seccion s = new Entidades.Seccion(); s.Aplicacion = f.Aplicacion; s.Area = f.Area; s.FechaProgramada = f.FechaProgramada; s.IdLote = f.Lote; s.IdBloque = f.Bloque; s.IdSeccion = f.Seccion; s.Posicion = f.Posicion; s.Paquete = f.Paquete; s.GrupoForza = f.grupoForza; s.Bloqueo = f.Bloqueo; se.Add(s); } CrearCedulaIdentidad c = new CrearCedulaIdentidad(DAO.DetalleAplicacion.getDetallePaquetePosicion(paquete, pos), se, false, this); c.ShowDialog(); }
static public Entidades.Seccion obtenerFechaSiguiente(Entidades.Seccion s) { Entidades.Seccion seccion = s; Entidades.DetalleAplicacion d; d = DetalleAplicacion.getNombreAplicacion(s.Paquete, s.Posicion + 1); seccion.Aplicacion = d.NombreAplicacion; return(seccion); }
static void Main(string[] args) { Thread.Sleep(1000); int cantLote = 0, cantBloque, canSeccion; int areaLote = 0, areaBloque, areaSeccion; for (int l = 1; l < 50; l++) { DAO.Lote.insertar(new Entidades.Lote() { IdLote = l.ToString(), Fecha = default(DateTime), Area = areaLote += l, CantPlantas = cantLote += l, Imagen = Image.FromFile("C:/Users/Luis Mora/Pictures/n.png") }); for (int b = 1; b < 8; b++) { DAO.Bloque.insertar(new Entidades.Bloque() { IdLote = l.ToString(), IdBloque = b.ToString(), PosX = 100, PosY = 100, CantSecciones = 0, AreaUtilizada = 0, Area = cantLote + 12, Detalles = "" }); for (int s = 1; s < 6; s++) { Entidades.Seccion seccion = new Entidades.Seccion() { IdBloque = b.ToString(), IdLote = l.ToString(), IdSeccion = s.ToString(), FechaProgramada = default(DateTime), FechaInicial = DateTime.Today, FechaSiembra = DateTime.Today, Area = s + 10, NumPlantas = s + 15, PosX = 150, PosY = 150, Posicion = -1, TipoSemilla = "", PesoSemilla = "", Paquete = "Primero" }; DAO.Seccion.insertar(seccion); DAO.Seccion.editPaquete(seccion); } Console.WriteLine("Lote: " + l.ToString() + " Agregado"); } } }
void crearButtonSeccion(Entidades.Seccion s) { BotonMapa b = new BotonMapa(s); b.MouseDown += new MouseEventHandler(mouseDown); b.MouseUp += new MouseEventHandler(mouseUp); b.MouseMove += new MouseEventHandler(mouseMove); //b.BackColor = pictureBox1.BackColor;///// toolTip1.SetToolTip(b, " Area: " + s.Area + "\n Numero de Plantas: " + s.NumPlantas); this.pictureBox1.Controls.Add(b); b.BringToFront(); }
private void btnEliminar_Click(object sender, EventArgs e) { try { Entidades.Seccion s = new Entidades.Seccion(); s.IdBloque = dataGridView1.CurrentRow.Cells["idBloque"].Value.ToString(); s.IdSeccion = dataGridView1.CurrentRow.Cells["idSeccion"].Value.ToString(); s.IdLote = lblLote.Text; // DAO.Seccion.limpiarGrupo(s); dt.Rows.RemoveAt(dataGridView1.CurrentRow.Index); } catch { } }
void quitar() { for (int i = 0; i < dataGridView2.Rows.Count; i++) { if (getValue(dataGridView2.Rows[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.quitarGrupo(s); } } }
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(); }
bool buscarCoincidencia(Entidades.Seccion s) { try { foreach (DataGridViewRow row in this.dataGridView1.Rows) { if (row.Cells["idSeccion"].Value.Equals(s.IdSeccion) && row.Cells["idBloque"].Value.Equals(s.IdBloque)) { MessageBox.Show("La seccion ya se encuentra en el grupo"); return(false); } } } catch { } return(true); }
void cargarLista() { secciones.Clear(); foreach (DataGridViewRow row in this.dataGridView1.Rows) { Entidades.Seccion s = new Entidades.Seccion(); s.IdSeccion = row.Cells["idSeccion"].Value.ToString(); s.FechaInicial = Convert.ToDateTime(row.Cells["fechaInicial"].Value.ToString()); s.IdBloque = row.Cells["idBloque"].Value.ToString(); s.IdLote = lblLote.Text; s.IdSeccion = row.Cells["idSeccion"].Value.ToString(); secciones.Add(s); } }
public EditSeccion(Mapa padreForm, Entidades.Seccion seccion) { this.padreForm = padreForm; this.seccion = seccion; InitializeComponent(); txtBloque.Text = seccion.IdBloque; txtArea.Text = seccion.Area.ToString(); txtCantidad.Text = seccion.NumPlantas.ToString(); txtDetalle.Text = seccion.Detalle; txtFSiembra.Value = seccion.FechaSiembra; txtPeso.Text = seccion.PesoSemilla.ToString(); txtTipo.Text = seccion.TipoSemilla; }
void agregar() { for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (getValue(dataGridView1.Rows[i])) { Entidades.Seccion s = new Entidades.Seccion(); s.IdSeccion = dataGridView1.Rows[i].Cells["Seccion"].Value.ToString(); s.IdBloque = dataGridView1.Rows[i].Cells["Bloque"].Value.ToString(); s.IdLote = dataGridView1.Rows[i].Cells["Lote"].Value.ToString(); try { DAO.Seccion.agregarGrupo(s, DAO.GrupoForza.getGrupo(comboBox1.Text)); } catch { } } } }
private void btnSeleccionar_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow.Cells["grupoForza"].Value.Equals("Sin Grupo")) { seccion = new Entidades.Seccion() { IdBloque = dataGridView1.CurrentRow.Cells["idBloque"].Value.ToString(), IdLote = dataGridView1.CurrentRow.Cells["idLote"].Value.ToString(), IdSeccion = dataGridView1.CurrentRow.Cells["idSeccion"].Value.ToString(), Posicion = (int)dataGridView1.CurrentRow.Cells["posicion"].Value, GrupoForza = dataGridView1.CurrentRow.Cells["grupoForza"].Value.ToString() }; } else { MessageBox.Show("La seccion seleccionada ya pertenece a un grupo"); } }
void cambiarCiclo() { List <Entidades.Seccion> lista = new List <Entidades.Seccion>(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (getValue(dataGridView1.Rows[i])) { Entidades.Seccion s = new Entidades.Seccion(); s.IdSeccion = dataGridView1.Rows[i].Cells["idSeccion"].Value.ToString(); s.IdBloque = dataGridView1.Rows[i].Cells["idBloque"].Value.ToString(); s.IdLote = lote.IdLote; s.Paquete = comboPaquete.Text; s.Posicion = int.Parse(comboPosicion.Text); DAO.Seccion.editPosicion(s); } } }
List <Entidades.Seccion> leerB() { List <Entidades.Seccion> lista = new List <Entidades.Seccion>(); for (int i = 0; i < dataGridView2.Rows.Count; i++) { Entidades.Seccion s = new Entidades.Seccion(); s.IdLote = dataGridView2.Rows[i].Cells[0].Value.ToString(); s.IdBloque = dataGridView2.Rows[i].Cells[1].Value.ToString(); s.IdSeccion = dataGridView2.Rows[i].Cells[2].Value.ToString(); s.GrupoForza = dataGridView2.Rows[i].Cells[3].Value.ToString(); s.Paquete = dataGridView2.Rows[i].Cells[4].Value.ToString(); s.Posicion = (int)dataGridView2.Rows[i].Cells[5].Value; lista.Add(s); } return(lista); }
private void btnDate_Click(object sender, EventArgs e) { List <Entidades.Seccion> lista = new List <Entidades.Seccion>(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (getValue(dataGridView1.Rows[i])) { Entidades.Seccion s = new Entidades.Seccion(); s.IdSeccion = dataGridView1.Rows[i].Cells["idSeccion"].Value.ToString(); s.IdBloque = dataGridView1.Rows[i].Cells["idBloque"].Value.ToString(); s.IdLote = lote.IdLote; s.FechaInicial = dateTimePicker1.Value; DAO.Seccion.editFechaInicial(s); } } cargarTabla(); checkBox1.Checked = false; }
bool comprobarSeccion(Entidades.Seccion s) { List <string> cedulas = DAO.Seccion.comprobarSeccion(s); string cadena = "Cedulas:"; foreach (var item in cedulas) { cadena += item + ","; } if (cadena.Equals("Cedulas:")) { return(false); } else { MessageBox.Show("La seccion #:" + s.IdSeccion + "Bloque:" + s.IdBloque + " No se puede eliminar o editar tiene cedulas en proceso: " + cadena); } return(true); }
List <Entidades.Seccion> leerA() { List <Entidades.Seccion> lista = new List <Entidades.Seccion>(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (getValue(dataGridView1.Rows[i])) { Entidades.Seccion s = new Entidades.Seccion(); s.IdLote = dataGridView1.Rows[i].Cells["Lote"].Value.ToString(); s.IdBloque = dataGridView1.Rows[i].Cells["Bloque"].Value.ToString(); s.IdSeccion = dataGridView1.Rows[i].Cells["Seccion"].Value.ToString(); s.GrupoForza = dataGridView1.Rows[i].Cells["Grupo"].Value.ToString(); s.Paquete = dataGridView1.Rows[i].Cells["Paquete"].Value.ToString(); s.Posicion = (int)dataGridView1.Rows[i].Cells["Posicion"].Value; lista.Add(s); } } return(lista); }
void clickSeccion(object sender, EventArgs e) { BotonMapa b = (BotonMapa)sender; if (!b.Font.Underline) { try { listActual.Add(DAO.Fechas.obtenerFechaSiguiente(b.seccion)); b.Font = new Font(b.Font, FontStyle.Underline); agregarSeccionesTabla(); } catch { MessageBox.Show("Esta seccion no puede ser aplicada"); } } else { Entidades.Seccion s = listActual.Where(se => se.IdBloque == b.seccion.IdBloque && se.IdSeccion == b.seccion.IdSeccion).First(); listActual.Remove(s); b.Font = new Font(b.Font, FontStyle.Regular); agregarSeccionesTabla(); } }
static public List <Entidades.Seccion> ListSeccionesCedula(int c) { Conexion.OpenConnection(); List <Entidades.Seccion> secciones = new List <Entidades.Seccion>(); string query = "select * from detalleseccioncedula where idCedula = @idCedula"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@idCedula", c); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { Entidades.Seccion seccion = new Entidades.Seccion(); seccion.IdLote = reader.GetInt32("lote").ToString(); seccion.IdBloque = reader.GetInt32("bloque").ToString(); seccion.IdSeccion = reader.GetInt32("seccion").ToString(); secciones.Add(seccion); } Conexion.CloseConnection(); return(secciones); }
void seccionClick(object sender, MouseEventArgs e) { BotonSeccion b = (BotonSeccion)sender; seccion = b.Seccion; }
public DetalleSeccion(Entidades.Seccion s) { InitializeComponent(); txtCantidad.AutoSize = true; }