Пример #1
0
 private void CargarGridCatalogoBusq(string TextoBusqueda)
 {
     try
     {
         CatalogoWeb Aux = new CatalogoWeb {
             Conexion = Comun.Conexion, IDSucursal = Comun.IDSucursalCaja, Tag = TextoBusqueda
         };
         CatalogoWeb_Negocio CWN   = new CatalogoWeb_Negocio();
         List <CatalogoWeb>  Lista = CWN.ObtenerCatalogoWebBusq(Aux);
         foreach (CatalogoWeb Item in Lista)
         {
             System.IO.MemoryStream ms = new System.IO.MemoryStream(Item.BufferImagen);
             Item.ImagenMin = Image.FromStream(ms);
             Item.ImagenDGV = ComprimirImagen.ResizeImage(Item.ImagenMin, 40, 40);
         }
         this.dgvCatalogoWeb.DataSource          = null;
         this.dgvCatalogoWeb.AutoGenerateColumns = false;
         this.dgvCatalogoWeb.DataSource          = Lista;
         this.TextoBusq = TextoBusqueda;
         this.Busqueda  = true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 private Image ObtenerImagen()
 {
     try
     {
         int                    RowIndex = this.dgvCatalogoWeb.Rows.GetFirstRow(DataGridViewElementStates.Selected);
         CatalogoWeb            Datos    = this.ObtenerDatosGrid(RowIndex);
         ImageFormat            Formato  = ImageFormat.Jpeg;
         System.IO.MemoryStream ms       = new System.IO.MemoryStream(Datos.BufferImagen);
         Datos.Imagen = Image.FromStream(ms);
         return(ComprimirImagen.ResizeImage(Datos.Imagen, 500, 500, Formato));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                //Comprimir la imagen
                Image ImagenHuella = ComprimirImagen.ResizeImage(this.ImgHuella.Image, 250, 250, ImageFormat.Png);
                //Guardarla en una ruta especifica
                ImagenHuella.Save(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Huella\" + this.DatosEmpleado.IDEmpleado + ".png"));
                //Obtener la imagen en bytes
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                ImagenHuella.Save(ms, ImageFormat.Png);
                this.DatosEmpleado.BufferHuella = ms.GetBuffer();
                this.DatosEmpleado.IDUsuario    = Comun.IDUsuario;
                this.DatosEmpleado.Conexion     = Comun.Conexion;

                MemoryStream fingerprintData = new MemoryStream();
                Lector.Template.Serialize(fingerprintData);
                fingerprintData.Position = 0;
                BinaryReader br    = new BinaryReader(fingerprintData);
                byte[]       bytes = br.ReadBytes((Int32)fingerprintData.Length);
                this.DatosEmpleado.HuellaString = ConvertirStringToBytes.getString(bytes);
                Usuario_Negocio UN = new Usuario_Negocio();
                UN.AsignarHuellaXIDEmpleado(DatosEmpleado);
                if (this.DatosEmpleado.Completado)
                {
                    MessageBox.Show("Datos guardados correctamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("Ocurrió un error al guardar los datos. Intente nuevamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                LogError.AddExcFileTxt(ex, "frmCatEmpleadoHuella ~ btnGuardar_Click");
                MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }