Пример #1
1
    /// <summary>
    /// Setea la lista de imagenes de una noticia
    /// </summary>
    /// <returns></returns>
    public static List<Imagen> getImagenes(Noticia noticia, OdbcConnection con)
    {
        List<Imagen> listaImagenes = new List<Imagen>();
        OdbcDataReader dr = null;

        String query = "SELECT i.id, i.pathBig, i.pathSmall, i.portada, i.pathMedium FROM imagen i, imagen_x_noticia n WHERE i.id=n.idImagen AND n.idNoticia=" + noticia.IdNoticia;

        try
        {
            OdbcCommand cmd = new OdbcCommand(query, con);
            cmd.CommandType = CommandType.Text;
            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Imagen imagen = new Imagen();
                imagen.IdImagen = dr.GetInt32(0);
                imagen.PathBig = dr.GetString(1);
                imagen.PathSmall = dr.GetString(2);
                imagen.Portada = dr.GetBoolean(3);
                imagen.PathMedium = dr.GetString(4);
                listaImagenes.Add(imagen);
            }
        }
        catch (Exception e)
        {
            throw new SportingException("Ocurrio un problema al intentar obtener las imagenes de las noticias. " + e.Message);
        }

        return listaImagenes;
    }
Пример #2
0
        public void SetTop10(object[] top10)
        {
            this.top10 = (Imagen[])top10;

            Imagen img1  = (Imagen)top10[0];
            Imagen img2  = (Imagen)top10[1];
            Imagen img3  = (Imagen)top10[2];
            Imagen img4  = (Imagen)top10[3];
            Imagen img5  = (Imagen)top10[4];
            Imagen img6  = (Imagen)top10[5];
            Imagen img7  = (Imagen)top10[6];
            Imagen img8  = (Imagen)top10[7];
            Imagen img9  = (Imagen)top10[8];
            Imagen img10 = (Imagen)top10[9];

            pictureBox1.Image  = img1.bitmap;
            pictureBox2.Image  = img2.bitmap;
            pictureBox3.Image  = img3.bitmap;
            pictureBox4.Image  = img4.bitmap;
            pictureBox5.Image  = img5.bitmap;
            pictureBox6.Image  = img6.bitmap;
            pictureBox7.Image  = img7.bitmap;
            pictureBox8.Image  = img8.bitmap;
            pictureBox9.Image  = img9.bitmap;
            pictureBox10.Image = img10.bitmap;
        }
Пример #3
0
        public PartialViewResult GetFotoPorId(int idFoto)
        {
            int ClienteId = GetClienteSeleccionado();

            if (ClienteId == 0)
            {
                return(null);
            }

            Imagen img = imagenesRepository.GetFotoPorId(ClienteId, idFoto);

            ImagenViewModel model = new ImagenViewModel()
            {
                id                    = img.id,
                comentarios           = img.comentarios,
                cantTags              = img.cantTags,
                fechaCreacion         = img.fechaCreacion,
                idPuntoDeVenta        = img.idPuntoDeVenta,
                idReporte             = img.idReporte,
                imgb64                = img.imgb64,
                nombrePuntoDeVenta    = img.nombrePuntoDeVenta,
                tags                  = img.tags,
                direccionPuntoDeVenta = img.direccion,
                provincia             = img.provincia,
                Usuario               = img.usuario
            };

            return(PartialView("_imagenPreview", model));
        }
        //Creamos el método CargarDatos
        private void CargarDatos()
        {
            string _fechaModificacion;
            Imagen imagen = new Imagen();

            if (lista == null)
            {
                lista = blImagen.Listar(idProductoImagen);
            }

            if (lista.Count > 0)
            {
                dataGridView1.Rows.Clear();
                for (int i = 0; i < lista.Count; i++)
                {
                    if (lista[i].FechaModificacionImagen.Year <= 2000)
                    {
                        _fechaModificacion = "";
                    }
                    else
                    {
                        _fechaModificacion = lista[i].FechaModificacionImagen.ToString();
                    }
                    dataGridView1.Rows.Add(
                        lista[i].IdImagen,
                        lista[i].TituloImagen,
                        lista[i].CodigoImagen,
                        (EnumEstados.Estados)lista[i].EstadoImagen,
                        lista[i].FechaCreacionImagen,
                        lista[i].UsuarioCreacionImagen,
                        _fechaModificacion,
                        lista[i].UsuarioModificacionImagen);
                }
            }
        }
Пример #5
0
        public IActionResult Upload()
        {
            IFormFileCollection files = Request.Form.Files;
            List <int>          ids   = new List <int>();

            foreach (IFormFile file in files)
            {
                Imagen imagen       = _repo.Add(new Imagen());
                string subPath      = string.Format("Images/{0}/{1}", User.FindFirst("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name").Value, imagen.Id + ".jpeg");
                string absolutePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), subPath);
                imagen.Url = subPath;
                _repo.Update(imagen);
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    file.CopyTo(memoryStream);
                    Directory.CreateDirectory(Path.GetDirectoryName(absolutePath));
                    System.IO.File.WriteAllBytes(absolutePath, memoryStream.ToArray());
                }
                ids.Add(imagen.Id);
            }

            return(Ok(new {
                Ids = ids.ToArray()
            }));
        }
Пример #6
0
        public override void CargarDatos(int?entidadId)
        {
            // Instancion por medio del Inyector el Objeto Grupo
            empleado = ObjectFactory.GetInstance <Empleado>();

            if (entidadId.HasValue)
            {
                empleado = recursosHumanosUoW.EmpleadoRepositorio.ObtenerPorId(entidadId.Value);

                this.txtApellido.Text              = empleado.Apellido;
                this.txtNombre.Text                = empleado.Nombre;
                this.txtDni.Text                   = empleado.Dni;
                this.txtTelefono.Text              = empleado.Telefono;
                this.txtCelular.Text               = empleado.Celular;
                this.txtMatriculaNacional.Text     = empleado.MatriculaNacional;
                this.txtMatriculaProvincial.Text   = empleado.MatriculaProvincial;
                this.cmbEspecialidad.SelectedValue = empleado.EspecialidadId;
                this.dtpFechaIngreso.Value         = empleado.FechaIngreso;
                this.dtpFechaNacimiento.Value      = empleado.FechaNacimiento;
                this.imgFotoEmpleado.Image         = Imagen.Convertir_Bytes_Imagen(empleado.FotoEmpleado);

                this.txtApellido.Focus();
            }
            else
            {
                Mensaje.Mostrar(new Exception("Error al cargar los Datos"), Constantes.TipoMensaje.Error);
            }
        }
        public override void EjecutarComandoNuevo()
        {
            if (!ValidarEmail(txtMail.Text, error, txtMail))
            {
                MessageBox.Show("Formato de correo Iconrrecto");

                return;
            }

            var nuevoEmpleado = new EmpleadoDto
            {
                Apellido       = txtApellido.Text,
                Legajo         = int.Parse(txtLegajo.Text),
                Nombre         = txtNombre.Text,
                Dni            = txtDni.Text,
                Telefono       = txtTelefono.Text,
                Direccion      = txtDomicilio.Text,
                ProvinciaId    = (long)cmbProvincia.SelectedValue,
                DepartamentoId = (long)cmbDepartamento.SelectedValue,
                LocalidadId    = (long)cmbLocalidad.SelectedValue,
                Mail           = txtMail.Text,
                Foto           = Imagen.ConvertirImagen(imgFoto.Image),
                Eliminado      = false
            };

            _empleadoServicio.Insertar(nuevoEmpleado);

            LimpiarControles(this);

            imgFoto.Image = Imagen.ImagenEmpleadoPorDefecto;
        }
Пример #8
0
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            UtilidadS3 utilidad = new UtilidadS3();

            evento = (Eventos)this.DataContext;
            Imagen op = new Imagen();

            if (modificarImagen == true)
            {
                nuevaDir      = op.cambia(direccionImagen, 800, 800, evento.nombre);
                evento.afiche = utilidad.subirSalaoEvento(evento.nombre, nuevaDir, evento.nombre + "." + nombreImagen.Split('.')[1], false);
            }
            evento.fecha = dpFecha.SelectedDate.Value.Date;
            if (modificar == false)
            {
                evento.usuario = Settings.user.username;
                evento.guardar();
                modificarImagen = false;
            }
            else
            {
                evento.modificar();
                modificarImagen = false;
            }
            if (Connection.Objects.Error.isActivo())
            {
                MessageBox.Show(Connection.Objects.Error.descripcionError, Connection.Objects.Error.nombreError);
            }
            else
            {
                MessageBox.Show("Correcto");
                borde.Child = anterior;
            }
        }
Пример #9
0
        public static int InsertImagen(Imagen objImagen, ref string titulo)
        {
            if (string.IsNullOrEmpty(objImagen.Titulo))
            {
                throw new ArgumentException("El titulo no puede ser nulo o vacío.");
            }
            if (objImagen.Size <= 0)
            {
                throw new ArgumentException("El tamanho de la imagen no puede ser menor o igual a cero.");
            }
            if (string.IsNullOrEmpty(objImagen.Extencion))
            {
                throw new ArgumentException("La extension no puede ser nulo o vacio.");
            }
            int?ImagenId = 0;

            try
            {
                ImagenTableAdapter theAdapter = new ImagenTableAdapter();
                theAdapter.InsertImagen(ref ImagenId,
                                        objImagen.Titulo,
                                        objImagen.Size,
                                        objImagen.Extencion,
                                        objImagen.Directorio,
                                        objImagen.FechaImagen);
            }
            catch (Exception ex)
            {
                log.Error("Ocurrio un error al Insertar la imagen.", ex);
                throw ex;
            }
            titulo = objImagen.Titulo;
            return((int)ImagenId);
        }
Пример #10
0
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            UtilidadS3 utilidad = new UtilidadS3();

            usuario = (Usuario)this.DataContext;
            Imagen op = new Imagen();

            if (modificarImagen == true)
            {
                nuevaDir           = op.cambia(direccionImagen, 256, 256, usuario.username);
                usuario.fotografia = utilidad.subirFotoUsuario(usuario.username, nuevaDir, usuario.username + nombreImagen.Split('.')[1]);
            }
            if (modificar == false)
            {
                usuario.guardar();
            }
            else
            {
                usuario.modificar();
            }
            if (Connection.Objects.Error.isActivo())
            {
                MessageBox.Show(Connection.Objects.Error.nombreError, Connection.Objects.Error.descripcionError);
            }
            else
            {
                MessageBox.Show("Correcto");
                borde.Child = anterior;
            }
        }
Пример #11
0
        public override void ModificarRegistro()
        {
            try
            {
                paciente.Apellido         = this.txtApellido.Text;
                paciente.Nombre           = this.txtNombre.Text;
                paciente.Dni              = this.txtDni.Text;
                paciente.Telefono         = this.txtTelefono.Text;
                paciente.NumeroAfiliado   = this.txtNroAfiliado.Text;
                paciente.PlanObraSocial   = this.txtPlanObraSocial.Text;
                paciente.Domicilio        = this.txtDireccion.Text;
                paciente.Celular          = this.txtCelular.Text;
                paciente.SexoId           = Convert.ToInt32(this.cmbSexo.SelectedValue);
                paciente.ObraSocialId     = Convert.ToInt32(this.cmbObraSocial.SelectedValue);
                paciente.GrupoSanguineoId = Convert.ToInt32(this.cmbGrupoSanguineo.SelectedValue);
                paciente.Foto             = Imagen.Convertir_Imagen_Bytes(this.imgFotoPaciente.Image);
                paciente.FechaNacimiento  = this.dtpFechaNacimiento.Value;
                paciente.Mail             = this.txtMail.Text;
                paciente.EsDown           = this.chkEsDown.Checked;

                datosPacienteUoW.PacienteRepositorio.Modificar(paciente);
                datosPacienteUoW.Commit();
            }
            catch (Exception ex)
            {
                Mensaje.Mostrar(ex, Constantes.TipoMensaje.Error);
            }
        }
Пример #12
0
        public override void EjecutarComandoModificar()
        {
            var modificarRegistro = new ArticuloCrudDto
            {
                Id             = EntidadId.Value,
                Codigo         = int.Parse(txtCodigo.Text),
                CodigoBarra    = txtcodigoBarra.Text,
                Descripcion    = txtDescripcion.Text,
                Abreviatura    = txtAbreviatura.Text,
                Detalle        = txtDetalle.Text,
                Ubicacion      = txtUbicacion.Text,
                MarcaId        = (long)cmbMarca.SelectedValue,
                RubroId        = (long)cmbRubro.SelectedValue,
                UnidadMedidaId = (long)cmbUnidad.SelectedValue,
                IvaId          = (long)cmbIva.SelectedValue,
                PrecioCosto    = nudPrecioCosto.Value,
                //------------------------------------------------//
                StockActual          = nudStock.Value,
                StockMinimo          = nudStockMin.Value,
                DescuentaStock       = chkDescontarStock.Checked,
                PermiteStockNegativo = chkPermitirStockNeg.Checked,
                ActivarLimiteVenta   = chkActivarLimite.Checked,
                LimiteVenta          = nudLimiteVenta.Value,
                ActivarHoraVenta     = chkActivarHoraVenta.Checked,
                HoraLimiteVentaDesde = dtpHoraDesde.Value,
                HoraLimiteVentaHasta = dtpHoraHasta.Value,
                //------------------------------------------------//
                Foto      = Imagen.ConvertirImagen(imgFoto.Image),
                Eliminado = false
            };

            _articuloServicio.Modificar(modificarRegistro);
        }
