private void CargarImagen(int lIdInforme, int lNroImagen) { string vImagen = "/img/shim.gif"; ImagenDal imagen = new ImagenDal(); imagen.Cargar(lIdInforme, lNroImagen); if (imagen.Path != "") { vImagen = imagen.Path; } //else //imgFoto.BorderWidth = 0; if (lNroImagen == 1) { imgFoto.ImageUrl = vImagen; imgFoto.ToolTip = imagen.Descripcion; if (vImagen == "/img/shim.gif") { imgFoto.Visible = false; } } if (lNroImagen == 2) { imgFoto2.ImageUrl = vImagen; imgFoto2.ToolTip = imagen.Descripcion; if (vImagen == "/img/shim.gif") { imgFoto2.Visible = false; } } }
private void CargarImagenes() { ImagenDal imagenDal = new ImagenDal(); dgImagenes.DataSource = imagenDal.Listar(intIdInforme).DefaultView; dgImagenes.DataBind(); }
private void CargarImagen(int lIdInforme) { ImagenDal imagen = new ImagenDal(); imagen.Cargar(lIdInforme); imgFoto.ImageUrl = imagen.Path; imgFoto.ToolTip = imagen.Descripcion; }
private void CargarImagen(ImagenDal lData) { txtDescripcion.Text = lData.Descripcion; //txtAncho.Text = lData.Width.ToString(); //txtAlto.Text = lData.Height.ToString(); chkPredeterminada.Checked = lData.Predeterminada; lblImagen.Text = "<a href=\"#\" onClick=\"Javascript:Mostrar('" + lData.Path + "')\">" + lData.Path + "</a>"; lblImagen.Visible = true; txtImagen.Visible = false; ViewState["NroImagen"] = lData.NumeroImagen; btnAceptar.Text = "Guardar"; reqTxtImagen.Enabled = false; }
private void CargarImagen() { string vImagen = "/img/shim.gif"; ImagenDal imagen = new ImagenDal(); imagen.Cargar(int.Parse(idInforme.Value)); if (imagen.Path != "") { vImagen = imagen.Path; } else { imgFoto.BorderWidth = 0; } imgFoto.ImageUrl = vImagen; imgFoto.ToolTip = imagen.Descripcion; }
private void CargarImagenes() { ImagenDal imagenDal = new ImagenDal(); //dgImagenes.DataSource = imagenDal.Listar(intIdInforme).DefaultView; //dgImagenes.DataBind(); //if (dgImagenes.Items.Count == 0) rpGaleriaImagenes.DataSource = imagenDal.Listar(intIdInforme); rpGaleriaImagenes.DataBind(); if (rpGaleriaImagenes.Items.Count == 0) { chkPredeterminada.Checked = true; } else { chkPredeterminada.Checked = false; } }
private void dgImagenes_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.Item.Cells[0].Text != "") { ImagenDal imagenDal = new ImagenDal(); imagenDal.Cargar(intIdInforme, int.Parse(e.Item.Cells[0].Text)); switch (((ImageButton)e.CommandSource).CommandName) { case "Predeterminar": imagenDal.Predeterminada = true; imagenDal.Modificar(); CargarImagenes(); break; case "Editar": CargarImagen(imagenDal); break; } } }
/* * protected void Item_Bound(Object sender, DataListItemEventArgs e) * { * * if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) * { * ((Image)e.Item.FindControl("imgPropiedad")).ImageUrl = ((DataRowView)e.Item.DataItem).Row.ItemArray[2].ToString(); * ((Image)e.Item.FindControl("imgPropiedad")).Width = 200; * ((Label)e.Item.FindControl("lblDescripcion")).Text = ((DataRowView)e.Item.DataItem).Row.ItemArray[1].ToString(); * } * //((Label)e.Item.FindControl("lblFecha")).Text = ((DataRowView)e.Item.DataItem).Row.ItemArray[7].ToString(); * }*/ protected void rpGaleriaImagenes_ItemCommand(object source, RepeaterCommandEventArgs e) { if (((HiddenField)e.Item.FindControl("hdImagen")).Value != "") { ImagenDal imagenDal = new ImagenDal(); imagenDal.Cargar(intIdInforme, int.Parse(((HiddenField)e.Item.FindControl("hdImagen")).Value)); switch (((ImageButton)e.CommandSource).CommandName) { case "Predeterminar": imagenDal.Predeterminada = true; imagenDal.Modificar(); CargarImagenes(); break; case "Editar": CargarImagen(imagenDal); break; } } }
protected void AceptarFinalizar_Click(object sender, System.EventArgs e) { EncabezadoApp oEncabezado = new EncabezadoApp(); oEncabezado.cargarEncabezado(int.Parse(idInforme.Value)); if (oEncabezado.ConFoto == 1 && ImagenDal.NextImage(int.Parse(idInforme.Value)) == 1) { lblMessage.Visible = true; } else { string strScript; strScript = "<script languaje=\"Javascript\">"; strScript += "window.showModalDialog('/BandejaEntrada/PopUpCambioEstado.aspx?idTipo=5&idInforme=" + idInforme.Value + "&Finalizar=1','','dialogWidth:400px;dialogHeight:250px');"; strScript += "document.location.href = '/BandejaEntrada/Principal.aspx?idTipo=5'"; strScript += "</script>"; ActualizarInforme(); Page.RegisterStartupScript("CambiarEstado", strScript); } }
private void UploadFile(ref string strFileName) { if (txtImagen.PostedFile != null) { string strPath = ConfigurationSettings.AppSettings["PATH"] + "Verificaciones/"; HttpPostedFile myFile = txtImagen.PostedFile; // Obtengo el tamaño del archivo int nFileLen = myFile.ContentLength; // Me aseguro que el tamaño del archivo sea > 0 if (nFileLen > 0) { // Coloco la Info en un Buffer y para luego leerla byte[] myData = new byte[nFileLen]; // La Info a Subir myFile.InputStream.Read(myData, 0, nFileLen); // Nombre del Archivo a Subir strFileName = ImagenDal.NextImage(intIdInforme) + Path.GetExtension(myFile.FileName); strPath = ChequearCarpeta(strPath); strFileName = strPath + "/" + strFileName; // Escribo en disco WriteToFile(Server.MapPath(strFileName), ref myData); /* * Image imgPhotoVert = Image.FromFile(Server.MapPath(strFileName)); * Image imgPhoto = null; * * imgPhoto = FixedSize(imgPhotoVert, 200, 200); * imgPhoto.Save(Server.MapPath(strFileName) + @"\imageresize_3.jpg", ImageFormat.Jpeg); * imgPhoto.Dispose(); */ } } }
protected void btnAceptar_Click(object sender, EventArgs e) { ImagenDal imagen = new ImagenDal(); string strPath = ""; if (ViewState["NroImagen"] != null) { imagen.Cargar(intIdInforme, (int)ViewState["NroImagen"]); } else { strPath = SubirArchivo(); } imagen.Descripcion = txtDescripcion.Text; try { imagen.Width = 0; imagen.Height = 0; } catch { } imagen.Predeterminada = chkPredeterminada.Checked; if (ViewState["NroImagen"] != null) { imagen.Modificar(); } else { imagen.Crear(intIdInforme, strPath); } LimpiarForm(); CargarImagenes(); }