1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| protected void Page_Load(object sender, EventArgs e)
{
string contrat = Session["contrat"].ToString();
capture.Visible = true;
visu.Visible = true;
connexion con = new connexion();
List<string> paths = new List<string>();
int nbrphoto = con.countphoto(contrat);
string img1="";
string img2="";
string img3="";
string img4="";
con.closeconnexion();
if(nbrphoto==0)
{
visu.Visible = true;
SqlDataReader path = con.getpathphoto(contrat);
if(path.HasRows)
{
while(path.Read())
{
img1 = path.GetString(0);
img2 = path.GetString(1);
img3 = path.GetString(2);
img4 = path.GetString(3);
}
paths.Add(img1);
paths.Add(img2);
paths.Add(img3);
paths.Add(img4);
}
}
else if(nbrphoto==1)
{
capture.Visible = true;
}
else
{
MessageBox.Show("erreur lors du chargement de la page");
}
if(!IsPostBack)
{
string htmlforImages = string.Empty;
for(int i=0; i< paths.Count;i++ )
{
htmlforImages += "<img src=" + paths[i].ToString() + "/>";
}
visu.InnerHtml = htmlforImages;
Image1.ResolveUrl(img1);
Image2.ImageUrl = img1;
Image3.ImageUrl = img3;
Image4.ImageUrl = img4;
}
} |
Partager