Пример #13
0
 /// Carga la imagen que representara a este elemento grafico
 public void CargarImagen(string nombre)
 {
     miImagen = new Imagen();
     miImagen.Cargar(nombre);
     contieneImagen    = true;
     contieneSecuencia = false;
 }
Пример #14
0
        public List <Imagen> Listar(int idProducto)
        {
            List <Imagen> lista = new List <Imagen>();

            using (SqlConnection con = new SqlConnection(CadenaConexion))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("ListarImagenes", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@IdProductoImagen", idProducto);
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr != null && dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Imagen imagen = new Imagen(
                            (int)dr["IdImagen"],
                            (int)dr["idProductoImagen"],
                            (string)dr["TituloImagen"],
                            (byte[])dr["CodigoImagen"],
                            (DateTime)dr["FechaCreacionImagen"],
                            (string)dr["UsuarioCreacionImagen"],
                            (DateTime)dr["FechaModificacionImagen"],
                            (string)dr["UsuarioModificacionImagen"],
                            (int)dr["EstadoImagen"]);
                        lista.Add(imagen);
                    }
                }
            }
            return(lista);
        }
Пример #15
0
    /// <summary>
    /// retorna una imagen
    /// </summary>
    /// <returns></returns>
    public static Imagen getImagen(OdbcConnection con, int idImagen)
    {
        DataSet ds = new DataSet();
        Imagen imagen = new Imagen();
        try
        {
            OdbcCommand cmd = new OdbcCommand("SELECT i.id, i.pathBig, i.pathSmall, i.portada, i.pathMedium FROM imagen i WHERE i.id=" + idImagen, con);
            cmd.CommandType = CommandType.Text;
            OdbcDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                imagen.IdImagen = dr.GetInt32(0);
                imagen.PathBig = dr.GetString(1);
                imagen.PathSmall = dr.GetString(2);
                imagen.Portada = dr.GetBoolean(3);
                imagen.PathMedium = dr.GetString(4);
            }
        }
        catch (Exception e)
        {
            throw new SportingException("Ocurrio un problema al intentar obtener la imagen. " + e.Message);
        }
        return imagen;
    }
        public override void CargarDatos(long?entidadId)
        {
            if (entidadId.HasValue)//Eliminar o Modificar
            {
                groupPrecio.Enabled = false;
                nudStock.Enabled    = false;

                var resultado = (ArticuloCrudDto)_articuloServicio.Obtener(entidadId.Value);

                if (resultado == null)
                {
                    MessageBox.Show("Ocurrio un error al Obtener el registro seleccionado");
                    Close();
                }

                // ==================================================== //
                // =============== Datos del Articulo ========== //
                // ==================================================== //

                txtCodigo.Text          = resultado.Codigo.ToString();
                txtcodigoBarra.Text     = resultado.CodigoBarra;
                txtDescripcion.Text     = resultado.Descripcion;
                txtAbreviatura.Text     = resultado.Abreviatura;
                txtDetalle.Text         = resultado.Detalle;
                txtUbicacion.Text       = resultado.Ubicacion;
                cmbMarca.SelectedValue  = resultado.MarcaId;
                cmbRubro.SelectedValue  = resultado.RubroId;
                cmbUnidad.SelectedValue = resultado.UnidadMedidaId;
                cmbIva.SelectedValue    = resultado.IvaId;

                // ==================================================== //
                // =============== Datos del Generales ========== //
                // ==================================================== //

                nudStockMin.Value           = resultado.StockMinimo;
                chkDescontarStock.Checked   = resultado.DescuentaStock;
                chkPermitirStockNeg.Checked = resultado.PermiteStockNegativo;
                chkActivarLimite.Checked    = resultado.ActivarLimiteVenta;
                nudLimiteVenta.Value        = resultado.LimiteVenta;
                chkActivarHoraVenta.Checked = resultado.ActivarHoraVenta;
                dtpHoraDesde.Value          = resultado.HoraLimiteVentaDesde;
                dtpHoraHasta.Value          = resultado.HoraLimiteVentaHasta;

                // ==================================================== //
                // =============== Foto del Articulo ========== //
                // ==================================================== //

                imgFoto.Image = Imagen.ConvertirImagen(resultado.Foto);
                if (TipoOperacion == TipoOperacion.Eliminar)
                {
                    DesactivarControles(this);
                }
            }

            else // Nuevo
            {
                btnEjecutar.Text = "Grabar";
                LimpiarControles(this);
            }
        }
Пример #17
0
    public static Imagen ActualizarImagen(string descripcion, string modulo, string id)
    {
        ImagenBLL.Update(descripcion, modulo, Convert.ToInt32(id));
        Imagen objImagen = ImagenBLL.SelectById(Convert.ToInt32(id));

        return(objImagen);
    }
Пример #18
0
        public static void UpdateImagen(Imagen objImagen)
        {
            if (objImagen.ImagenId <= 0)
            {
                throw new ArgumentException("el id de la Imagen no puede ser menor o igual a cero.");
            }

            try
            {
                ImagenTableAdapter localAdapter = new ImagenTableAdapter();
                object             resutl       = localAdapter.UpdateImagen(
                    objImagen.Titulo,
                    objImagen.Size,
                    objImagen.Extencion,
                    objImagen.Directorio,
                    objImagen.FechaImagen,
                    objImagen.ImagenId);

                log.Debug("Se actualizo el producto " + objImagen.Titulo);
            }
            catch (Exception q)
            {
                log.Error("Ocurrió un error al actualizar la imagen", q);
                throw q;
            }
        }
