protected void sendPicture(object sender, EventArgs e) { int ID = int.Parse(Request.QueryString["ID"]); int numb = PictureFactory.numberOfPictures(ID, ((Logements)Master).CnnStr); if (numb < 5) { byte[] imageData = FileUpload1.FileBytes; PictureFactory.Insert(imageData, ID, ((Logements)Master).CnnStr); fillGrid(); pictureAdded.Visible = true; pictureFailed.Visible = false; } else { pictureAdded.Visible = false; pictureFailed.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["number"] != null) { Response.ContentType = "image/jpeg"; byte[] imageBlob = PictureFactory.GetOnePictureBlob(int.Parse(Request.QueryString["number"]), ((Logements)Master).CnnStr); Response.BinaryWrite(imageBlob); } if (Request.QueryString["Chambre"] != null) { Response.ContentType = "image/jpeg"; if (PictureFactory.numberOfPictures(int.Parse(Request.QueryString["Chambre"]), ((Logements)Master).CnnStr) != 0) { Picture pic = PictureFactory.GetFirstImage(int.Parse(Request.QueryString["Chambre"]), ((Logements)Master).CnnStr); Response.BinaryWrite(pic.ImageData); } else { Response.Redirect("images/defaut_image.gif"); } } }