private void btnEliminar_Click(object sender, EventArgs e) { try { if (MessageBox.Show("¿Desea eliminar permanentemente este lote?", "Aceptar", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (DAO.Lote.comprobarLote(lote.IdLote)) { MessageBox.Show("No se puede eliminar el lote tiene cedulas en proceso"); return; } else { DAO.Lote.eliminar(lote); } lote = null; cargarComboLotes(); zoom = 1; pictureBox1.Controls.Clear(); pictureBox1.Image = null; } } catch { MessageBox.Show("Debe seleccionar un lote", "Error"); } }
static public List <Entidades.Lote> buscarLotes() { List <Entidades.Lote> lotes = new List <Entidades.Lote>(); Conexion.OpenConnection(); Entidades.Lote b = new Entidades.Lote(); string query = "Select * from lote"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Prepare(); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { b = new Entidades.Lote(); b.IdLote = reader.GetString("idLote"); b.Area = reader.GetDouble("area"); //b.Imagen = ByteArrayToImage((byte[])reader["imagen"]); b.CantPlantas = reader.GetDouble("cantPlantas"); b.AreaUtilizada = reader.GetDouble("areaUtilizada"); b.CantPlantas = reader.GetDouble("cantPlantas"); b.AltoMapa = reader.GetDouble("altoMapa"); b.AnchoMapa = reader.GetDouble("anchoMapa"); lotes.Add(b); } //retorna valores nulos en caso de no encontrar coincidencias Conexion.CloseConnection(); return(lotes); }
public void eliminarBloque(Entidades.Bloque bloque) { DAO.Bloque.eliminar(bloque); lote = DAO.Lote.BuscarLote(lote.IdLote); cargarBloques(zoom); cargarSecciones(zoom); }
public void eliminarSeccion(Entidades.Seccion seccion) { DAO.Seccion.eliminar(seccion); lote = DAO.Lote.BuscarLote(lote.IdLote); cargarBloques(zoom); cargarSecciones(zoom); }
public void guardarSeccion(Entidades.Seccion seccion) { DAO.Seccion.insertar(seccion); lote = DAO.Lote.BuscarLote(lote.IdLote); cargarBloques(zoom); cargarSecciones(zoom); }
static public Entidades.Lote BuscarLote(string id) { Conexion.OpenConnection(); Entidades.Lote l = new Entidades.Lote(); string query = "Select* from lote Where idLote = @idLote"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@idLote", id); comando.Prepare(); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { l.IdLote = reader.GetString("idLote"); l.Imagen = ByteArrayToImage((byte[])reader["imagen"]); l.Area = reader.GetDouble("area"); l.AreaUtilizada = reader.GetDouble("areaUtilizada"); l.CantPlantas = reader.GetDouble("cantPlantas"); l.AnchoMapa = reader.GetDouble("anchoMapa"); l.AltoMapa = reader.GetDouble("altoMapa"); Conexion.CloseConnection(); return(l); } //retorna valores nulos en caso de no encontrar coincidencias Conexion.CloseConnection(); return(l); }
public void guardarBloque(Entidades.Bloque bloque) { DAO.Bloque.insertar(bloque); lote = DAO.Lote.BuscarLote(lote.IdLote); cargarBloques(zoom); cargarSecciones(zoom); }
private void button1_Click(object sender, EventArgs e) { lote = new Entidades.Lote(); lote.Area = double.Parse(txtArea.Text); lote.IdLote = txtCodigo.Text; try { lote.Imagen = image_compressor(txtImagen.Text); if (lote.Imagen == null) { MessageBox.Show("ERROR: Tipo formato de imagen no valido"); return; } } catch (Exception ex) { MessageBox.Show("ERROR_1:" + ex.Message + ex.Source); return; } /* * try * { * lote.Imagen = setQuality(lote.Imagen); * } * catch(Exception ex) { MessageBox.Show("ERROR_2:" + ex.Message); return; }*/ if (DAO.Lote.Existe(lote.IdLote)) { MessageBox.Show("Ya existe un lote con ese código"); } else { padreForm.guardarLote(lote); Dispose(); } }
private void crear(object sender, EventArgs e) { lote = new Entidades.Lote(); lote.Area = double.Parse(txtArea.Text); //lote.Imagen = txtImagen.Text; lote.IdLote = txtCodigo.Text; padre.guardarLote(lote); Dispose(); }
public DetallesLote(Entidades.Lote lote) { this.lote = lote; InitializeComponent(); txtArea.Text = lote.Area.ToString(); txtCodigo.Text = lote.IdLote; txtAreaUtilizada.Text = lote.AreaUtilizada.ToString(); txtCantPlantas.Text = lote.CantPlantas.ToString(); cargarCodecs(); }
public EditLote(Mapa padreForm, Entidades.Lote lote) { this.padreForm = padreForm; this.lote = lote; InitializeComponent(); txtArea.Text = lote.Area.ToString(); txtCodigo.Text = lote.IdLote; txtAreaUtilizada.Text = lote.AreaUtilizada.ToString(); txtCantPlantas.Text = lote.CantPlantas.ToString(); cargarCodecs(); }
public BloqueManager(Entidades.Lote lote, Entidades.Bloque bloque) { this.lote = lote; this.bloque = bloque; InitializeComponent(); cargarTabla(); cargarComboPaquetes(); cargarComboPosicion(comboPaquete.Text); cargarComboBloque(); comboBloque.Text = bloque.IdBloque; }
public BloqueManager(Entidades.Lote lote) { this.lote = lote; this.bloque = new Entidades.Bloque(); InitializeComponent(); cargarTabla(); cargarComboPaquetes(); cargarComboPosicion(comboPaquete.Text); cargarComboBloque(); comboBloque.Text = "Todos"; }
static public void eliminar(Entidades.Lote l) { Conexion.OpenConnection(); string query = "call eliminarLote(@idLote)"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@idLote", l.IdLote); comando.Prepare(); comando.ExecuteNonQuery(); Conexion.CloseConnection(); }
public void Ejecutar_AgregarLote() { var existencia = Mocks.Fabrica.CrearExistencia(_evento.Almacen); ((Mocks.AlmacenMock)_evento.Almacen).SetExistenciaReturn(existencia); var lote = new Entidades.Lote(new Documento()); _factory.Setup(c => c.CrearLote(_evento.LineaIngreso)) .Returns(lote); _manejador.Ejecutar(_evento); Assert.NotEmpty(existencia.Lotes); }
public void editarLote(Entidades.Lote lote) { //lote = DAO.Lote.BuscarLote(lote.IdLote); if (lote.Imagen == null) { DAO.Lote.modificarNoImagen(lote); } else { DAO.Lote.modificar(lote); } cargarLote(zoom); cargarBloques(zoom); cargarSecciones(zoom); }
static public void modificarNoImagen(Entidades.Lote l) { Conexion.OpenConnection(); string query = "UPDATE lote set area = @area, anchoMapa = @anchoMapa, altoMapa = @altoMapa WHERE idLote = @idLote"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@idLote", l.IdLote); comando.Parameters.AddWithValue("@area", l.Area); comando.Parameters.AddWithValue("@anchoMapa", l.AnchoMapa); comando.Parameters.AddWithValue("@altoMapa", l.AltoMapa); comando.Prepare(); comando.ExecuteNonQuery(); Conexion.CloseConnection(); }
static public void insertar(Entidades.Lote l) { Conexion.OpenConnection(); string query = "insert into lote (idLote, area,imagen,anchoMapa,altoMapa) values(@idLote, @area,@imagen,@ancho, @alto)"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@idLote", l.IdLote); comando.Parameters.AddWithValue("@area", l.Area); comando.Parameters.AddWithValue("@ancho", l.AnchoMapa); comando.Parameters.AddWithValue("@alto", l.AltoMapa); comando.Parameters.AddWithValue("@imagen", ImageToByteArray(l.Imagen)); comando.Prepare(); comando.ExecuteNonQuery(); Conexion.CloseConnection(); }
public DetalleLote(Entidades.Lote l, Mapa padre) { lote = l; this.padre = padre; InitializeComponent(); txtCodigo.Text = l.IdLote; txtArea.Text = l.Area.ToString(); //txtImagen.Text = l.Imagen; button1.Click += new EventHandler(editar); txtCodigo.ReadOnly = true; txtArea.ReadOnly = true; btnMapa.Enabled = false; button1.Enabled = false; cbEditando.Visible = true; }
void cargarLote(int zoom) { if (comboLotes.SelectedIndex == -1) { return; } lote = listaLotes[comboLotes.SelectedIndex]; lote.Imagen = DAO.Lote.getImagen(lote.IdLote); pictureBox1.Controls.Clear(); try { Size size = new Size(panel1.Width, panel1.Height); originalImage = lote.Imagen; scaledImage = ScaleImage(originalImage, panel1.Width, panel1.Height); zoomedImage = ZoomImage(scaledImage, zoom); pictureBox1.Image = zoomedImage; } catch { pictureBox1.Image = Vistas.Properties.Resources.sergio; } }
static public bool Existe(string id) { Conexion.OpenConnection(); Entidades.Lote l = new Entidades.Lote(); string query = "Select* from lote Where idLote = @idLote"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@idLote", id); comando.Prepare(); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { Conexion.CloseConnection(); return(true); } Conexion.CloseConnection(); return(false); }
public EditorMapa(Entidades.Lote lote) { InitializeComponent(); ToolTip toolTip1 = new ToolTip(); mapa = new Entidades.Mapa(lote); lblLote.Text = lote.IdLote; txtAreaLote.Text = lote.Area.ToString(); txtAreaLote.Enabled = false; pictureBox1.Image = Image.FromFile(lote.Imagen); // Set up the delays for the ToolTip. toolTip1.AutoPopDelay = 10000; toolTip1.InitialDelay = 0; toolTip1.ReshowDelay = 500; // Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = true; // Set up the ToolTip text for the Button and Checkbox. }
static public Image getImagen(string id) { Conexion.OpenConnection(); Entidades.Lote l = new Entidades.Lote(); string query = "Select imagen from lote Where idLote = @idLote"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Parameters.AddWithValue("@idLote", id); comando.Prepare(); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { l.Imagen = ByteArrayToImage((byte[])reader["imagen"]); Conexion.CloseConnection(); return(l.Imagen); } //retorna valores nulos en caso de no encontrar coincidencias Conexion.CloseConnection(); return(l.Imagen); }
void actualizarMapa() { try { secciones.Clear(); bloques.Clear(); listActual.Clear(); seccionesSeleccionadas.Clear(); dataSecciones.Rows.Clear(); progressBar1.Value = 0; borraControles(); botones.Clear(); loteActual = lotes.Where(l => l.IdLote == cmbLote.SelectedItem.ToString()).First(); loteActual.Imagen = DAO.Lote.getImagen(loteActual.IdLote); progressBar1.Value += 10; cargarLote(zoom); // ChangePictureBoxImage(opcMapa.l.Imagen); cargarSeccion(loteActual.IdLote); progressBar1.Value += 40; cargarBloques(loteActual.IdLote); progressBar1.Value += 50; toolTip1.AutoPopDelay = 0; toolTip1.InitialDelay = 0; toolTip1.ReshowDelay = 500; // Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = true; if (errorAgregando == true) { MessageBox.Show(this, "Algunas secciones cuentan con algun problema: \n 1.Debe de agregar un paquete. \n 2.Ya termino el paquete.", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); errorAgregando = false; } } catch (Exception ex) { } }
static public List <Entidades.Lote> buscarLotes() { List <Entidades.Lote> lotes = new List <Entidades.Lote>(); Conexion.OpenConnection(); Entidades.Lote b = new Entidades.Lote(); string query = "Select DISTINCT lote from cedulaIdentidad ORDER BY lote"; MySqlCommand comando = new MySqlCommand(query, Conexion.Connection); comando.Prepare(); MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { b = new Entidades.Lote(); b.IdLote = reader.GetString("lote"); lotes.Add(b); } //retorna valores nulos en caso de no encontrar coincidencias Conexion.CloseConnection(); return(lotes); }
public void guardarLote(Entidades.Lote lote) { DAO.Lote.insertar(lote); cargarComboLotes(); comboLotes.Text = lote.IdLote; }
public void editarBloque(Entidades.Bloque bloque) { DAO.Bloque.modificar(bloque); lote = DAO.Lote.BuscarLote(lote.IdLote); cargarBloques(zoom); }