Пример #19
0
    static void Main()
    {
        Medio  m = new Medio("Anónimo", 10000, "MPEG");
        Imagen i = new Imagen("Anónimo", 500, "JPG", 800, 600);
        Sonido s = new Sonido("Anónimo", 500, "MP3", true, 50, 300);
        Video  v = new Video(
            "Anónimo", 50000, "AVI", "XXX", 700, 600, 800);

        const int TAMANYO = 3;

        Medio[] medios = new Medio[TAMANYO];

        medios[0] = new Imagen("Anónimo", 400, "PNG", 800, 600);
        medios[1] = new Sonido("Anónimo", 550, "MIDI", false, 60, 400);
        medios[2] = new Video(
            "Anónimo", 6000, "MKV", "XX", 700, 600, 800);

        for (int indice = 0; indice < TAMANYO; indice++)
        {
            Console.WriteLine(medios[indice]);
        }

        Console.WriteLine();
        foreach (Medio medio in medios)
        {
            Console.WriteLine(medio);
        }
    }
Пример #20
0
        /**
         * Busca los registros que coincidan con los datos enviados
         * @param Imagen obj
         * @return Retorna la lista de los registros que coinciden
         */
        public Imagen[] buscarImagen(Imagen obj, int pagina, int numRegPagina)
        {
            Imagen[]      result = null;
            List <Imagen> lista  = null;

            if (pagina > 0 && numRegPagina > 0)
            {
                pagina--;
                int limInf = 0;
                int limSup = 0;
                limInf = pagina * numRegPagina + 1;
                limSup = (pagina + 1) * numRegPagina;
                try {
                    ImagenDao dao = new ImagenDao();
                    conn  = conexion.conectar();
                    lista = dao.searchMatching(conn, obj, limInf, limSup);
                    if (lista != null && lista.Count > 0)
                    {
                        result = lista.ToArray();
                    }
                } catch (Exception e) {
                    result = null;
                } finally {
                    if (conn != null && conn.State == System.Data.ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
            return(result);
        }
Пример #21
0
        public async Task <IActionResult> Edit(int id, [Bind("Idimagen,Idlocal,Url")] Imagen imagen)
        {
            if (id != imagen.Idimagen)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(imagen);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ImagenExists(imagen.Idimagen))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idlocal"] = new SelectList(_context.Local, "Idlocal", "Idlocal", imagen.Idlocal);
            return(View(imagen));
        }
Пример #22
0
        /**
         * Inserta nuevo registro en la tabla
         * @param Imagen obj
         * @return Retorna el mismo objeto pero con la llave primaria configurada
         */
        public Imagen crearImagen(Imagen obj)
        {
            List <Imagen> lista   = null;
            Imagen        obj_new = new Imagen();

            try {
                ImagenDao dao = new ImagenDao();
                conn = conexion.conectar();
                int id = Funciones.obtenerId(conn, "IMAGEN");
                obj.ID_IMAGEN = id;
                dao.create(conn, obj);
                //verificar existencia
                obj_new.ID_IMAGEN = obj.ID_IMAGEN;
                lista             = dao.searchMatching(conn, obj_new);
                if (lista != null && lista.Count > 0)
                {
                    obj_new = (Imagen)lista[0];
                }
                else
                {
                    obj_new.ID_IMAGEN = -1;
                }
            } catch (Exception e) {
                obj_new.ID_IMAGEN = -1;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(obj_new);
        }
Пример #23
0
        public override void NuevoRegistro()
        {
            try
            {
                empleado = ObjectFactory.GetInstance <Empleado>();

                empleado.Apellido            = this.txtApellido.Text;
                empleado.Nombre              = this.txtNombre.Text;
                empleado.Dni                 = this.txtDni.Text;
                empleado.Telefono            = this.txtTelefono.Text;
                empleado.MatriculaProvincial = this.txtMatriculaProvincial.Text;
                empleado.MatriculaNacional   = this.txtMatriculaNacional.Text;
                empleado.Celular             = this.txtCelular.Text;
                empleado.EspecialidadId      = Convert.ToInt32(this.cmbEspecialidad.SelectedValue);
                empleado.FotoEmpleado        = Imagen.Convertir_Imagen_Bytes(this.imgFotoEmpleado.Image);
                empleado.FechaIngreso        = this.dtpFechaIngreso.Value;
                empleado.FechaNacimiento     = this.dtpFechaNacimiento.Value;

                recursosHumanosUoW.EmpleadoRepositorio.Insertar(empleado);
                recursosHumanosUoW.Commit();

                this.txtApellido.Focus();
            }
            catch (Exception ex)
            {
                Mensaje.Mostrar(ex, Constantes.TipoMensaje.Error);
            }
        }
Пример #24
0
        /**
         * Busca el primer registro que coincida con los datos enviados
         * @param Imagen obj
         * @return Retorna el mismo objeto pero con los datos consultados
         */
        public Imagen buscarPrimeroImagen(Imagen obj)
        {
            List <Imagen> lista = null;

            try {
                ImagenDao dao = new ImagenDao();
                conn  = conexion.conectar();
                lista = dao.searchMatching(conn, obj);
                if (lista != null && lista.Count > 0)
                {
                    obj = (Imagen)lista[0];
                }
                else
                {
                    obj.ID_IMAGEN = -1;
                }
            } catch (Exception e) {
                obj.ID_IMAGEN = -1;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(obj);
        }
Пример #25
0
        public Imagen Create(Imagen entity)
        {
            var result = _repository.Create(entity);

            _repository.Save();
            return(result);
        }
Пример #26
0
        public List <Imagen> GetFotosDias(int clienteId, int dias)
        {
            List <Imagen> imagenes = new List <Imagen>();

            using (SqlConnection cn = new SqlConnection((new RepContext()).Database.Connection.ConnectionString.ToString()))
            {
                SqlCommand cmd = new SqlCommand("reportingGetFotosDias", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 240;
                cmd.Parameters.Add("@IdCliente", SqlDbType.Int).Value = clienteId;
                cmd.Parameters.Add("@Dias", SqlDbType.Int).Value      = dias;
                cn.Open();

                SqlDataReader r = cmd.ExecuteReader();

                if (r.HasRows)
                {
                    while (r.Read())
                    {
                        Imagen img = new Imagen
                        {
                            nombrePuntoDeVenta = r["nombrePuntoDeVenta"].ToString(),
                            id             = int.Parse(r["IdPuntoDeVentaFoto"].ToString()),
                            idPuntoDeVenta = int.Parse(r["idPuntoDeVenta"].ToString()),
                            comentarios    = r["comentarios"].ToString(),
                            fechaCreacion  = r["fechaCreacion"].ToString()
                        };
                        imagenes.Add(img);
                    }
                }
            }

            return(imagenes);
        }
 private void agregar_Click(object sender, EventArgs e)
 {
     if (modificacion == true)
     {
         image.SetDescripcion(campoDescripcion.Text);
         image.SetRuta(ruta);
         tabla.CurrentRow.Cells[0].Value = image.GetDescripcion();
         tabla.CurrentRow.Cells[1].Value = Image.FromFile(image.GetRuta());
         describeModel.SetImagen(image, tabla.CurrentRow.Index);
         modificar.Enabled = true;
     }
     else
     {
         image = new Imagen();
         image.SetDescripcion(campoDescripcion.Text);
         image.SetRuta(ruta);
         tabla.Rows.Add(image.GetDescripcion(), Image.FromFile(image.GetRuta()));
         describeModel.AgregarImagen(image);
         indice = indice + 1;
     }
     campoImagen.Image = null;
     campoDescripcion.Clear();
     if (indice == 5)
     {
         agregar.Enabled     = false;
         campoImagen.Enabled = false;
     }
     if (tabla.Rows.Count == 5)
     {
         botonAceptar.Enabled = true;
     }
 }
Пример #28
0
    public HotelConImagenes actualizarImagenHome(Imagen nuevaImagen)
    {
        HotelConImagenes retornoHoteles;

        retornoHoteles = dominio.actualizarImagenHome(nuevaImagen);
        return(retornoHoteles);
    }
Пример #29
0
 private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
 {
     if (this.p1.IsEmpty == true)
     {
         this.p1          = new Point(e.X, e.Y);
         this.label1.Text = "Haga clic en la imagen donde quiera que sea \n la esquina inferior derecha de la imagen recortada.";
         return;
     }
     this.p2 = new Point(e.X, e.Y);
     if (this.p1 == this.p2 || this.p1.X > this.p2.X || this.p1.Y > this.p2.Y)
     {
         MessageBox.Show("Puntos incorrectos, inténtelo de nuevo.");
         this.label1.Text = "Haga clic en la imagen donde quiera que sea \n la esquina superior izquierda de la imagen recortada.";
         this.p1          = new Point();
         this.p2          = new Point();
         return;
     }
     Pixel[,] tmpImg = new Pixel[this.p2.Y - this.p1.Y, this.p2.X - this.p1.X];
     Pixel[,] orgImg = this.img.GetDatos();
     for (int i = this.p1.Y, y = 0; i < this.p2.Y; i++, y++)
     {
         for (int j = this.p1.X, x = 0; j < this.p2.X; j++, x++)
         {
             tmpImg[y, x] = new Pixel(orgImg[i, j].GetR(), orgImg[i, j].GetG(), orgImg[i, j].GetB());
         }
     }
     this.img = new Imagen(this.img.GetArchivo());
     this.img.SetIdentificador("P3");
     this.img.SetNiveles(255);
     this.img.SetAlto(this.p2.Y - this.p1.Y);
     this.img.SetAncho(this.p2.X - this.p1.X);
     this.img.SetDatos(tmpImg);
     this.recortado = true;
     this.Close();
 }
Пример #30
0
    public HotelConImagenes actualizarImagenHome(Imagen imagenNueva)
    {
        HotelConImagenes  hotelConImagenes = new HotelConImagenes();
        RepositorioImagen repo             = new RepositorioImagen();

        try
        {
            var imagen = db.Imagen.Single((u => u.id_Imagen == imagenNueva.id_Imagen));
            imagen.imagen_Imagen = imagenNueva.imagen_Imagen;

            db.SaveChanges();


            var hoteles = db.Hotel.ToList();


            foreach (var hotel in hoteles)
            {
                var imagenesDescrip       = repo.obtenerImagenesDescripcion();
                var imagenesSobreNosotros = repo.obtenerImagenesSobreNosotros();

                hotelConImagenes.hotel = hotel;
                hotelConImagenes.imagenesDescripcion = imagenesDescrip;
                hotelConImagenes.galeria             = imagenesSobreNosotros;

                break;
            }
            return(hotelConImagenes);
        }
        catch (Exception ex)
        {
            return(hotelConImagenes);
        }
    }
        private void ListarRegistro()
        {
            Resultado     resultado = new Resultado();
            Imagen        img       = new Imagen();
            List <Imagen> lista     = new List <Imagen>();

            try
            {
                img.Tag       = "LISTADOESPECIFICO";
                img.Pertenece = "Pagina Principal";
                resultado     = new ImagenLogica().Acciones(img);
                if (resultado.TipoResultado == "OK")
                {
                    lista = new List <Imagen>();
                    lista = (List <Imagen>)resultado.ObjetoResultado;
                    galeria.DataSource = lista;
                    galeria.DataBind();

                    //imagenesList.DataSource = lista;
                    //imagenesList.DataBind();
                }
            }
            catch (Exception ex)
            {
                string script = "swal('Error', '" + ex + "', 'error'); ";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true);
            }
        }
Пример #32
0
    public static void Main()
    {
        // Medio medio1 = new Medio("Iván", 150, "jpg"); ESTO YA NO SE PUEDE CREAR
        Imagen imagen1 = new Imagen("Iván I", 150, "png", 1500, 600);
        Sonido sonido1 = new Sonido("Iván S", 150, "mp3", false, 192, 750);
        Video  video1  = new Video("Iván V", 150, "mp4", "H.264", 1600, 350, 650);

        Medio[] medios = new Medio[4];
        // medios[0] = new Medio("Iván", 150, "gif"); ESTO TAMPOCO SE PUEDE CREAR
        medios[1] = new Imagen("Iván I2", 150, "tif", 1500, 600);
        medios[2] = new Sonido("Iván S2", 150, "ogg", false, 192, 750);
        medios[3] = new Video("Iván V2", 150, "m4v", "H.264", 1600, 350, 650);

        Console.WriteLine(imagen1);
        // Console.WriteLine(medio1);
        Console.WriteLine(sonido1);
        Console.WriteLine(video1);
        Console.WriteLine();


        // OJO AQUI! ahora medios[0] no existe ya que no se podía crear un objeto
        // de esa clase al ser ACSTRACT... i = 1 y no i = 0
        for (int i = 1; i < 4; i++)
        {
            Console.WriteLine(medios[i].ToString());
        }
    }
Пример #33
0
 protected void btnCancelar_Click(object sender, EventArgs e)
 {
     limpiarCampos();
     txtNomApe.Focus();
     lblOutput.Text = "";
     Session[sessionVar_imageToSaveInDB] = new Imagen();
     grillaJugadores.SelectedIndex = -1;
     disableEditableElements(false);
 }
Пример #34
0
        public ImagenForm()
        {
            InitializeComponent();

            archivoButton.Focus();
            archivoOpenFileDialog.InitialDirectory = Environment.SpecialFolder.MyPictures.ToString();
            errorProvider.Icon = Resources.dialogError16x16;

            imagen = new Imagen();
            formValidator = new FormValidator(this);
            notEmptyRule = new NotEmptyValidationRule(string.Empty, "Es necesario seleccionar una imágen");
        }
Пример #35
0
 public void PrubaCrearCampaña()
 {
     Imagen imagen1 = new Imagen
     {
         Codigo = 1,
         Tiempo = 10,
         Image = ImagenServices.ImageToByteArray(Image.FromFile(@"F:/Lucho/Varios/Salida.jpg", true))
     };
     List<Imagen> listaImagenes = new List<Imagen>();
     listaImagenes.Add(imagen1);
     RangoHorario rangoHor1 = new RangoHorario
     {
         Codigo = 1,
         HoraFin = DateTime.Now.TimeOfDay,
         HoraInicio = DateTime.Now.AddMinutes(98).TimeOfDay
     };
     RangoFecha rangoFecha1 = new RangoFecha
     {
         Codigo = 1,
         FechaInicio = DateTime.Today,
         FechaFin = DateTime.Today.AddDays(10),
         RangosHorario = new List<RangoHorario>()
     };
     rangoFecha1.RangosHorario.Add(rangoHor1);
     List<RangoFecha> listaRangosFecha = new List<RangoFecha>();
     listaRangosFecha.Add(rangoFecha1);
     Campaña campaña = new Campaña
     {
         Codigo = 1,
         Imagenes = listaImagenes,
         Nombre = "Prueba",
         IntervaloTiempo = 80,
         RangosFecha = listaRangosFecha
     };
     FachadaCRUDCampaña fachada = new FachadaCRUDCampaña();
     fachada.Create(campaña);
 }
Пример #36
0
        async private void getGaleriaJson()
        {
            Uri ruta = new Uri("http://divinacocoa.com.mx/beta/api/gallery", UriKind.Absolute);
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ruta);
            WebResponse response = await request.GetResponseAsync();
            Stream stream = response.GetResponseStream();

            string contenido = Comun.LecturaDatos(stream);
            contenido = "{results: " + contenido + "}";

            var obj = JsonConvert.DeserializeObject<ImageObject>(contenido);

            List<Imagen> _lstImagen = new List<Imagen>();
            for (int i = 0; i < obj.Results.Count; i++)
            {
                Imagen img = new Imagen();
                img.url = obj.Results[i].url;
                img.url = imgHost + img.url;
                _lstImagen.Add(img);
            }

            gvGaleria.ItemsSource = _lstImagen;
            var a = true;
        }
Пример #37
0
 public Menu()
 {
     imagenDeFondo = new Imagen("Assets/GFX/presentacion.jpg");
 }
Пример #38
0
 /// Dibuja una imagen en pantalla oculta, en ciertas coordenadas
 public static void DibujarImagenOculta(Imagen imagen, short x, short y)
 {
     DibujarImagenOculta(imagen.GetPuntero(), x,  y);
 }
Пример #39
0
 /// Carga una secuencia de imagenes para un elemento animado
 public void CargarSecuencia(byte direcc, string[] nombres)
 {
     contieneImagen = true;
       contieneSecuencia = true;
       tamanyoSecuencia = (byte) nombres.Length;
       secuencia[direcc] = new Imagen[tamanyoSecuencia];
       for (byte i=0; i< tamanyoSecuencia; i++) {
     secuencia[direcc][i] = new Imagen(nombres[i]);
     }
       // Valores por defecto para ancho y alto
       ancho = 32;
       alto = 32;
 }
Пример #40
0
 /// Carga la imagen que representara a este elemento grafico
 public void CargarImagen(string nombre)
 {
     miImagen = new Imagen();
       miImagen.Cargar(nombre);
       contieneImagen = true;
       contieneSecuencia = false;
 }
Пример #41
0
 /// <summary>
 ///     Inserta una imagen en el repositorio.
 /// </summary>
 /// <param name="pImg">Imagen a insertar.</param>
 public void Insertar(Imagen pImg)
 {
     iUnidadDeTrabajo.RepositorioImagen.Insertar(pImg);
     iUnidadDeTrabajo.Guardar();
 }
Пример #42
0
 /// <summary>
 ///     Modificar una Imagen en el repositorio.
 /// </summary>
 /// <param name="pImg">Imagen a modificar.</param>
 public void Modificar(Imagen pImg)
 {
     iUnidadDeTrabajo.RepositorioImagen.Modificar(pImg);
     iUnidadDeTrabajo.Guardar();
 }
Пример #43
0
 /// <summary>
 ///     Elimina una Imagen del repositorio.
 /// </summary>
 /// <param name="pImg">Imagen a eliminar.</param>
 public void Eliminar(Imagen pImg)
 {
     Imagen mImagen = iUnidadDeTrabajo.RepositorioImagen.ObtenerPorId(pImg.ImagenId);
     iUnidadDeTrabajo.RepositorioImagen.Eliminar(mImagen);
     iUnidadDeTrabajo.Guardar();
 }
        public Mensaje editConferencista([FromBody]UtilsJson.APersona conferencista)
        {
            Mensaje mensaje = null;

            try
            {
                if (conferencista != null)
                {
                    if (!string.IsNullOrWhiteSpace(conferencista.token))
                    {
                        if (AutenticacionToken.validateToken(conferencista.token) == 1)
                        {
                            long id_institucion_c = (!string.IsNullOrWhiteSpace(conferencista.Ainstitucion)) ? long.Parse(conferencista.Ainstitucion) : 0;
                            Institucion institucion = _repositorio.Get<Institucion>(id_institucion_c);
                            Conferencista conferencistaDB = _repositorio.Get<Conferencista>(conferencista.id);
                            if (institucion != null && conferencistaDB != null)
                            {
                                if (AutenticacionToken.validateUserToken(conferencista.token, institucion.logueo.correo_electronico))
                                {
                                    //datos personales
                                    string tipo_identificacion = validarTipoIdentificacion(conferencista.tipo_identificacion);
                                    string identificacion = conferencista.identificacion;
                                    string nombre_persona = conferencista.nombre;
                                    string apellido_persona = conferencista.apellido;
                                    string correo_persona = conferencista.correo_electronico;
                                    string urlCvlac = conferencista.urlCvlac;
                                    string perfil = conferencista.perfil_profesional;
                                    string foto = conferencista.foto;

                                    if (tipo_identificacion != null)
                                    {
                                        Imagen newImagen = null;
                                        if (!string.IsNullOrWhiteSpace(foto))
                                        {
                                            if (conferencistaDB.persona.foto != null)
                                            {
                                                conferencistaDB.persona.foto.imagenBase64 = foto;
                                            }
                                            else
                                            {
                                                newImagen = new Imagen { imagenBase64 = foto };
                                                conferencistaDB.persona.foto = newImagen;
                                            }
                                        }
                                        conferencistaDB.persona.tipo_identificacion = tipo_identificacion;
                                        conferencistaDB.persona.identificacion = identificacion;
                                        conferencistaDB.persona.nombre = nombre_persona;
                                        conferencistaDB.persona.apellido = apellido_persona;
                                        conferencistaDB.persona.correo_electronico = correo_persona;
                                        conferencistaDB.persona.urlCvlac = urlCvlac;
                                        conferencistaDB.persona.perfil_profesional = perfil;
                                        conferencistaDB.fecha_ult_modificacion = DateTime.Now;
                                        //Almaceno o actualizo la salaMesa
                                        _repositorio.SaveOrUpdate<Conferencista>(conferencistaDB);

                                        mensaje = new Mensaje(EnumTipoMensaje.Notificacion, "Notificación", "Conferencista editado exitosamente.");
                                    }
                                    else
                                    {
                                        mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "El tipo de identificacion no existe. verifique que el valor sea valido");
                                    }
                                }
                                else
                                {
                                    mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes");
                                }
                            }
                            else
                            {
                                mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No se encontro la sala solicitada o esta asociada a otra institucion.");
                            }
                        }
                        else
                        {
                            mensaje = new Mensaje(EnumTipoMensaje.Expiracion, "Error", "La sesion actual ha expirado. Inicie sesion");
                        }
                    }
                    else
                    {
                        mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes");
                    }
                }
                else
                {
                    mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No se puede insertar un objeto nulo");
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                var sb = new System.Text.StringBuilder();
                foreach (var failure in ex.EntityValidationErrors)
                {
                    sb.AppendFormat("{0} failed validation", failure.Entry.Entity.GetType());
                    foreach (var error in failure.ValidationErrors)
                    {
                        sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage);
                        sb.AppendLine();
                    }
                }
                mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", sb.ToString());
                SystemLog log = new SystemLog();
                log.ErrorLog(sb.ToString());
                throw new Exception(sb.ToString());
            }
            return mensaje;

        }
        private void eliminarImagenesDelServer(Imagen imagen)
        {
            List<Imagen> imagenes = new List<Imagen>();
            imagenes.Add(imagen);

            eliminarImagenesDelServer(imagenes);
        }
Пример #46
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                Jugador jugador = new Jugador();
                try
                {
                    jugador.NombreApellido = txtNomApe.Text;
                    jugador.Posicion = txtPosicion.Text;
                    imageToSaveInDB = (Imagen)Session[sessionVar_imageToSaveInDB];
                    jugador.Foto = imageToSaveInDB;

                    if (txtId.Text.CompareTo("") != 0)
                    {
                        //Modifico un jugador existente
                        jugador.IdJugador = Convert.ToInt32(txtId.Text);
                        GestorPlantel.updateJugador_plantelActual(jugador);
                        setSuccessColorOutput(true);
                        lblOutput.Text = "Jugador actualizado con éxito!";
                    }
                    else
                    {
                        //Guardo el nuevo jugador
                        GestorPlantel.registrarJugador_plantelActual(jugador);
                        setSuccessColorOutput(true);
                        lblOutput.Text = "Jugador registrado con éxito!";
                    }
                    /* No limpio los paths de las imagenes en el limpiarCampos() porque el limpiarCampos()
                     * se ejecuta en el load y la variable session no se tiene que limpiar ahi.*/
                    Session[sessionVar_imageToSaveInDB] = new Imagen();
                    cargarJugadores();
                    limpiarCampos();
                    grillaJugadores.SelectedIndex = -1;
                }
                catch (PathImgEmptyException imgEx)
                {
                    setSuccessColorOutput(false);
                    lblOutput.Text = imgEx.Message;
                }
                catch (SportingException spEx)
                {
                    setSuccessColorOutput(false);
                    lblOutput.Text = spEx.Message;
                }
                catch (Exception ex)
                {
                    setSuccessColorOutput(false);
                    lblOutput.Text = ex.Message;
                }
            }
            else
            {
                lblOutput.Text = "Error al registrar el jugador.";
            }
        }
