protected void cargarDataTableImagenes() { funcionesJuegos fJue = new funcionesJuegos(); AccesoDatos ds = new AccesoDatos(); DataTable tabla = new DataTable(); tabla = (DataTable)Session["Juego"]; string codJuego = tabla.Rows[0][0].ToString(); tabla = ds.ObtenerTabla("Imagenes", "SELECT codImagen, rutaImagen, primeraImagen FROM Imagenes WHERE CodJuego = '" + codJuego + "'"); if (Session["Imagenes"] == null) { Session["Imagenes"] = fJue.crearTablaImagenes(); } byte[] bytesImagen = null; int i = 1; foreach (DataRow row in tabla.Rows) { string rutaImagen = AppDomain.CurrentDomain.BaseDirectory + row[1].ToString().Remove(0, 2).Replace('/', '\\'); bytesImagen = File.ReadAllBytes(rutaImagen); fJue.AgregarFilaImagenes((DataTable)Session["Imagenes"], row[0].ToString(), row[1].ToString(), (bool)row[2], bytesImagen); if ((bool)row[2]) { lbl_portada.Text = i.ToString(); } i++; } }
protected void cargarSessionImagenes(string rutaImagen, FileUpload file) { funcionesJuegos fJue = new funcionesJuegos(); if (Session["Imagenes"] == null) { Session["Imagenes"] = fJue.crearTablaImagenes(); } fJue.AgregarFilaImagenes((DataTable)Session["Imagenes"], "null", rutaImagen, false, file.FileBytes); }