示例#1
0
        public int GuardarModificarImagen(Imagenes imagen)
        {
            dbConnection.Update(imagen);
            int pk = imagen.IdImagen.Value;

            return(pk);
        }
示例#2
0
        public int GuardarImagen(Imagenes imagen)
        {
            dbConnection.Insert(imagen);
            int pk = dbConnection.ExecuteScalar <int>("select last_insert_rowid()");

            return(pk);
        }
示例#3
0
        public bool AgregarImagen(string nombreArchivo, string NombreAlbum, string ruta, string nivel, string tipo)
        {
            using (var context = new ccjtvEntities())
            {
                bool guardoImagen;

                try
                {
                    Imagenes imagenNueva = new Imagenes();
                    imagenNueva.NombreArchivo = nombreArchivo;
                    imagenNueva.NombreAlbum   = NombreAlbum;
                    imagenNueva.Ruta          = ruta;
                    imagenNueva.Nivel         = nivel;
                    imagenNueva.Tipo          = tipo;

                    context.Imagenes.Add(imagenNueva);
                    guardoImagen = true;

                    context.SaveChanges();
                }
                catch (Exception)
                {
                    guardoImagen = false;
                }

                return(guardoImagen);
            }
        }
示例#4
0
        private void TraerInformacionDelRegisto()
        {
            try {
                EmpresaEN oRegistroEN = new EmpresaEN();
                EmpresaLN oRegistroLN = new EmpresaLN();

                oRegistroEN.IdEmpresa = IdEmpresa;

                if (oRegistroLN.ListadoPorIdentificador(oRegistroEN, Program.oDatosDeConexion))
                {
                    DataRow Fila = oRegistroLN.TraerDatos().Rows[0];

                    txtNombre.Text      = Fila["Nombre"].ToString();
                    txtDireccion.Text   = Fila["Direccion"].ToString();
                    txtTelefonos.Text   = Fila["Telefonos"].ToString();
                    txtNRUC.Text        = Fila["NRuc"].ToString();
                    txtCelular.Text     = Fila["Celular"].ToString();
                    txtEmail.Text       = Fila["Email"].ToString();
                    txtSitioWeb.Text    = Fila["SitioWeb"].ToString();
                    txtDescripcion.Text = Fila["Descripcion"].ToString();

                    if (Fila["Logo"] != DBNull.Value)
                    {
                        pbxImagen.Image = Imagenes.ProcesarImagenToBitMap((object)(Fila["Logo"]));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Error: {0} ", ex.Message), "Traer información del Registro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        public void BuscarTest()
        {
            RepositorioBase <Imagenes> repositorio = new RepositorioBase <Imagenes>();
            Imagenes i = repositorio.Buscar(1);

            Assert.IsNotNull(i);
        }
        private void EjecutarComando()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Imagenes.Clear();
                var elementos = this.ObtenerImagenes();
                foreach (var elemento in elementos)
                {
                    Imagenes.Add(elemento);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                IsBusy = false;
            }
        }
示例#7
0
        public bool Delete(Imagenes item, Session session = null)
        {
            //LoggerFactory.CreateLog().Start();
            var committed = 0;

            try
            {
                //if (session != null)
                //    _repositoryImagenes.UnitOfWork.SetConnectionDb(session.ConnectionString);

                if (item == null)
                {
                    throw new ArgumentNullException("item");
                }

                // Domain Services?
                //_repositoryImagenes.Delete(Mapper.Map<Dominio.Entidades.Imagenes>(item));
                _repositoryImagenes.Delete(item);
                committed = _unitOfWorkAsync.SaveChanges();
            }
            catch (Exception ex)
            {
                //LoggerFactory.CreateLog().Error(ex);
            }

            //LoggerFactory.CreateLog().Stop();
            return(committed > 0);
        }
示例#8
0
        public async Task <IActionResult> PutImagenes(int id, Imagenes imagenes)
        {
            if (id != imagenes.idimagen)
            {
                return(BadRequest());
            }

            _context.Entry(imagenes).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ImagenesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#9
0
        private void ButtomAgregar_Click(object sender, RoutedEventArgs e)
        {
            string           Mensaje = "¿ Esta seguro de querer agregar esta imagen ?";
            MessageBoxResult result  = MessageBox.Show(Mensaje, "Confirmar", MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                ListadeImagenes.ItemsSource = null;

                Imagenes objImagen = new Imagenes();

                objImagen.titulo      = TextBoxTitulo.Text;
                objImagen.descripcion = TextBoxDescripcion.Text;

                ListaImagenes.Add(objImagen);


                ListadeImagenes.ItemsSource = ListaImagenes;

                Uri         uriImage = new Uri("../img/carpeta_de_imagenes.jpg", UriKind.Relative);
                BitmapImage objBI    = new BitmapImage(uriImage);
                ImageCargar.Source      = objBI;
                TextBoxTitulo.Text      = "";
                TextBoxDescripcion.Text = "";
            }
        }
示例#10
0
        public ActionResult CreateVideo([Bind(Include = "nombre")] Imagenes imagenes, HttpPostedFileBase file)
        {
            SqlConnection connect = new SqlConnection("Data Source = ecRhin.ec.tec.ac.cr\\Estudiantes; Initial Catalog = Football; Persist Security Info = True; User ID = angramirez; Password = angramirez");
            SqlCommand    cmd     = new SqlCommand();

            cmd.Connection  = connect;
            cmd.CommandText = "insert into Fifa.Imagenes (nombre,image_byte) values (@nombre, @image_byte)";
            cmd.Parameters.AddWithValue("nombre", imagenes.nombre);
            cmd.Parameters.AddWithValue("image_byte", SqlDbType.VarBinary).Value = System.IO.File.ReadAllBytes("C:\\Users\\Giulliano\\Desktop\\" + file.FileName);
            connect.Open();
            cmd.ExecuteNonQuery();
            connect.Close();
            return(RedirectToAction("Index"));

            Image          convert         = Image.FromFile("C:\\Users\\Giulliano\\Desktop\\" + file.FileName, true);
            ImageConverter _imageConverter = new ImageConverter();

            byte[] xByte = (byte[])_imageConverter.ConvertTo(convert, typeof(byte[]));
            if (ModelState.IsValid)
            {
                imagenes.image_byte = xByte;
                db.Imagenes.Add(imagenes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(imagenes));
        }
示例#11
0
        public async Task <IActionResult> Crear([FromBody] ImagenViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Imagenes imagen = new Imagenes
            {
                nombre = model.nombre,
                imagen = model.imagen
            };

            _context.Imagenes.Add(imagen);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }

            return(Ok());
        }
示例#12
0
        private void btn_aceptar_Click(object sender, EventArgs e)
        {
            try
            {
                List <Productos> lista_productos = new List <Productos>();
                lista_productos.AddRange(buissnes.SearchProductos(0, "%%"));
                int id = 0;
                foreach (var item in lista_productos)
                {
                    if (item.Nombre == cmb_producto.Text)
                    {
                        id = item.Id;
                    }
                }
                Imagenes imagen = new Imagenes
                {
                    IdProduct  = id,
                    Decription = txt_desc.Text,
                    Image      = GetBytesFromImage(txt_image.Text),
                    DateUpdate = DateTime.Now,
                    IsEnabled  = true
                };

                buissnes.InsertImages(imagen);
                MessageBox.Show("Imagen Agregada");
            }
            catch { MessageBox.Show("Error al agregar imagen"); }

            this.Close();
        }
示例#13
0
        private EmpresaEN InformacionDelRegistro()
        {
            EmpresaEN oRegistroEN = null;

            try
            {
                oRegistroEN             = new EmpresaEN();
                oRegistroEN.IdEmpresa   = IdEmpresa;
                oRegistroEN.Nombre      = txtNombre.Text.Trim();
                oRegistroEN.Descripcion = txtDescripcion.Text.Trim();
                oRegistroEN.Direccion   = txtDireccion.Text.Trim();
                oRegistroEN.Telefonos   = txtTelefonos.Text.Trim();
                oRegistroEN.Celular     = txtCelular.Text.Trim();
                oRegistroEN.Email       = txtEmail.Text.Trim();
                oRegistroEN.SitioWeb    = txtSitioWeb.Text.Trim();
                oRegistroEN.NRuc        = txtNRUC.Text.Trim();

                oRegistroEN.oLoginEN = Program.oLoginEN;
                oRegistroEN.ALogo    = Imagenes.ProcesarImagenToByte((Bitmap)(pbxImagen.Image));

                return(oRegistroEN);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message, "Información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(oRegistroEN);
            }
        }
        public async Task <ActionResult <Imagenes> > PostImagenes(Imagenes imagenes)
        {
            _context.Imagenes.Add(imagenes);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetImagenes", new { id = imagenes.IdImagen }, imagenes));
        }
示例#15
0
        public IHttpActionResult PutImagenes(int id, Imagenes imagenes)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != imagenes.IDimagenes)
            {
                return(BadRequest());
            }

            db.Entry(imagenes).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ImagenesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#16
0
        private static async Task GetStartedDemo(int numeroArchivo)
        {
            // Create a new instance of the DocumentClient.

            //Get, or Create, the Database

            string fileName      = "C:\\Users\\cic\\Downloads\\2_Depth\\2_Depth\\" + (numeroArchivo).ToString() + ".txt";
            string fileNameIndex = "C:\\Users\\cic\\Downloads\\2_Depth\\2_Depth\\" + (numeroArchivo).ToString() + "-index.txt";

            System.IO.StreamReader objReader;
            objReader = new System.IO.StreamReader(fileName);
            string datos1 = objReader.ReadToEnd();

            objReader.Close();
            System.IO.StreamReader objReader2;
            objReader2 = new System.IO.StreamReader(fileNameIndex);
            string datos2 = objReader2.ReadToEnd();

            objReader2.Close();
            Database database = await GetOrCreateDatabaseAsync("LandingData");

            Imagenes actual = new Imagenes
            {
                DataMatrix = datos1,
                imageDump  = datos2
            };
            //Get, or Create, the Document Collection
            DocumentCollection collection = await GetOrCreateCollectionAsync(database.SelfLink, "LandingDoc");

            await client.CreateDocumentAsync(collection.DocumentsLink, actual);
        }
 public ActionResult Guardar(Models.ImagenModelo modelo, HttpPostedFileBase foto)
 {
     if (!ModelState.IsValid || (foto == null && modelo.IdImagen == 0))
     {
         byte[] fotoDB = null;
         if (foto != null)
         {
             BinaryReader lector = new BinaryReader(foto.InputStream);
             fotoDB = lector.ReadBytes((int)foto.ContentLength);
         }
         //conexion
         using (var bd = new EF.PaisesEntities())
         {
             Imagenes imagenes = new Imagenes();
             imagenes.IdImagen   = modelo.IdImagen;
             imagenes.NombreFoto = modelo.NombreFoto;
             imagenes.FOTO       = fotoDB;
             bd.Imagenes.Add(imagenes);
             int res = bd.SaveChanges();
             if (res == 1)
             {
                 ViewBag.Message = "La imagen se subio correctamente";
             }
             else
             {
                 ViewBag.Message = "La imagen no se subio correctamente :(";
             }
         }
     }
     return(PartialView("validacion"));
 }
示例#18
0
 /// <summary>
 /// Guarda el contenido de una seccion
 /// </summary>
 /// <param name="principalDto"></param>
 /// <returns></returns>
 public ApiCallResult GuardarContenido(PrincipalDto principalDto)
 {
     try
     {
         this.GuardarImagenContenido(principalDto);
         Imagenes  imagen    = this.blogRepository.BuscarImagenPorRuta(principalDto.RutaImagen);
         Principal principal = new Principal()
         {
             Idimagen    = imagen.Idimagen,
             Descripcion = principalDto.Descripcion,
             Estado      = true
         };
         this.principalRepository.GuardarSeccionPrincipal(principal);
         string id = this.principalRepository.BuscarContenidoPrincipal(principal.Descripcion).Idprincipal.ToString();
         return(new ApiCallResult
         {
             Estado = true,
             Mensaje = id
         });
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#19
0
        public ActionResult DeleteConfirmed(string id)
        {
            Imagenes imagenes = db.Imagenes.Find(id);

            db.Imagenes.Remove(imagenes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#20
0
        private void configurarImagenesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var config = new Imagenes();

            config.ShowDialog();

            imageServicio.CargarImagenes();
        }
示例#21
0
        private void FrmArticuloProfile_Load(object sender, EventArgs e)
        {
            if (this.Articulo != null)
            {
                if (this.IsVenta)
                {
                    this.btnAddCarrito.Visible = true;
                }

                this.Id_articulo         = this.Articulo.Id_articulo;
                this.txtNombre.Text      = this.Articulo.Nombre_articulo;
                this.txtTipo.Text        = this.Articulo.Tipo_articulo;
                this.txtProveedor.Text   = this.Articulo.Nombre_proveedor;
                this.lblCantidad.Text    = "Cantidad: " + this.Articulo.Cantidad;
                this.txtPrecio.Text      = this.Articulo.Precio.ToString();
                this.txtDescripcion.Text = this.Articulo.Descripcion_articulo;

                if (this.Articulo.DtImagenes != null)
                {
                    string rutaDestino;
                    int    cantidad_images = this.Articulo.DtImagenes.Rows.Count;
                    if (cantidad_images == 1)
                    {
                        this.px1.Image = Imagenes.ObtenerImagen("RutaImagenesArticulos",
                                                                Convert.ToString(this.Articulo.DtImagenes.Rows[0]["Imagen"]), out rutaDestino);
                        this.px1.BringToFront();
                    }
                    else
                    {
                        bool primer_imagen = true;
                        foreach (DataRow row in this.Articulo.DtImagenes.Rows)
                        {
                            if (primer_imagen)
                            {
                                this.px1.Image = Imagenes.ObtenerImagen("RutaImagenesArticulos",
                                                                        Convert.ToString(row["Imagen"]), out rutaDestino);
                                this.panelImagenes.Tag = this.px1;
                                primer_imagen          = false;
                            }
                            else
                            {
                                PictureBox pxAnterior = (PictureBox)this.panelImagenes.Tag;
                                PictureBox px         = new PictureBox();
                                px.SizeMode = PictureBoxSizeMode.StretchImage;
                                px.Location = new System.Drawing.Point(pxAnterior.Location.X,
                                                                       pxAnterior.Location.Y + pxAnterior.Height);
                                this.panelImagenes.Controls.Add(px);
                                this.panelImagenes.Tag = px;
                            }
                        }
                    }
                }
                else
                {
                    this.px1.Image = Resources.SIN_IMAGEN1;
                }
            }
        }
示例#22
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Imagenes imagenes = await db.Imagenes.FindAsync(id);

            db.Imagenes.Remove(imagenes);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#23
0
        private void BindControles()
        {
            int id = Utilerias.StrToInt(_IDLogo.Value);

            Imagenes obj = uow.ImagenesBusinessLogic.GetByID(id);

            txtArchivoAdjunto.Value = obj.Nombre;
            txtDescripcion.Value    = obj.Descripcion != null ? obj.Descripcion : string.Empty;
        }
示例#24
0
        public MainViewModel()
        {
            fb = "#FFD10C0C";

            var url = @"C:\Users\Marti\Pictures\35140f718f9adc99514e055ab7d325e4.jpg";

            logo     = Imagenes.FileTo_Bytes(url);
            cabecera = "Punto de Venta";
        }
示例#25
0
 public static void InsertImages(Imagenes imag)
 {
     model.ACOB_InsertImages(
         imag.IdProduct,
         imag.Decription,
         imag.Image,
         imag.DateUpdate,
         imag.IsEnabled
         );
 }
示例#26
0
 public ActionResult Edit([Bind(Include = "nombre,image_byte")] Imagenes imagenes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(imagenes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(imagenes));
 }
示例#27
0
        public void ModificarTest()
        {
            Repositorio <Imagenes> repositorio = new Repositorio <Imagenes>();
            bool     paso = false;
            Imagenes i    = repositorio.Buscar(1);

            i.RutaImagen = "sd";
            paso         = repositorio.Modificar(i);
            Assert.AreEqual(true, paso);
        }
        public void ModificarTest()
        {
            RepositorioBase <Imagenes> repositorio = new RepositorioBase <Imagenes>();
            bool     paso     = false;
            Imagenes imagenes = repositorio.Buscar(1);

            imagenes.RutaImagen = "Second";
            paso = repositorio.Modificar(imagenes);
            Assert.AreEqual(true, paso);
        }
示例#29
0
        private async void ObtenerImagenesEjecutar()
        {
            var mensajeSalida = await _servicio.ObtenerImagenes();

            Imagenes.Clear();
            foreach (var item in mensajeSalida)
            {
                Imagenes.Add(item);
            }
        }
示例#30
0
        public void AsignarImagen(string nombre_imagen, string appKey)
        {
            string rutaOr;
            Image  Imagen = Imagenes.ObtenerImagen(appKey, nombre_imagen, out rutaOr);

            this.pxImagen.Image    = Imagen;
            this.pxImagen.SizeMode = PictureBoxSizeMode.StretchImage;
            this.txtImagen.Text    = nombre_imagen;
            this.txtImagen.Tag     = rutaOr;
            this.Ruta_origen       = rutaOr;
        }
示例#31
0
 public void Show(string Titulo, string Texto, Imagenes Img)
 {
     switch (Img)
     {
         case Imagenes.Informacion:
             Show(null, Titulo, Texto, global::AlertMsg.Properties.Resources.SymbolInformation);
             break;
         case Imagenes.Advertencia:
             Show(null, Titulo, Texto, global::AlertMsg.Properties.Resources.SymbolExclamation);
             break;
         case Imagenes.Error:
             Show(null, Titulo, Texto, global::AlertMsg.Properties.Resources.SymbolError);
             break;
         case Imagenes.Notificacion:
             Show(null, Titulo, Texto, global::AlertMsg.Properties.Resources.SymbolCheck);
             break;
     }
 }
            private void UploadFiles(HttpFileCollectionBase files, int userId, int assignToUser)
            {
                //System.Threading.Thread.Sleep(5000);
                Usuarios user = this.db.Usuarios.Find(userId);
                Usuarios userAssign = this.db.Usuarios.Find(assignToUser);

                string uploadContainerName = ConfigurationManager.AppSettings["WindowsAzureStorage.UploadContainerName"];
                for (int i = 0; i < files.Count; i++)
                {
                    HttpPostedFileBase file = Request.Files[i];
                    string fileName = String.Format("{0}/{1}", userAssign.USUID, Path.GetFileName(file.FileName).Replace(Path.GetExtension(file.FileName), Path.GetExtension(file.FileName).ToLower()));

                    if (!StorageAPI.Instance.ExistBlob(uploadContainerName, fileName))
                    {
                        byte[] b = new byte[file.ContentLength];
                        file.InputStream.Read(b, 0, b.Length);

                        Guid IMACodigo = Guid.NewGuid();
                        using (MemoryStream ms = new MemoryStream(b))
                        {
                            List<StorageAPI.StorageMetadata> metadata = new List<StorageAPI.StorageMetadata>()
                        {
                            new StorageAPI.StorageMetadata() { Key = "ID", Value = IMACodigo.ToString().ToUpper() },
                            new StorageAPI.StorageMetadata() { Key = "Extension", Value = Path.GetExtension(file.FileName).ToLower().Replace(".", "") },
                            new StorageAPI.StorageMetadata() { Key = "UploadBy", Value = String.Format("[{0}] {1} {2}", user.USUID, user.USUApellidos, user.USUNombres) },
                            new StorageAPI.StorageMetadata() { Key = "AssingTo", Value = String.Format("[{0}] {1} {2}", userAssign.USUID, userAssign.USUApellidos, userAssign.USUNombres) }
                        };

                            CloudBlockBlob blob = StorageAPI.Instance.CreateBlob(uploadContainerName, fileName, ms, metadata);
                            if (blob != null)
                            {
                                Imagenes imagenes = new Imagenes()
                                {
                                    IMACodigo = IMACodigo,
                                    IMANombre = Path.GetFileName(file.FileName).Replace(Path.GetExtension(file.FileName), String.Empty),
                                    IMATipo = Path.GetExtension(file.FileName).ToLower().Replace(".", String.Empty),
                                    IMAUsuarioResponsable = userAssign.USUID,
                                    IMAUsuarioCreacion = user.USUID,
                                    IMAFechaCreacion = DateTime.Now
                                };

                                this.db.Imagenes.Add(imagenes);
                                this.db.SaveChanges();
                            }
                        }
                    }
                }
            }