Пример #47
0
        protected void GrillaJugadores_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                //obtengo el id del jugador a ser Modificado o Eliminado
                int id = Convert.ToInt32(e.CommandArgument.ToString());
                if (e.CommandName == "Eliminar")
                {
                    //Obtengo la foto del jugador antes de borrarlo de la BD
                    Imagen fotoJugador = GestorPlantel.getJugador_plantelActual(id).Foto;
                    GestorPlantel.deleteJugador_plantelActual(id);
                    //luego que borre el accesorio de la BD tengo que borrar las imagenes que estan en el server
                    eliminarImagenesDelServer(fotoJugador);

                    setSuccessColorOutput(true);
                    lblOutput.Text = "El jugador fue eliminado con exito";

                    cargarJugadores();
                    limpiarCampos();
                    Session[sessionVar_imageToSaveInDB] = new Imagen();
                    grillaJugadores.SelectedIndex = -1;
                    /* habilito todos los elementos editables */
                    disableEditableElements(false);
                    txtNomApe.Focus();
                }
                if (e.CommandName == "Editar")
                {
                    limpiarCampos();
                    lblOutput.Text = "";
                    //traigo los datos del jugador de la bd
                    Jugador jugador = GestorPlantel.getJugador_plantelActual(id);
                    //cargo los datos del jugador
                    txtId.Text = jugador.IdJugador.ToString();
                    txtNomApe.Text = jugador.NombreApellido;
                    txtPosicion.Text = jugador.Posicion;

                    //pongo la foto del jugador en la variable session
                    Imagen fotoJugador = jugador.Foto;

                    if (fotoJugador != null)
                    {
                        Session[sessionVar_imageToSaveInDB] = fotoJugador;
                    }
                    else
                    {
                        lblOutput.Text = "Error al intentar obtener la foto del jugador";
                        return;
                    }
                    //cargo la foto del jugador
                    imgJugador.ImageUrl = fotoJugador.PathSmall;
                }
            }
            catch (SportingException spEx)
            {
                setSuccessColorOutput(false);
                lblOutput.Text = spEx.Message;
            }
            catch (Exception ex)
            {
                setSuccessColorOutput(false);
                lblOutput.Text = ex.Message;
            }
        }
