public static void Create(Foto foto) { SqlConnection cn = new SqlConnection(Conexao.SQL); SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandText = "INSERT INTO FOTOS(TITULO, DESCRICAO, FOTO) VALUES (@TITULO, @DESCRICAO, @FOTO)"; cmd.Parameters.AddWithValue("@TITULO", foto.Titulo); cmd.Parameters.AddWithValue("@DESCRICAO", foto.Descricao); cmd.Parameters.AddWithValue("@FOTO", foto.FotoDados); try { cn.Open(); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception("Erro: " + ex.Message); } finally { cn.Close(); } }
public Foto ConverteImagem(IImagem imagemAPI) { Foto imagemAplicacao = new Foto(); imagemAplicacao.Dimensao = new double[] { imagemAPI.Largura, imagemAPI.Altura }; return imagemAplicacao; }
private Dictionary<int, byte[]> pegaUltimoIdFoto(DataTable dt) { Dictionary<int, byte[]> ultimoFoto = new Dictionary<int, byte[]>(); foreach (DataRow dr in dt.Rows) { Foto oFotoModel = new Foto(); ultimoFoto.Add(Convert.ToInt32(dr["MAX_ID_FOTO"]),(byte[])dr["FOTO"]); } return ultimoFoto; }
public void cadastraFoto(byte[] foto) { Foto oFotoModel = new Foto(); FotoBLL oFotoBLL = new FotoBLL(); oFotoModel.foto = foto; try { oFotoBLL.cadastraFoto(oFotoModel); } catch (Exception) { throw; } }
public void cadastraFoto(Foto ofotoModel) { string clausulaSQL = "SP_CADASTRA_FOTO_VISITANTE"; try { SqlCommand comandoSql = new SqlCommand(clausulaSQL); comandoSql.Parameters.AddWithValue("@FOTO", ofotoModel.foto); ExecutaComando(comandoSql); } catch (Exception) { throw; } }
/// <summary> /// Obtem a miniatura de uma foto. /// Este método deve ser evitado, é preferível utilizar /// ObterMiniaturas() para obtenção em batch com mais desempenho. /// </summary> /// <param name="código"></param> /// <returns></returns> public DbFoto Obter(Foto foto) { DbFoto entidade = null; if (hashMiniaturas.TryGetValue(foto.Código, out entidade)) { return entidade; } else { // tenta obter pela cache ou banco de dados: Dictionary<uint, Foto> hash = new Dictionary<uint, Foto>(); hash[foto.Código] = foto; ObterMiniaturas(hash); hashMiniaturas.TryGetValue(foto.Código, out entidade); return entidade; } }
public static List<Foto> Read() { SqlConnection cn = new SqlConnection(Conexao.SQL); SqlCommand cmd = new SqlCommand(); List<Foto> fotos = new List<Foto>(); cmd.Connection = cn; cmd.CommandText = "SELECT * FROM FOTOS ORDER BY FOTOID"; try { cn.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Foto foto = new Foto(); foto.FotoID = dr.GetInt32(dr.GetOrdinal("FOTOID")); foto.Titulo = dr.GetString(dr.GetOrdinal("TITULO")); foto.Descricao = dr.GetString(dr.GetOrdinal("DESCRICAO")); foto.FotoDados = (byte[])dr.GetValue(dr.GetOrdinal("FOTO")); //O método GetValue() do objeto SqlDataReader retorna os dados como um objeto //por isso fazemos uma conversão forçada(Cast) para um array de bytes. fotos.Add(foto); } } catch (Exception ex) { throw new Exception("Erro: " + ex.Message); } finally { cn.Close(); } return fotos; }
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e) { Foto foto = new Foto(); TextBox titulo = (TextBox)DetailsView1.Rows[0].Cells[1].Controls[0]; TextBox descricao = (TextBox)DetailsView1.Rows[1].Cells[1].Controls[1]; FileUpload fu = (FileUpload)DetailsView1.Rows[2].Cells[1].Controls[1]; foto.Titulo = titulo.Text; foto.Descricao = descricao.Text; System.IO.Stream imgdatastream = fu.PostedFile.InputStream; int imgdatalen = fu.PostedFile.ContentLength; byte[] imgdata = new byte[imgdatalen]; int n = imgdatastream.Read(imgdata, 0, imgdatalen); foto.FotoDados = imgdata; FotoDAL.Create(foto); BindData(); }
public ListaFotos buscaFotoVisitante(Foto oFotoModel) { string clausulaSQL = "SP_LISTA_FOTO_VISITANTE"; try { SqlCommand comandoSQL = new SqlCommand(clausulaSQL); comandoSQL.Parameters.AddWithValue("@ID", oFotoModel.idFoto); DataTable tbFoto = new DataTable(); tbFoto = ExecutaQuery(comandoSQL); return populaFoto(tbFoto); } catch (Exception) { throw; } }
public void CarregarFotoParaAlteração(Foto foto) { Carregar(); alterandoFoto = true; foreach (int i in lista.CheckedIndices) lista.SetItemChecked(i, false); // Atribuir nulo para que as marcações não alterem a lista. this.foto = null; if (foto != null) { lock (foto.Álbuns) { foreach (Entidades.Álbum.Álbum álbum in foto.Álbuns) { int i = 0; foreach (Entidades.Álbum.Álbum lÁlbum in lista.Items) { if (lÁlbum.Nome == álbum.Nome) { lista.Items[i] = álbum; lista.SetItemChecked(i, true); break; } i++; } } } } this.foto = foto; alterandoFoto = false; }
public static Foto getFotoPorCodigo(int fotoid) { SqlConnection cn = new SqlConnection(Conexao.SQL); SqlCommand cmd = new SqlCommand(); Foto foto = new Foto(); cmd.Connection = cn; byte[] data = new byte[1001]; cmd.CommandText = "SELECT * FROM FOTOS WHERE FOTOID= @FOTOID"; cmd.Parameters.AddWithValue("@FOTOID", fotoid); try { cn.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { foto.FotoID = dr.GetInt32(dr.GetOrdinal("FOTOID")); foto.Titulo = dr.GetString(dr.GetOrdinal("TITULO")); foto.Descricao = dr.GetString(dr.GetOrdinal("DESCRICAO")); foto.FotoDados = (byte[])dr.GetValue(dr.GetOrdinal("FOTO")); } } catch (Exception ex) { throw new Exception("Erro: " + ex.Message); } finally { cn.Close(); } return foto; }
static void Main(string[] args) { //Form1 gui = new Form1(); //InitializeComponent(); //gui.Form1(); //Application.EnableVisualStyle(); // Random randNum = new Random(); Foto fotoObj = new Foto(); //Console.WriteLine(fotoObj.zona); Console.WriteLine("Teste"); Console.WriteLine(geraNomeacao()); var json = File.ReadAllText(@"C:\Users\alefm\source\repos\JsonDemo\pessoa.json"); //var json = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\pessoa.json"); Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory); //Console.WriteLine(AppDomain.CurrentDomain); var js = new DataContractJsonSerializer(typeof(List <Pessoa>)); var ms = new MemoryStream(Encoding.UTF8.GetBytes(json)); var pessoa = (List <Pessoa>)js.ReadObject(ms); // new Pessoa = pessoa p // Console.WriteLine(Pessoa.Nome); var show = pessoa[0].Nome; Console.WriteLine(show); show = pessoa[1].Nome; Console.WriteLine(show); int[] lista; lista = new int[100]; for (int i = 0; i < 100; i++) { lista[i] = 100 - i; } //mostraVetor(lista); //Console.WriteLine(Convert.ToString(lista)); bubbleSort(lista); //Quick_Sort(lista, 0, lista.Length - 1); //cocktailSort(lista); //Console.WriteLine("\n"+lista.Length); //mostraVetor(lista); json = File.ReadAllText(@"C:\Users\alefm\source\repos\JsonDemo\fotos.json"); js = new DataContractJsonSerializer(typeof(List <Foto>)); ms = new MemoryStream(Encoding.UTF8.GetBytes(json)); var foto = (List <Foto>)js.ReadObject(ms); show = foto[0].LocalDaFoto; Console.WriteLine("foto SetType " + foto.GetType()); Console.WriteLine(show); // Manaus Console.WriteLine("foto[0].LocalDaFoto GetType " + show.GetType()); Console.WriteLine("Count " + foto.Count); // 5 Console.WriteLine("Second"); var show2 = foto[0]; Console.WriteLine("show2 GetType " + show2.GetType()); var arr1 = transformArrayTitulo(foto, foto.Count); Console.WriteLine("preFor"); for (var i = 0; i < arr1.Length; i++) { Console.WriteLine(arr1[i]); } String strToBytes = "abcwxyzaçãéóõô"; //231 227 byte[] asciiBytes = Encoding.Default.GetBytes(strToBytes); Console.WriteLine("{0} {1} {2} ", asciiBytes[0], asciiBytes[1], asciiBytes[2]); // 97 98 99 foreach (int c in asciiBytes) { Console.Write(" " + c); } strToBytes = "ABCWXYZaÇÃÉÓÕÔ "; // 199 195 asciiBytes = Encoding.Default.GetBytes(strToBytes); //ASCII Console.WriteLine("\n{0} {1} {2} ", asciiBytes[0], asciiBytes[1], asciiBytes[2]); // 65 66 67 foreach (int c in asciiBytes) { Console.Write(" " + c); } Console.WriteLine("\n chars " + (char)65); byte by; //char c; string str2; for (int b = 65; b < 123; b++) { Console.Write("" + (char)b); if (b == 90) { b = 96; } //Console.Write(System.Text.Encoding.ASCII.GetString(new byte[] { 65 })); } Console.Write("" + (char)231 + (char)227 + (char)199 + (char)195 + (char)32 + (char)233 + (char)201 + (char)245); //çãÇà éÉó DateTime now = DateTime.Now; DateTime today = DateTime.Today; DateTime dateTime = DateTime.UtcNow.Date; Console.WriteLine("\n" + now); Console.WriteLine(today); // 00:00:00 Console.WriteLine(dateTime.ToString("d")); string date = now.GetDateTimeFormats('d')[0]; string time = now.GetDateTimeFormats('t')[0]; Console.WriteLine(date); Console.WriteLine(time); Console.ReadKey(); }
public void AdicionarFotos(Foto foto) { _fotos.Add(foto); }
public void RemoverFoto(Foto foto) { RaiseEvent(new FotoRemovidaAnuncioEvent(Id, foto)); }
public void AddFoto(Foto foto) { _omgevingen.Include(o => o.Fotos).Where(o => o.Id == 1).FirstOrDefault().Fotos.Add(foto); }
/// <summary> /// Remove associação de foto a este álbum. /// </summary> private void RemoverFoto(IDbCommand cmd, Foto foto) { /* Se a foto foi descadastrada, então espera-se * que ela também tenha sido removida pelo banco de dados * (ON DELETE CASCADE). */ if (foto.Cadastrado) { cmd.CommandText = "DELETE FROM vinculofotoalbum WHERE" + " album = " + DbTransformar(código) + " AND foto = " + DbTransformar(foto.Código); cmd.ExecuteNonQuery(); } }
public void run() { AgregarDecisiones agregacion = new AgregarDecisiones(); PruebaDecisiones prueba = new PruebaDecisiones(); IPersonaje famoso = new Personaje(); EleccionPersonaje eleccionPersonaje = new EleccionPersonaje(); eleccionPersonaje.elegirPersonaje(); //agregacion.Agregar(eleccionPersonaje.elegido); Nombre nombre = new Nombre(); nombre.ponerNombre(); Personaje personaje = new Personaje(); if (eleccionPersonaje.elegido == "a") { agregacion.Agregar("Rockstar"); //pondra en el archivo de texto lo que esta entre parentesis, es mejor a que ponga una letra, que es lo que hacia la linea 29 Personaje r = new Personaje(); r.Reputacion = r.reputacion; r.Seguidores = r.seguidores; r.Dinero = r.dinero; Console.WriteLine("Bienvenido a tu nueva vida como rockstar." + "\r\n"); Console.WriteLine("Actualmente cuentas con " + r.Seguidores + " seguidores"); Console.WriteLine("También cuentas con " + r.Dinero + " pesos"); Console.WriteLine("Y tu reputación es de " + r.Reputacion); Console.WriteLine("Tu misión es lograr tener el 100 de reputación, evitar quedar en quiebra y conseguir 10,000 seguidores."); } else if (eleccionPersonaje.elegido == "b") { agregacion.Agregar("Artista"); //lo mismo de la linea 38 Personaje a = new Personaje(); a.Reputacion = a.reputacion; a.Seguidores = a.seguidores; a.Dinero = a.dinero; Console.WriteLine("Bienvenido a tu nueva vida como artista." + "\r\n"); Console.WriteLine("Actualmente cuentas con " + a.Seguidores + " seguidores"); Console.WriteLine("También cuentas con " + a.Dinero + " pesos"); Console.WriteLine("Y tu reputación es de " + a.Reputacion); Console.WriteLine("Tu misión es lograr tener el 100 de reputación, evitar quedar en quiebra y conseguir 10,000 seguidores." + "\r\n"); } PressKey enter = new PressKey(); enter.presionaEnter(); Imagen personalidad = new Imagen(); //escoger que quiere, ejemplo a seguir, talentoso, etc. personalidad.definirPersonalidad(); enter.presionaEnter(); EventoCaridad caridad = new EventoCaridad(); //primer evento, checar ahi priscila, ya esta esa parte hecha if (eleccionPersonaje.elegido == "a") { Console.WriteLine(" "); if (personalidad.elegido == "a") { caridad.eventoCaridad_Rockstar(); enter.presionaEnter(); Pelearse pelea = new Pelearse(); Foto foto = new Foto(); Concierto concierto = new Concierto(); if (caridad.elegido == "c") { pelea.pelearseFamoso_Crucero(); enter.presionaEnter(); concierto.darConcierto_Crucero(); enter.presionaEnter(); if (concierto.elegido == "a" || concierto.elegido == "c") { foto.tomarseFoto_Concierto(); enter.presionaEnter(); } else { Foto aeropuerto = new Foto(); aeropuerto.tomarseFoto_Aeropuerto(); } } else if (caridad.elegido == "a") { pelea.pelearseFamoso_Gala(); enter.presionaEnter(); Fiesta invitacion = new Fiesta(); invitacion.invitacion_Gala(); if (invitacion.elegido == "b") { invitacion.aceptaFiesta(); if (invitacion.elegido2 == "a") { Console.WriteLine("Has descansado muy bien y est[as fresco para tu concierto"); foto.tomarseFoto_Concierto(); enter.presionaEnter(); } enter.presionaEnter(); } else { Console.WriteLine("Has descansado muy bien y est[as fresco para tu concierto"); foto.tomarseFoto_Concierto(); enter.presionaEnter(); } } else { pelea.pelearseFamoso_Calle(); enter.presionaEnter(); } ComprarCasa casa = new ComprarCasa(); casa.comprarseCasa(); enter.presionaEnter(); } else if (personalidad.elegido == "b") { Concierto b = new Concierto(); Contrato gira = new Contrato(); Obstaculos enfermedad = new Obstaculos(); gira.aceptarContrato(); enter.presionaEnter(); if (gira.elegido == "a") { b.primerConcierto(); Foto primerConcierto = new Foto(); primerConcierto.tomarseFoto_Concierto(); enter.presionaEnter(); enfermedad.enfermarse(); } } else if (personalidad.elegido == "c") { } } else if (eleccionPersonaje.elegido == "b") { Console.WriteLine(" "); if (personalidad.elegido == "a") { caridad.eventoCaridad_Artista(); enter.presionaEnter(); } else if (personalidad.elegido == "b") { } else if (personalidad.elegido == "c") { } } }
public static void Update(Foto foto) { SqlConnection cn = new SqlConnection(Conexao.SQL); SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandText = "UPDATE FOTOS SET TITULO=@TITULO, DESCRICAO=@DESCRICAO, FOTO=@FOTO WHERE FOTOID=@FOTOID"; cmd.Parameters.AddWithValue("@FOTOID", foto.FotoID); cmd.Parameters.AddWithValue("@TITULO", foto.Titulo); cmd.Parameters.AddWithValue("@DESCRICAO", foto.Descricao); cmd.Parameters.AddWithValue("@FOTO", foto.FotoDados); //foto.FotoDados = (byte[])dr.GetValue(dr.GetOrdinal("FOTO")); //cmd.Parameters.AddWithValue("@FOTO", (byte[])foto.FotoDados); //SqlParameter img = new SqlParameter("@FOTO", SqlDbType.VarBinary); //img.Value = foto.FotoDados; //cmd.Parameters.Add(img); try { cn.Open(); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception("Erro: " + ex.Message); } finally { cn.Close(); } }
protected void BtnAgregar_Click(object sender, EventArgs e) { try { bool Estado; string Extension; EmpleadoNegocio EmpleadoNegocio = new EmpleadoNegocio(); Empleado Empleado = new Empleado(); Empleado = null; Empleado = EmpleadoNegocio.BuscarEmpleado(Convert.ToInt32(txtDNI.Text)); if (Empleado == null) { Empleado = new Empleado(); Empleado.Dni = Convert.ToInt32(txtDNI.Text); Empleado.Nombre = txtNombre.Text; Empleado.Email = txtEmail.Text; if (Foto.HasFile) { Extension = Path.GetExtension(Foto.FileName).ToLower(); if (Extension == ".jpg" || Extension == ".gif" || Extension == ".jpeg") { Foto.SaveAs(Server.MapPath("~/Fotos/" + Foto.FileName)); Empleado.Foto = "~/Fotos/" + Foto.FileName; } else { lblMensaje.Text = "El formato de la imagen es incorrecto"; } } else { Empleado.Foto = ""; } if (txtDNI.Text == "" || txtNombre.Text == "" || txtEmail.Text == "") { lblMensaje.Text = "Hay campos que se encuentran vacios"; } else { Estado = EmpleadoNegocio.AgregarEmpleado(Empleado); if (Estado == true) { EmpleadoNegocio.GenerarUsuario(Empleado); EmpleadoNegocio.EnviarCorreo(Empleado); lblMensaje.Text = "Empleado agregado correctamente"; txtDNI.Text = ""; txtNombre.Text = ""; txtEmail.Text = ""; } else { lblMensaje.Text = "Error el empleado no fue agregado correctamente"; } } } else if (Empleado != null) { Empleado.Dni = Convert.ToInt32(txtDNI.Text); Empleado.Nombre = txtNombre.Text; Empleado.Email = txtEmail.Text; if (txtDNI.Text == "" || txtNombre.Text == "" || txtEmail.Text == "") { lblMensaje.Text = "Hay campos que se encuentran vacios"; } else { Estado = EmpleadoNegocio.ModificarEmpleado(Empleado); if (Estado == true) { lblMensaje.Text = "Empleado modificado correctamente"; txtDNI.Text = ""; txtNombre.Text = ""; txtEmail.Text = ""; } else { lblMensaje.Text = "Error el empleado no fue modificado correctamente"; } } } } catch (Exception) { lblMensaje.Text = "Hay campos que se encuentran vacios o verificar el formato de la imagen"; } }
public FotoLesmateriaal(Lesmateriaal lesmateriaal, Foto foto) { this.Lesmateriaal = lesmateriaal; this.Foto = foto; }
void camera_Completed(object sender, PhotoResult e) { try { BitmapImage image = new BitmapImage(); image.SetSource(e.ChosenPhoto); MemoryStream ms = new MemoryStream(); WriteableBitmap wb = new WriteableBitmap(image); wb.SaveJpeg(ms, image.PixelWidth, image.PixelHeight, 0, 100); byte[] imageBytes = ms.ToArray(); Foto foto = new Foto(); foto.imagem = imageBytes; ListaBytesImagens.Add(foto); ListaImagens.Add(image); atualizarLBox(); SalvarFoto(); } catch (Exception) { } AlterarVisibilidadeTxtAdicionarFotos(); }
public static void Processar(Foto foto) => Filtros(foto);
/// <summary> /// Devuelve la lista de fotos de un lugar turistico especifico. /// Recibe un lugar turistico. /// </summary> /// <param name="objeto"></param> /// <returns></returns> public override List <Entidad> ConsultarLista(Entidad objeto) { // Inicializamos la lista de fotos; _listaFotos = new List <Entidad>(); // Se evita castear el objeto a un objeto lugar turistico // pues no es necesario. try { base.Conectar(); //Inicia una sesion con la base de datos Comando = new NpgsqlCommand("ConsultarFotos", base.SqlConexion); Comando.CommandType = CommandType.StoredProcedure; // Recordar que objeto es un lugar turistico Comando.Parameters.AddWithValue(NpgsqlTypes.NpgsqlDbType.Integer, objeto.Id); _respuesta = Comando.ExecuteReader(); while (_respuesta.Read()) { // Creo cada entidad Foto y la agrego a la lista Foto nuevaFoto; if (!_respuesta.IsDBNull(1)) { nuevaFoto = new Foto(_respuesta.GetInt32(0), _respuesta.GetString(1)); _listaFotos.Add(nuevaFoto); } } // Retorno la lista de entidades return(_listaFotos); } catch (NullReferenceException e) { log.Error(e.Message); throw new ReferenciaNulaExcepcion(e, "Parametros de entrada nulos en: " + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message); } catch (InvalidCastException e) { log.Error("Casteo invalido en:" + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message); throw new CasteoInvalidoExcepcion(e, "Ocurrio un casteo invalido en: " + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message); } catch (NpgsqlException e) { log.Error("Ocurrio un error en la base de datos en: " + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message); throw new BaseDeDatosExcepcion(e, "Ocurrio un error en la base de datos en: " + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message); } catch (SocketException e) { log.Error("Ocurrio un error en la base de datos en: " + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message); throw new SocketExcepcion(e, "Ocurrio un error en la base de datos en: " + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message); } catch (Exception e) { log.Error("Ocurrio un error desconocido: " + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message); throw new Excepcion(e, "Ocurrio un error desconocido en: " + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message); } finally { Desconectar(); } }
private FotoAdicionadaAnuncioEvent(Identity aggregateID, long aggregateVersion, Foto foto) : base(aggregateID, aggregateVersion) { Foto = foto; }
public FotoAdicionadaAnuncioEvent(Identity aggregateID, Foto foto) : base(aggregateID) { Foto = foto; }
/// <summary> /// Usuário requisita importação de fotos e o sistema /// adiciona as fotos escolhidas pelo usuário no painel /// de fotos. /// </summary> private void openFileDialog_FileOk(object sender, CancelEventArgs e) { foreach (string arquivo in openFileDialog.FileNames) try { Image imagem; imagem = Image.FromFile(arquivo); painelFotos.AdicionarFoto(imagem); painelFotos.Selecionar(0); Foto f = new Foto(); f.Imagem = imagem; quadroExibição.MostrarFoto(f); } catch (Exception erro) { MessageBox.Show( this.ParentForm, "Não foi possível importar o arquivo " + arquivo + ".\n" + "Ocorreu o seguinte erro:\n\n" + erro.Message, "Importar foto", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Add(Foto foto) { Db.Fotos.Add(foto); }
private void Adiciona(Foto foto) { try { if (!álbum.Fotos.Contém(foto)) álbum.Fotos.Adicionar(foto); } catch (Exception erro) { Acesso.Comum.Usuários.UsuárioAtual.RegistrarErro(erro); MessageBox.Show( ParentForm, "Não foi possível adicionar a foto ao álbum. Ocorreu o seguinte erro:\n\n" + erro.ToString(), "Adicionar foto", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public override void Adicionar(Foto foto) { álbum.Fotos.Adicionar(foto); }
void Fotos_AoRemover(Acesso.Comum.DbComposição<Foto> composição, Foto entidade) { álbum.Fotos.Atualizar(); }
public void IncluirFoto(Foto foto) { Db.Set <Foto>().Add(foto); }
void Fotos_AoAdicionar(Acesso.Comum.DbComposição<Foto> composição, Foto entidade) { base.Adicionar(entidade); álbum.Fotos.Atualizar(); }
/// <summary> /// Ocorre ao remover uma foto da lista, removendo também /// o álbum da lista da foto. /// </summary> /// <remarks> /// Como a foto pode ser desassociada do álbum por meio da /// entidade Álbum ou da entidade Foto, é necessário a determinação /// da origem da modificação. /// </remarks> void AoRemoverFoto(DbComposição<Foto> composição, Foto entidade) { if (entidade.Álbuns.Contains(this)) entidade.Álbuns.Remove(this); }
private void ListViewEdiçãoFotos_AoSelecionar(Foto foto) { btnEditar.Enabled = foto != null; btnRemover.Enabled = Seleções.Length > 0; }
private ListaFotos populaFoto(DataTable dt) { ListaFotos oListaFoto = new ListaFotos(); foreach (DataRow dr in dt.Rows) { Foto oFotoModel = new Foto(); oFotoModel.idFoto = Convert.ToInt32(dr["ID_FOTO"]); oFotoModel.foto = (byte[])dr["FOTO"]; oFotoModel.dataInclusao = Convert.ToDateTime(dr["DATA"]); oListaFoto.Add(oFotoModel); } return oListaFoto; }
public List <Foto> RetrieveAllById(Foto foto) { return(crudFoto.RetrieveAllById <Foto>(foto)); }
public void AdicionarFoto(Foto foto) { RaiseEvent(new FotoAdicionadaAnuncioEvent(Id, foto)); }
public void Update(Foto foto) { crudFoto.Update(foto); }
private void btGuardarFotos_Click(object sender, EventArgs e) { List <Foto> fotos = new List <Foto>(); Service ws = new Service(); string archivosSinGuardar = string.Empty; using (OpenFileDialog opf = new OpenFileDialog()) { opf.Multiselect = true; opf.Filter = "Images (*.BMP;*.JPG;*.GIF,*.PNG,*.TIFF)|*.BMP;*.JPG;*.GIF;*.PNG;*.TIFF"; opf.Title = "Seleccione las Imagenes por favor"; if (opf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (String file in opf.FileNames) { try { Foto f = new Foto(); //Image img = ResizeImage(file, 488, 414, true); Image img = GetImageLowQuality(file); ImageConverter converter = new ImageConverter(); f.Imagen = (byte[])converter.ConvertTo(img, typeof(byte[])); f.InmuebleId = Inmueble.Id; fotos.Add(f); try { ws.GuardarFoto(f); } catch (Exception) { if (archivosSinGuardar == string.Empty) { archivosSinGuardar = "No se pudieron guardar los siguientes archivos: " + Environment.NewLine; } archivosSinGuardar += " - " + file + Environment.NewLine; } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } } if (archivosSinGuardar != string.Empty) { MessageBox.Show(archivosSinGuardar, "Error"); } else { MessageBox.Show("Imagen/es Guardada Correctamente!"); this.Close(); } } } }
public void Delete(Foto foto) { crudFoto.Delete(foto); }
/// <summary> /// Prepara edição de foto. /// </summary> /// <param name="foto">Foto a ser editada.</param> public void Editar(Foto foto) { painelFotos.Limpar(); painelFotos.AdicionarFoto(foto.Imagem); quadroMercadoria.TxtReferênciaEnabled = false; quadroMercadoria.Foto = foto; quadroExibição.MostrarFoto(foto); painelFotos.Selecionar(0); btnCadastrar.Visible = false; btnImportar.Visible = false; if (!Exibindo) Exibir(); opçãoApagarFoto.Enabled = true; }
public void PretoBranco(Foto foto) { Console.WriteLine("FotoFiltro --> PretoBranco"); }
public void SetUp() { _lugaresTuristicos = new List <Entidad>(); _lugarTuristico = FabricaEntidad.CrearEntidadLugarTuristico(); _lugarTuristico.Id = 2; _lugarTuristico.Nombre = "Parque Venezuela"; _lugarTuristico.Costo = 2000; _lugarTuristico.Descripcion = "Parque creado en Venezuela"; _lugarTuristico.Direccion = "Av. Principal Venezuela"; _lugarTuristico.Correo = "*****@*****.**"; _lugarTuristico.Telefono = 04142792806; _lugarTuristico.Latitud = 25; _lugarTuristico.Longitud = 25; _lugarTuristico.Activar = true; _lugaresTuristicos.Add(_lugarTuristico); _lugarTuristico = FabricaEntidad.CrearEntidadLugarTuristico(); _lugarTuristico.Id = 3; _lugarTuristico.Nombre = "Parque Del este"; _lugarTuristico.Costo = 2000; _lugarTuristico.Descripcion = "Parque natural en Venezuela"; _lugarTuristico.Direccion = "En el este de caracas"; _lugarTuristico.Correo = "*****@*****.**"; _lugarTuristico.Telefono = 04164444778; _lugarTuristico.Latitud = 25; _lugarTuristico.Longitud = 25; _lugarTuristico.Activar = true; _lugaresTuristicos.Add(_lugarTuristico); _fotos = new List <Entidad>(); _foto = FabricaEntidad.CrearEntidadFoto(); _foto.Id = 2; _foto.Ruta = "TEST"; _fotos.Add(_foto); _foto = FabricaEntidad.CrearEntidadFoto(); _foto.Id = 3; _foto.Ruta = "TEST2"; _fotos.Add(_foto); // Guardo la primera foto de la lista _foto = (Foto)_fotos[0]; _actividades = new List <Entidad>(); _actividad = FabricaEntidad.CrearEntidadActividad(); _actividad.Id = 2; _actividad.Nombre = "TEST"; _actividad.Foto.Ruta = "TEST"; _actividad.Duracion = new TimeSpan(2, 0, 0); _actividad.Descripcion = "TEST"; _actividad.Activar = true; _actividades.Add(_actividad); _actividad = FabricaEntidad.CrearEntidadActividad(); _actividad.Id = 3; _actividad.Nombre = "TREMENDOTEST"; _actividad.Foto.Ruta = "CARACAS"; _actividad.Duracion = new TimeSpan(2, 0, 0); _actividad.Descripcion = "THE GREATEST ACTIVITY"; _actividad.Activar = true; _actividades.Add(_actividad); _categoria = FabricaEntidad.CrearEntidadCategoria(); _categoria.Nombre = "Musica"; _categoria.Descripcion = "Categoria asociada con la musica"; _categoria.Estatus = true; _categoria.Nivel = 1; _categoria.CategoriaSuperior = 0; //_comandoA = FabricaComando.CrearComandoAgregarCategoria(_categoria); //_comandoA.Ejecutar(); }
public void Redimencionar(Foto foto) { Console.WriteLine("FotoFiltro --> Redimencionar"); }
protected void Page_Load(object sender, EventArgs e) { var hotelId = Int64.Parse(Request.QueryString["id"]); if (!IsPostBack) { Hotel h = hotelBll.BuscarPorId(hotelId); txtNombre.Text = h.Nombre; txtDireccion.Text = h.Direccion; txtLat.Text = h.Latitud; txtLong.Text = h.Longitud; txtDireccion.Text = h.Direccion; txtHabitaciones.Text = h.Habitaciones; txtDescripcion.Text = h.Descripcion; txtPrecio.Text = h.Precio.ToString(); } foreach (Destino d in destinoBll.BuscarTodos()) { ListItem item = new ListItem(); item.Value = d.Id.ToString(); item.Text = d.Descripcion; if (!IsPostBack && hotelBll.existeRelacionConDestino(hotelId, d.Id)) { item.Selected = true; } lstDestinos.Items.Add(item); } foreach (Tag t in tagBll.BuscarTodos()) { ListItem item = new ListItem(); item.Value = t.Id.ToString(); item.Text = t.Codigo; if (!IsPostBack && hotelBll.existeRelacionConTag(hotelId, t.Id)) { item.Selected = true; } chkTags.Items.Add(item); } tblFotos.Rows.Clear(); TableHeaderRow hrow = new TableHeaderRow(); hrow.Cells.Add(new TableHeaderCell { Text = "Nombre" }); hrow.Cells.Add(new TableHeaderCell { Text = "Fecha de Creacion" }); hrow.Cells.Add(new TableHeaderCell { Text = "" }); tblFotos.Rows.Add(hrow); IList <Foto> fotos = fotoBll.buscarPorHotelId(hotelId); foreach (Foto h in fotos) { TableRow row = new TableRow(); row.Cells.Add(new TableCell { Text = h.nombre }); row.Cells.Add(new TableCell { Text = h.FechaCreacion.ToString() }); tblFotos.Rows.Add(row); } if (fotos.Count > 0) { Foto f = fotos[0]; imagenPrincipal.ImageUrl = f.path; imagenPrincipal.AlternateText = f.nombre; } }
public void Colorir(Foto foto) { Console.WriteLine("FotoFiltro --> Colorir"); }
/// <summary> /// Imprime item /// </summary> protected virtual void ImprimirItem(Graphics g, Foto foto, PointF posiçãoAtual, ItensImpressão itens) { float y = posiçãoAtual.Y; // Desenhar foto if ((itens & ItensImpressão.Foto) > 0) { SizeF tamanho; if (foto.Imagem.Width / (double)foto.Imagem.Height >= fotoDimensões.Width / (double)fotoDimensões.Height) tamanho = new SizeF(fotoDimensões.Width, (float)((float) fotoDimensões.Width * (float) foto.Imagem.Height)/(float)foto.Imagem.Width); else tamanho = new SizeF((float)((float) foto.Imagem.Width * (float) fotoDimensões.Height / (float) foto.Imagem.Height), fotoDimensões.Height); #if DEBUG if (tamanho.Width > fotoDimensões.Width) throw new Exception("Largura maior que tamanho máximo."); if (tamanho.Height > fotoDimensões.Height) throw new Exception("Altura maior que tamanho máximo."); #endif g.DrawImage(foto.Imagem, posiçãoAtual.X + (fotoDimensões.Width - tamanho.Width) / 2, posiçãoAtual.Y + (fotoDimensões.Height - tamanho.Height) / 2, tamanho.Width, tamanho.Height); y += fotoDimensões.Height; y += espaçamentoTexto; } Entidades.Mercadoria.Mercadoria mercadoria = null; if ((itens & (ItensImpressão.RequerMercadoria | ItensImpressão.Referência)) > 0) mercadoria = foto.ObterMercadoria(); // Desenhar referência if ((itens & ItensImpressão.Referência) > 0) DesenharStringCentralizada(g, foto.ReferênciaFormatada + "-" + mercadoria.Dígito.ToString(), posiçãoAtual.X, ref y, itemDimensões.Width); if ((itens & ItensImpressão.FaixaGrupo) > 0) { string str = ""; if (mercadoria.Grupo.HasValue) str = string.Format("{0}-{1}", mercadoria.Faixa, mercadoria.Grupo.Value); else str = mercadoria.Faixa; if ((itens & ItensImpressão.Peso) > 0 && mercadoria.DePeso) { if (str.Length > 0) str += " - "; str += string.Format("9{0:###0.0}9", mercadoria.Peso); } if ((itens & ItensImpressão.Índice) > 0) { if (str.Length > 0) str += " - "; str += string.Format(" {0:###,###,##0.00}", mercadoria.ÍndiceArredondado); } DesenharStringCentralizada(g, str, posiçãoAtual.X, ref y, itemDimensões.Width); } else if ((itens & ItensImpressão.Peso) > 0 && mercadoria.DePeso) { string str; str = string.Format("9{0:###0.0}9", mercadoria.Peso); if (str.Length > 0) str += " - "; if ((itens & ItensImpressão.Índice) > 0) { if (str.Length > 0) str += " - "; str += string.Format(" {0:###,###,##0.00}", mercadoria.ÍndiceArredondado); } DesenharStringCentralizada(g, str, posiçãoAtual.X, ref y, itemDimensões.Width); } else if ((itens & ItensImpressão.Índice) > 0 && mercadoria.ÍndiceArredondado > 0) { DesenharStringCentralizada(g, string.Format("{0:###,###,##0.00}", mercadoria.ÍndiceArredondado), posiçãoAtual.X, ref y, itemDimensões.Width); } // Desenhar descrição if ((itens & ItensImpressão.Descrição) > 0) DesenharStringCentralizada(g, foto.Descrição, posiçãoAtual.X, ref y, itemDimensões.Width); if ((itens & ItensImpressão.DescriçãoMercadoria) > 0) { string str = mercadoria.Descrição.Trim(); bool formatar = true; foreach (char c in str) formatar &= !char.IsLower(c); if (formatar) str = Apresentação.Pessoa.FormatadorNome.FormatarTexto(str); DesenharStringCentralizada(g, str, posiçãoAtual.X, ref y, itemDimensões.Width); } // Desenhar fornecedor MercadoriaFornecedor fornecedor = Entidades.Mercadoria.MercadoriaFornecedor.ObterFornecedor(mercadoria.ReferênciaNumérica); if (fornecedor != null) { if ((itens & ItensImpressão.Fornecedor) > 0) DesenharStringCentralizada(g, (fornecedor != null ? fornecedor.FornecedorCódigo.ToString() : ""), posiçãoAtual.X, ref y, itemDimensões.Width); if ((itens & ItensImpressão.FornecedorReferência) > 0) DesenharStringCentralizada(g, (!String.IsNullOrEmpty(fornecedor.ReferênciaFornecedorComFFL) ? fornecedor.ReferênciaFornecedorComFFL : ""), posiçãoAtual.X, ref y, itemDimensões.Width); } }
/// <summary> /// Adiciona uma foto à lista. /// </summary> /// <param name="foto">Foto a ser adicionada.</param> public virtual void Adicionar(Foto foto) { if (fotos == null) fotos = new List<Foto>(); fotos.Add(foto); if (ordenar) fotos.Sort(); lst.VirtualListSize++; }
private void listaFotosTodas_AoExcluído(Foto foto) { Entidades.Álbum.Álbum album = Entidades.Álbum.Álbum.ObterÁlbum(lstEdição.Álbum.Código); lstEdição.Carregar(album); todasFotos.Carregar(); }
private Entidad ConvertListFoto(Foto input) { return(input); }
public override bool agregarFoto(Foto foto, Current current = null) { throw new System.NotImplementedException(); }
/// <summary> /// Ocorre ao adicionar uma foto à lista, adicionando também /// o álbum na lista da foto. /// </summary> /// <remarks> /// Como a foto pode ser desassociada do álbum por meio da /// entidade Álbum ou da entidade Foto, é necessário a determinação /// da origem da modificação. /// </remarks> void AoAdicionarFoto(DbComposição<Foto> composição, Foto entidade) { if (!entidade.Álbuns.Contains(this)) entidade.Álbuns.Add(this); }
public void AtualizarFoto(Foto foto) { this.Db.Set <Foto>().Update(foto); }
///// <summary> ///// Adiciona foto no álbum. ///// </summary> private void AdicionarFoto(IDbCommand cmd, Foto foto) { cmd.CommandText = "INSERT INTO vinculofotoalbum (album, foto) VALUES (" + DbTransformar(código) + ", " + DbTransformar(foto.Código) + ")"; cmd.ExecuteNonQuery(); }
public void Crop(Foto foto) { Console.WriteLine("FotoFiltro --> Crop"); }
public async Task <Foto> GetSponsorImageAsync(Guid verenigingId, Guid afbeeldingId) { Foto foto = new Foto(); StorageFile image = null; Sponsor sponsor = _cachedSponsors.SingleOrDefault(s => s.AfbeeldingId == afbeeldingId); //StorageFolder _folder = Windows.Storage.ApplicationData.Current.TemporaryFolder; //StorageFolder _fotos = await _folder.CreateFolderAsync("Sponsors", CreationCollisionOption.OpenIfExists); //string _filename = sponsorId + ".jpg"; //image = await _fotos.CreateFileAsync(_filename, CreationCollisionOption.ReplaceExisting); //foto.Path = image.Path; if (sponsor != null) { string filename = sponsor.Id + ".jpg"; StorageFolder folder = Windows.Storage.ApplicationData.Current.TemporaryFolder; StorageFolder fotos = await folder.CreateFolderAsync("Sponsors", CreationCollisionOption.OpenIfExists); image = await fotos.TryGetItemAsync(filename) as StorageFile; try { if (image != null) { await image.DeleteAsync(StorageDeleteOption.PermanentDelete); } if (image == null) { foto = await _sponsorService.GetSponsorImageByIdAsync(verenigingId, afbeeldingId); if (foto != null) { image = await fotos.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting); IBuffer writebuffer = GetBufferFromContentData(foto.ContentData); await Windows.Storage.FileIO.WriteBufferAsync(image, writebuffer); foto.Path = image.Path; } } } catch (Exception ex) { string message = ex.Message; } /* * try * { * IBuffer readbuffer = await FileIO.ReadBufferAsync(image); * * if (foto.ContentData != null) * foto.ContentData = new byte[readbuffer.Length]; * * foto.ContentData = readbuffer.ToArray(); * } * catch (Exception ex) * { * string message = ex.Message; * } */ } return(foto); }
public void Histogramizacao(Foto foto) { Console.WriteLine("FotoFiltro --> Histogramizacao"); }
public void FotoMenu() { Foto.Click(); }
private listVisitante populaVisitante(DataTable dt) { listVisitante oListVisitante = new listVisitante(); foreach (DataRow item in dt.Rows) { Visitante oVisitanteModel = new Visitante(); Foto oFotoModel = new Foto(); oVisitanteModel.visitanteId = Convert.ToInt32(item["VisitanteId"]); oVisitanteModel.visitanteNome = item["VisitanteNome"].ToString(); oVisitanteModel.visitanteRG = item["VisitanteRG"].ToString(); oVisitanteModel.visitanteTipo = item["VisitanteTipo"].ToString(); oFotoModel.idFoto = Convert.ToInt32(item["ID_FOTO"]); oVisitanteModel.idFoto = oFotoModel; oListVisitante.Add(oVisitanteModel); } return oListVisitante; }
/// <summary> /// Recupera imagem do banco de dados. /// </summary> /// <param name="foto">Foto a ser recuperada.</param> private void RecuperarImagem(Foto foto) { bool existe; try { existe = imagens.Images.ContainsKey(foto.Código.ToString()); } catch (ArgumentOutOfRangeException) { existe = false; } if (!existe) { lock (cargaFotos) cargaFotos.AddFirst(foto); if (!bgRecuperação.IsBusy) bgRecuperação.RunWorkerAsync(); } }