Пример #48
0
 private void eliminarImagenesDelServer(Imagen imagen)
 {
     try
     {
         if (imagen.PathBig.Equals("") == false && imagen.PathBig.Length > 0)
         {
             System.IO.File.Delete(Server.MapPath(imagen.PathBig));
         }
         if (imagen.PathMedium.Equals("") == false && imagen.PathMedium.Length > 0)
         {
             System.IO.File.Delete(Server.MapPath(imagen.PathMedium));
         }
         if (imagen.PathSmall.Equals("") == false && imagen.PathSmall.Length > 0)
         {
             System.IO.File.Delete(Server.MapPath(imagen.PathSmall));
         }
     }
     catch (Exception e)
     {
         setSuccessColorOutput(false);
         lblOutput.Text = "Error al borrar las imagenes del jugador en el servidor. " + e.Message;
     }
 }
Пример #49
0
        protected void btnCargarImagen_Click(object sender, EventArgs e)
        {
            // Initialize variables
            string sSavePath;
            string sThumbExtension;
            int intThumbWidth;
            int intThumbHeight;

            // Set constant values
            sSavePath = "images/plantel/actual/";
            sThumbExtension = "_thumb";
            intThumbWidth = 120;
            intThumbHeight = 100;

            // If file field is not empty
            if (fileUpload.PostedFile != null)
            {
                try
                {
                    // Check file size (must not be 0)
                    HttpPostedFile myFile = fileUpload.PostedFile;
                    int nFileLen = myFile.ContentLength;
                    if (nFileLen == 0)
                    {
                        setSuccessColorOutput(false);
                        lblOutput.Text = "Ninguna imagen fue cargada.";
                        imgJugador.ImageUrl = null;
                        return;
                    }

                    // Check file extension (must be JPG)
                    if (System.IO.Path.GetExtension(myFile.FileName).ToLower() != ".jpg")
                    {
                        setSuccessColorOutput(false);
                        lblOutput.Text = "Error: La imagen debe tener una extension JPG.";
                        imgJugador.ImageUrl = null;
                        return;
                    }

                    // Read file into a data stream
                    byte[] myData = new Byte[nFileLen];
                    myFile.InputStream.Read(myData, 0, nFileLen);

                    // Make sure a duplicate file does not exist.  If it does, keep on appending an
                    // incremental numeric until it is unique
                    string sFilename = System.IO.Path.GetFileName(myFile.FileName);
                    int file_append = 0;
                    while (System.IO.File.Exists(Server.MapPath(sSavePath + sFilename)))
                    {
                        file_append++;
                        sFilename = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName)
                                         + file_append.ToString() + ".jpg";
                    }

                    sSavePath = "../" + sSavePath;

                    System.IO.FileStream newFile = null;
                    try
                    {
                        // Changing the image size before saving image to disk
                        using (System.Drawing.Image image = System.Drawing.Image.FromStream(myFile.InputStream))
                        {
                            lblOutput.Text = lblOutput.Text + "Inside using Image. ";
                            // can given width of image as we want
                            double scaleFactor = 0.5;
                            int newWidth = (int)(image.Width * scaleFactor);
                            // can given height of image as we want
                            int newHeight = (int)(image.Height * scaleFactor);
                            using (Bitmap thumbnailImg = new Bitmap(newWidth, newHeight))
                            {
                                lblOutput.Text = lblOutput.Text + "Inside using Bitmap. ";
                                using (Graphics thumbGraph = Graphics.FromImage(thumbnailImg))
                                {
                                    lblOutput.Text = lblOutput.Text + "Inside using Graphics. ";
                                    thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
                                    thumbGraph.SmoothingMode = SmoothingMode.HighQuality;
                                    thumbGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
                                    Rectangle imageRectangle = new Rectangle(0, 0, newWidth, newHeight);
                                    lblOutput.Text = lblOutput.Text + "Before DrawImage. ";
                                    thumbGraph.DrawImage(image, imageRectangle);
                                }
                                // Save the image to disk
                                lblOutput.Text = lblOutput.Text + "Before Save.3 ";
                                thumbnailImg.Save(Server.MapPath(sSavePath + sFilename), System.Drawing.Imaging.ImageFormat.Jpeg);
                            }
                        }
                    }
                    catch (Exception exe)
                    {
                        setSuccessColorOutput(false);
                        lblOutput.Text = lblOutput.Text + "\nPath: " + sSavePath + sFilename + "\n Error del sistema: " + exe.Message;
                        return;
                    }

                    // Check whether the file is really a JPEG by opening it
                    System.Drawing.Image.GetThumbnailImageAbort myCallBack =
                                   new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
                    Bitmap myBitmap;
                    try
                    {
                        myBitmap = new Bitmap(Server.MapPath(sSavePath + sFilename));

                        // If jpg file is a jpeg, create a thumbnail filename that is unique.
                        file_append = 0;
                        string sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName)
                                                                 + sThumbExtension + ".jpg";
                        while (System.IO.File.Exists(Server.MapPath(sSavePath + sThumbFile)))
                        {
                            file_append++;
                            sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) +
                                           file_append.ToString() + sThumbExtension + ".jpg";
                        }

                        // Save thumbnail and output it onto the webpage
                        System.Drawing.Image myThumbnail
                                = myBitmap.GetThumbnailImage(intThumbWidth,
                                                             intThumbHeight, myCallBack, IntPtr.Zero);
                        myThumbnail.Save(Server.MapPath(sSavePath + sThumbFile));
                        imgJugador.ImageUrl = sSavePath + sThumbFile;

                        //Agrego los path de la imagen para registrarlos en la BD
                        imageToSaveInDB = new Imagen();
                        if (Session[sessionVar_imageToSaveInDB] != null)
                        {
                            imageToSaveInDB = (Imagen)Session[sessionVar_imageToSaveInDB];
                        }
                        imageToSaveInDB.PathBig = sSavePath + sFilename;
                        imageToSaveInDB.PathSmall = sSavePath + sThumbFile;
                        Session[sessionVar_imageToSaveInDB] = imageToSaveInDB;

                        // Displaying success information
                        setSuccessColorOutput(true);
                        lblOutput.Text = "Imagen cargada con éxito!";

                        // Destroy objects
                        myThumbnail.Dispose();
                        myBitmap.Dispose();
                    }
                    catch (ArgumentException errArgument)
                    {
                        // The file wasn't a valid jpg file
                        setSuccessColorOutput(false);
                        lblOutput.Text = lblOutput.Text + "\nEl archivo no es una imagen valida. Detalle: " + errArgument.Message;
                        System.IO.File.Delete(Server.MapPath(sSavePath + sFilename));
                    }
                }
                catch (Exception ex)
                {
                    setSuccessColorOutput(false);
                    lblOutput.Text = "Error del sistema: " + ex.Message;
                }
            }
        }