Vous êtes sur la page 1sur 64

UUNNIIVVEERRSSIITTÉÉ AANNTTOONNIINNEE Faculté d’ingénieurs en Informatique, Multimédia, Réseaux & Télécommunications

Multimédia, Réseaux & Télécommunications Miss Lebanon Contest Matière : Application Web avec C#

Miss Lebanon Contest

Matière : Application Web avec C#

Effectué par :

NOM Prénom

MATTA Elie

et al.

INF#

Privacy

applied

Copyright © 2010-2011, eliematta.com. All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

On va introduire dans ce rapport les différentes étapes qu’on a suivi avec des exemples et des images :

Master Page :

a suivi avec des exemples et des images : Master Page : Copyright © 2010-2011, eliematta.com
a suivi avec des exemples et des images : Master Page : Copyright © 2010-2011, eliematta.com
a suivi avec des exemples et des images : Master Page : Copyright © 2010-2011, eliematta.com

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

Dans cette page on a mis un contentplaceholder dans lequel vont ouvrir les pages secondaires du website. L’autre partie ne change pas de page en page. Elle contient des links vers des pages contenant :

Des informations sur les professeurs ;

Des conseils pour la beauté ;

Les sponsors ;

Des informations concernant les concurrentes avec un gallery ;

Le box du login et logout ;

Des informations a propos des jurées ;

Un bouton home menant a la page principale ;

Un contact us pour nous donner tous les commentaires.

Deux panels servent a la démarche d’authentification :

La première contient le username et le password avec un login button qui est visible par défaut. Si l’authentification est correcte ce dernier panel sera invisible et un autre contenant le logout button apparait.

MasterPage.master.cs :

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;

public partial class MasterPage : System.Web.UI.MasterPage

{

string userid;

protected void Page_Load(object sender, EventArgs e)

{

if (Session["user"] == null)

{

EventArgs e) { if (Session[ "user" ] == null ) { Copyright © 2010-2011, eliematta.com .
EventArgs e) { if (Session[ "user" ] == null ) { Copyright © 2010-2011, eliematta.com .

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

Panel1.Visible = true; Panel2.Visible = false;

}

else

{

Panel1.Visible = false; Panel2.Visible = true;

}

}

protected void LinkButton1_Click1(object sender, EventArgs e)

{

user u = new user(); u.username = TextBox1.Text; u.password = TextBox2.Text;

if (u.login())

{

Panel1.Visible = false; Panel2.Visible = true; Session.Add("user", u); Response.Redirect("Juree_Login.aspx");

}

}

protected void TextBox2_TextChanged(object sender, EventArgs e)

{

}

protected void TextBox1_TextChanged(object sender, EventArgs e)

{

}

protected void LinkButton3_Click(object sender, EventArgs e)

{

Panel1.Visible = true; Panel2.Visible = false; Session.Remove("user"); Response.Redirect("Default.aspx");

}

protected void LinkButton2_Click(object sender, EventArgs e)

{

Response.Redirect("Juree_Login.aspx");

}

}

e) { Response.Redirect( "Juree_Login.aspx" ); } } Copyright © 2010-2011, eliematta.com . All rights reserved
e) { Response.Redirect( "Juree_Login.aspx" ); } } Copyright © 2010-2011, eliematta.com . All rights reserved
e) { Response.Redirect( "Juree_Login.aspx" ); } } Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

MasterPage.master.aspx

<%
<%

@ Master Language="C#" AutoEventWireup="true"

CodeFile="MasterPage.master.cs" Inherits="MasterPage"

%>
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>.:: Miss Lebanon 2009 ::.</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript"> // <!CDATA[

function P1_onclick() {

}

function Text1_onclick() {

}

// ]]>

</script>

</head>

<body> <form id="form1" runat="server"> <div id="topheader"> <div class="topmenu_area"><a href="Default.aspx" class="home">Home</a> <a href="Aboutus.aspx" class="about">About</a> <a href="jurylist.aspx" class="search">Jury</a> </div> <div class="banner_textarea" style="width: 494px"> <p class="banner_head">A lucky girl will be wearing a crown and the title of Miss Lebanon 2009 this Year! Who will this beauty be? </p> <p>Miss Lebanon is the only national beauty contest that awards prizes worth more than half a million US dollars to its winners. Keep on joining this website to vote for your favorite participant.</p> </div> <div class="search_menu_banner"> <div class="menu_area"><a href="gallery.aspx" class="addidea">Gallery</a> <a href="news.aspx" class="loginhere">News</a> <a href="comments.aspx" class="comments">Comments</a> <a href="Contactus.aspx" class="contact">Contact Us </a></div> </div> </div> <div id="body_area"> <div class="left"> <div class="morelinks_top"></div>

div class ="morelinks_top"></ div > Copyright © 2010-2011, eliematta.com . All rights reserved
div class ="morelinks_top"></ div > Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

<div class="morelinks_area"> <div class="morelinks_head">More Links </div> <div class="links_morearea"><a href="Default.aspx" class="morelink">Home<span class="links_text"> </span></a> <a href="Contest.aspx" class="morelink">The contest <span class="links_text"> </span></a> <a href="Beautytip.aspx" class="morelink">Beauty Tips<span class="links_text"></span></a> <a href="Membersarea.aspx" class="morelink">Teachers<span class="links_text"></span></a> <br /> <a href="sponsors.aspx" class="morelink">Other Sponsors<span class="links_text"></span></a> <br /> <br /> <table> <tr><td></td> <td></td> <td> <asp:Image ID="Image1" runat="server" ImageUrl="~/images/image11.jpg" Height="45px" Width="32px" /><br /> </td> <td style="width: 30px"> <asp:Image ID="Image2" runat="server" ImageUrl="~/images/image12.jpg" Height="45px" Width="32px" /><br /> </td> <td>

<asp:Image ID="Image3" runat="server" ImageUrl="~/images/image13.jpg" Height="45px" Width="32px" /></td> <td>

<asp:Image ID="Image4" runat="server" ImageUrl="~/images/image14.jpg" Height="45px" Width="32px" /></td> <td>

<asp:Image ID="Image5" runat="server" ImageUrl="~/images/image15.jpg" Height="45px" Width="32px" /></td> </tr> <tr> <td></td><td></td> <td>

<asp:Image ID="Image6" runat="server" ImageUrl="~/images/image16.jpg" Height="45px" Width="32px" /></td> <td style="width: 30px"> <asp:Image ID="Image7" runat="server" ImageUrl="~/images/image17.jpg" Height="45px" Width="32px" /></td> <td>

<asp:Image ID="Image8" runat="server" ImageUrl="~/images/image18.jpg" Height="45px" Width="32px" /></td> <td>

<asp:Image ID="Image9" runat="server" ImageUrl="~/images/image19.jpg" Height="45px" Width="32px" /></td> <td>

<asp:Image ID="Image10" runat="server" ImageUrl="~/images/image20.jpg" Height="45px" Width="32px" /></td>

="45px" Width ="32px" /></ td > Copyright © 2010-2011, eliematta.com . All rights reserved
="45px" Width ="32px" /></ td > Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

</tr>

<tr>

<td></td><td></td>

<td>

<asp:Image ID="Image11" runat="server" ImageUrl="~/images/image8.jpg" Height="45px" Width="32px" /></td> <td style="width: 30px"> <asp:Image ID="Image12" runat="server" ImageUrl="~/images/image4.jpg" Height="45px" Width="32px" /></td> <td>

<asp:Image ID="Image13" runat="server" ImageUrl="~/images/image21.jpg" Height="45px" Width="32px" /></td> <td>

<asp:Image ID="Image14" runat="server" ImageUrl="~/images/image22.jpg" Height="45px" Width="32px" /></td> <td>

<asp:Image ID="Image15" runat="server" ImageUrl="~/images/image23.jpg" Height="45px" Width="32px" /></td> </tr> </table> </div> </div> <div class="morelinks_bottom"></div> </div> <div class="body_area1"> <div class="mid"> &nbsp;<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> <div class="right"> <div class="right_area"> <div class="right_top"></div> <div class="right_head"> <div class="morelinks_head">Sponsors </div> </div> <asp:Image ID="Image16" runat="server" ImageUrl="~/images/sponsors.gif" Height="210px" Width="195px" /> </div> <div class="right_bottom"></div> </div> </div> </div>

<div class="body_areabackground"> <div id="body_area1"> <div class="inner_tabarea"> <div class="inner_menu"> <div align="center"><a href="#" class="innermenu_hover">Features</a>

</div> </div> <div class="tab_text"> <p class="tab_head">To know more about them!</p>

To know more about them! </ p > Copyright © 2010-2011, eliematta.com . All rights reserved
To know more about them! </ p > Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

<p><a href="gabriellebourached.aspx" ><span class="tab_head1">Gabrielle Bou Rached</span></a><br /> <a href="gabriellebourached.aspx" class="tablink">Gabrielle Bou Rached</a> was crowned Miss Campus of USJ University Beirut, she represented </p> </div> <div class="tab_readmore"> <p align="right" class="tab_head"><a href="gabriellebourached.aspx" class="readmore">Read More </a></p> </div> <div class="tab_text"> <p><a href="georginarizk.aspx" ><span class="tab_head1">Georgina Rizk</span></a><br /> In the 1972 Miss Universe pageant in Dorado, Puerto Rico, the 1971 winner, <a href="georginarizk.aspx" class="tablink">Georgina Rizk</a>, was

not allowed to attend

</div> <div class="tab_readmore"> <p align="right" class="tab_head"><a href="georginarizk.aspx" class="readmore">Read More </a></p> </div> </div> <div class="login_area"> <asp:Panel ID="Panel2" runat="server" Visible="False" Height="33px"

Width="288px">

</p>

<div class="login_head" style="height: 27px">Welcome Jury</div> <br />&nbsp;&nbsp;&nbsp;We present to you the voting for the <br />&nbsp;&nbsp;&nbsp;official Miss Lebanon 2009! You are ready <br />&nbsp;&nbsp;&nbsp;to start voting. <br /><br />&nbsp;&nbsp;&nbsp;<a href="Juree_Login.aspx"><asp:LinkButton ID="LinkButton2" runat="server">Click here</asp:LinkButton></a> to see your information<br /><br /> <div class="login_textarea" style="height: 17px"> <asp:LinkButton ID="LinkButton3" CssClass="login" runat="server" Height="20px" OnClick="LinkButton3_Click"

Width="70px">Logout</asp:LinkButton>

</div>

</asp:Panel>

<asp:Panel ID="Panel1" runat="server" Height="1px" Width="286px">

<div class="login_head" style="height: 27px">Already a Member ?</div> <div class="login_textarea" style="height: 33px"> <div class="login_name">Your Name </div> <div class="login_box"> <label> &nbsp; <asp:TextBox ID="TextBox1" runat="server" Width="160px"

OnTextChanged="TextBox1_TextChanged"></asp:TextBox></label></div>

</div> <div class="login_textarea" style="height: 33px"> <div class="login_name">Password </div>

class ="login_name"> Password </ div > Copyright © 2010-2011, eliematta.com . All rights reserved
class ="login_name"> Password </ div > Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

<div class="login_box"> <label> &nbsp;<asp:TextBox ID="TextBox2" runat="server" Width="160px"

OnTextChanged="TextBox2_TextChanged"

TextMode="Password"></asp:TextBox></label></div> </div> <div class="login_textarea" style="height: 17px"> <asp:LinkButton ID="LinkButton1" CssClass="login" runat="server" Height="20px" OnClick="LinkButton1_Click1"

Width="50px">Login</asp:LinkButton></div>

</asp:Panel> </div> <div class="toolfree_area"> <div class="facing"></div> <div class="bookmark">For more information</div> <div class="call_free"><span class="callus">Call Us</span> <span class="callno">+01-444-333<br /><font size="1"> P.O.Box 14-5225 Adma, Lebanon</font></span></div> </div> </div></div> <div id="fotter"> <div id="fotter_1"> <div class="fotter_leftarea"> <div class="fotter_links"> <a href="Default.aspx" class="fotterlink">Home</a> | <a href="Aboutus.aspx" class="fotterlink">About Us</a> | <a href="sponsors.aspx" class="fotterlink">Sponsors</a> | <a href="Contactus.aspx" class="fotterlink">Contact</a> </div> <div class="fotter_designed">Designed by: Elie Matta et al.</div> </div> <div class="fotter_rightarea"> <div class="fotter_copyrights">Copyright © Miss Lebanon 2009. All rights reserved. Managed by E.K & E.M S.A.R.L<br /></div> </div> </div> </div> </form> </body> </html>

> </ form > </ body > </ html > Copyright © 2010-2011, eliematta.com . All
> </ form > </ body > </ html > Copyright © 2010-2011, eliematta.com . All

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

Default :

par Elie Matta et al. Miss Lebanon Contest Default : Default est la page principale du

Default est la page principale du site et qui est la première a être ouverte lors de l’exécution du programme. Elle contient un texte qui nous explique a propos du site.

Default.aspx

<%
<%

@ Page Language="C#" MasterPageFile="~/MasterPage.master"

AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"

Title="Untitled Page"

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

%>
%>
Runat ="Server"> %> Copyright © 2010-2011, eliematta.com . All rights reserved
Runat ="Server"> %> Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

<div class="tick_head">Welcome to <span class="tick_head1">"Miss Lebanon on line"</span> competition!</div> <p dir="ltr"><font face="Arial" color ="#3b3b3b" size="3">To participate please send us your application with some revealing photos and if acceptable we will arrange for professional photos to be taken at our expense.<br/><br/> We provide a total of more than one Million dollars in cash prizes, modeling contacts and scholarships for winners. Also we provide free accommodation for all our contestants as well as spending money when they arrive to the actual live competition following the online competition.</font></p> </asp:Content>

Default.apx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page

{

 

protected void Page_Load(object sender, EventArgs e)

{

}

}

Page_Load( object sender, EventArgs e) { } } Copyright © 2010-2011, eliematta.com . All rights reserved
Page_Load( object sender, EventArgs e) { } } Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

Jurelogin

par Elie Matta et al. Miss Lebanon Contest Jurelogin Suite a l’authentificatio n on aboutit a

Suite a l’authentification on aboutit a une page nommée Juree_Login où apparait la photo du jure qui est logged in avec des informations de ce dernier qui sont présents suite a une connexion a la data base. Un bouton liste des concurrents est présent au-dessous de ces informations menant a la page concurrents

Juree_Login.aspx

<%
<%

@ Page Language="C#" MasterPageFile="~/MasterPage.master"

AutoEventWireup="true" CodeFile="Juree_Login.aspx.cs" Inherits="Juree_Login"

Title="Untitled Page"

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <p dir="ltr"><font face="Arial" color ="#3b3b3b" size="3"> <asp:Image ID="Image1" runat="server" Width="150" Height="180" /></font></p> <p dir="ltr">

%>
%>
></ p > < p dir ="ltr"> %> Copyright © 2010-2011, eliematta.com . All rights reserved
></ p > < p dir ="ltr"> %> Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

<font color="#3b3b3b" face="Arial" size="3"> <asp:Label ID="Label1" runat="server" Text=""></asp:Label><br /> <asp:Label ID="Label2" runat="server" Text=""></asp:Label><br /> <asp:Label ID="Label3" runat="server" Text=""></asp:Label><br /> <asp:Label ID="Label4" runat="server" Text=""></asp:Label><br /> <asp:Label ID="Label5" runat="server" Text=""></asp:Label><br /> <asp:Label ID="Label6" runat="server" Text=""></asp:Label><br /> <asp:Label ID="Label7" runat="server" Text=""></asp:Label><br />

</font>&nbsp;</p> <asp:Button ID="Button1" runat="server" Text="List of the contestants" OnClick="Button1_Click" /> </asp:Content>

Juree_Login.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;

public partial class Juree_Login : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (Session["user"] == null)

{

Response.Redirect("Error_Login.aspx");

}

user u = (user)Session["user"]; Label1.Text = "Nom: " + u.nom + " "; Label2.Text = "Prenom: " + u.prenom + " "; Label3.Text = "Sexe: " + u.sexe + " "; Label4.Text = "Profession: " + u.profession + " "; Label5.Text = "Telephone: " + u.telephone + " ";

Label6.Text = "E-Mail: " + u.mail + " "; Label7.Text = "Adresse: " + u.adresse + " "; Image1.ImageUrl = u.image;

}

protected void Button1_Click(object sender, EventArgs e)

{

void Button1_Click( object sender, EventArgs e) { Copyright © 2010-2011, eliematta.com . All rights reserved
void Button1_Click( object sender, EventArgs e) { Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

Response.Redirect("concurrent.aspx"); //Response.Redirect("concurrents.aspx?conid=" + id);

}

}

Concurrents :

+ id); } } Concurrents : Cette page contient un grid view qui amène de la

Cette page contient un grid view qui amène de la data base toutes les concurrentes présentes avec les informations sélectionnées de chacune. Le link select nous mène a une page nommée miss qui contient des informations de chaque concurrentes selon le link sélectionné.

Concurrent.aspx:

<%
<%

@ Page Language="C#" MasterPageFile="~/MasterPage.master"

AutoEventWireup="true" CodeFile="concurrent.aspx.cs" Inherits="concurent"

Title="Untitled Page"

%>
%>
="concurent" Title ="Untitled Page" %> Copyright © 2010-2011, eliematta.com . All rights reserved
="concurent" Title ="Untitled Page" %> Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:GridView ID="GridView1" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" AutoGenerateSelectButton="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Width="500px" AllowSorting="True" Height="212px" > <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /> <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /> <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White"

/>

</asp:GridView>

</asp:Content>

Concurrent.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections.Generic;

public partial class concurent : System.Web.UI.Page

{

string conid;

protected void Page_Load(object sender, EventArgs e)

{

Database db = new Database("Enquete.mdb"); string query = "Select * from Concurrent";

DataSet ds = db.select(query); DataTable dt = ds.Tables[0]; string queryEtape = "Select DISTINCT(etapeID) from Resultat"; DataSet dsEtape = db.select(queryEtape); DataTable dtEtape = dsEtape.Tables[0]; string queryEtape2 = "Select etapeID from Resultat"; DataSet dsEtape2 = db.select(queryEtape2); DataTable dtEtape2 = dsEtape2.Tables[0]; ArrayList arOne = new ArrayList(); List<ArrayList> listAll = new List<ArrayList>(); string etapIDForResult = ""; if (dtEtape.Rows.Count > 1 || dtEtape2.Rows.Count == 30)

{

(dtEtape.Rows.Count > 1 || dtEtape2.Rows.Count == 30) { Copyright © 2010-2011, eliematta.com . All rights reserved
(dtEtape.Rows.Count > 1 || dtEtape2.Rows.Count == 30) { Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

if (dtEtape2.Rows.Count != 30 && dtEtape2.Rows.Count != 51 && dtEtape2.Rows.Count != 66)

{

etapIDForResult = dtEtape.Rows[0][0].ToString(); for (int i = 0; i < dtEtape.Rows.Count; i++)

{

if (dtEtape.Rows[i][0].ToString().CompareTo(etapIDForResult) == 1) etapIDForResult = dtEtape.Rows[i][0].ToString();

}

if (etapIDForResult == "3- Mesure et poids") etapIDForResult = "2 -Beaute";

else if (etapIDForResult == "4

-Questions generales")

etapIDForResult = "3- Mesure et poids";

}

else if (dtEtape2.Rows.Count == 30)

{

etapIDForResult = "2 -Beaute";

}

else if (dtEtape2.Rows.Count == 51)

{

etapIDForResult = "3- Mesure et poids";

}

else if (dtEtape2.Rows.Count == 66)

{

 

etapIDForResult = "4

-Questions generales";

}

for (int i = 0; i < dt.Rows.Count; i++)

{

int finalnote = getConNoteByID(dt.Rows[i][0].ToString(), etapIDForResult); ArrayList listOne = new ArrayList(); listOne.Add(finalnote.ToString());

listOne.Add(dt.Rows[i][0].ToString());

listAll.Add(listOne);

}

List<ArrayList> listAllSorted = listAll; for (int i = 0; i < listAll.Count; i++)

{

for (int j = i + 1; j < listAll.Count; j++)

{

if (Convert.ToInt32(listAll[j][0]) >

Convert.ToInt32(listAllSorted[i][0]))

{

ArrayList tempList = listAllSorted[i]; listAllSorted[i] = listAll[j]; listAllSorted[j] = tempList;

}

}

}

= listAll[j]; listAllSorted[j] = tempList; } } } Copyright © 2010-2011, eliematta.com . All rights reserved
= listAll[j]; listAllSorted[j] = tempList; } } } Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

string qFinal = "Select conid, nom, prenom, lieu_naiss,

date_naiss from

Concurrent where ";

if (Convert.ToInt32(etapIDForResult.Substring(0, 1).ToString())

== 2)

{

for (int i = 0; i < listAllSorted.Count - 3; i++)

{

if (i == 0)

{

qFinal = qFinal + "conid = '" +

listAllSorted[i][1].ToString() + "' ";

}

else

{

qFinal = qFinal + "or conid = '" + listAllSorted[i][1].ToString() + "' ";

}

}

}

else if (Convert.ToInt32(etapIDForResult.Substring(0, 1).ToString()) == 3)

{

for (int i = 0; i < listAllSorted.Count - 5; i++)

{

if (i == 0)

{

qFinal = qFinal + "conid = '" +

listAllSorted[i][1].ToString() + "' ";

}

else

{

qFinal = qFinal + "or conid = '" +

listAllSorted[i][1].ToString() + "' ";

}

}

}

else if (Convert.ToInt32(etapIDForResult.Substring(0,

1).ToString()) == 4)

{

for (int i = 0; i < listAllSorted.Count - 7; i++)

{

if (i == 0)

{

qFinal = qFinal + "conid = '" +

listAllSorted[i][1].ToString() + "' ";

}

else

{

qFinal = qFinal + "or conid = '" +

listAllSorted[i][1].ToString() + "' ";

}

}

+ listAllSorted[i][1].ToString() + "' " ; } } Copyright © 2010-2011, eliematta.com . All rights reserved
+ listAllSorted[i][1].ToString() + "' " ; } } Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

}

DataSet dss = db.select(qFinal); DataTable dtt = dss.Tables[0];

int aaa = dtt.Rows.Count; GridView1.DataSource = dtt;

GridView1.DataBind();

GridView1.Visible = true;

}

else

{

DataSet ds2 = db.select("SELECT conid, nom, prenom, lieu_naiss, date_naiss FROM Concurrent"); DataTable dt2 = ds2.Tables[0];

GridView1.DataSource = dt2;

GridView1.DataBind();

}

}

private int getConNoteByID(string conId, string etapeID)

{

Database db = new Database("Enquete.mdb"); string q = "Select Notes from Resultat where conId = '" + conId + "' and etapeID = '" + etapeID + "'"; DataSet ds = db.select(q); DataTable dt = ds.Tables[0]; int finalNote = 0; if (dt.Rows.Count > 0)

{

for (int i = 0; i < dt.Rows.Count; i++)

{

finalNote = finalNote +

Convert.ToInt32(dt.Rows[i][0].ToString());

}

finalNote = finalNote / dt.Rows.Count;

}

return finalNote;

}

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)

{

Session["conid"] = GridView1.SelectedRow.Cells[1].Text; if (Session["conid"] != null)

{

user connecteduser = (user)Session["user"]; Database db = new Database("Enquete.mdb"); DataSet ds1 = db.select("SELECT DISTINCT(etapeID) FROM

Resultat");

DataTable dt1 = ds1.Tables[0]; DataSet ds2 = db.select("SELECT etapeID FROM Resultat");

ds2 = db.select( "SELECT etapeID FROM Resultat" ); Copyright © 2010-2011, eliematta.com . All rights reserved
ds2 = db.select( "SELECT etapeID FROM Resultat" ); Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

DataTable dt2 = ds2.Tables[0]; string etapeID = "2 -Beaute"; if (dt2.Rows.Count == 30)

{

etapeID = "3- Mesure et poids"; Session["etapeID"] = etapeID;

}

else if (dt2.Rows.Count == 51)

{

 

etapeID = "4

-Questions generales";

Session["etapeID"] = etapeID;

}

else if (dt2.Rows.Count == 66)

{

return;

}

else if (dt1.Rows.Count > 0)

{

etapeID = dt1.Rows[0][0].ToString();

for (int i = 0; i < dt1.Rows.Count; i++)

{

if (dt1.Rows[i][0].ToString().CompareTo(etapeID) == 1) etapeID = dt1.Rows[i][0].ToString();

}

Session["etapeID"] = etapeID; string a = "SELECT * FROM Resultat WHERE etapeID= '" +

etapeID + "' and conID = '" + Session["conid"].ToString() + "' and userid = " + connecteduser.userid; DataSet ds3 = db.select(a); DataTable dt3 = ds3.Tables[0]; if (dt3.Rows.Count > 0)

{

Panel1.Visible = true; return;

}

}

Response.Redirect("miss.aspx?conid" + conid);

}

}

}

"miss.aspx?conid" + conid); } } } Copyright © 2010-2011, eliematta.com . All rights reserved
"miss.aspx?conid" + conid); } } } Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

Miss :

Préparé par Elie Matta et al. Miss Lebanon Contest Miss : Cette page permet de voire

Cette page permet de voire une photo de la concurrentes sélectionnée avec toutes les informations nécessaires pour le vote suivies d’un bouton vote menant à la page dédiée au vote.

Miss.aspx

<%
<%

@ Page Language="C#" MasterPageFile="~/MasterPage.master"

AutoEventWireup="true" CodeFile="miss.aspx.cs" Inherits="miss1"

Title="Untitled Page"

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <script language="javascript" type="text/javascript"> // <!CDATA[

%>
%>

function TABLE1_onclick() {

}

// ]]>

</script>

TABLE1_onclick() { } // ]]> </ script > Copyright © 2010-2011, eliematta.com . All rights reserved
TABLE1_onclick() { } // ]]> </ script > Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

<br /><br /> <asp:Image ID="Image1" runat="server" width="163px" Height="172px" />&nbsp; <table id="TABLE1" onclick="return TABLE1_onclick()"> <tr> <td> <asp:Label ID="Label9" runat="server" Text="First Name"></asp:Label></td> <td><asp:Label ID="Label1" runat="server"></asp:Label><br /> </td></tr> <tr><td> <asp:Label ID="Label10" runat="server" Text="Last Name"></asp:Label></td> <td> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> </td></tr> <tr><td> <asp:Label ID="Label11" runat="server" Text="Place of birth"></asp:Label></td> <td> <asp:Label ID="Label3" runat="server" Text="Label"></asp:Label> </td></tr> <tr><td> <asp:Label ID="Label12" runat="server" Text="Date of birth"></asp:Label></td> <td> <asp:Label ID="Label4" runat="server"></asp:Label> </td> </tr> <tr><td> <asp:Label ID="Label13" runat="server" Text="Profession"></asp:Label></td> <td> <asp:Label ID="Label5" runat="server" Text="Label"></asp:Label></td> </tr> <tr><td> <asp:Label ID="Label14" runat="server" Text="Height"></asp:Label></td> <td> <asp:Label ID="Label6" runat="server" Text="Label"></asp:Label> </td></tr> <tr><td> <asp:Label ID="Label15" runat="server" Text="Hair Color"></asp:Label></td> <td> <asp:Label ID="Label7" runat="server" Text="Label"></asp:Label> </td></tr> <tr><td> <asp:Label ID="Label16" runat="server" Text="Eye Color"></asp:Label></td> <td> <asp:Label ID="Label8" runat="server" Text="Label"></asp:Label> </td></tr> </table> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Vote" Width="65px" /> </asp:Content>

Width ="65px" /> </ asp : Content > Copyright © 2010-2011, eliematta.com . All rights reserved
Width ="65px" /> </ asp : Content > Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

Miss.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;

public partial class miss1 : System.Web.UI.Page

{

string conid;

string aaa;

protected void Page_Load(object sender, EventArgs e)

{

this.Button1.Enabled = true; if (Session["user"] == null)

{

this.Button1.Visible = false;

}

aaa = Request.Params.Get("id"); if (aaa == null)

{

conid = Session["conid"].ToString(); Database db = new Database("Enquete.mdb"); DataSet ds = db.select("SELECT * FROM Concurrent where conid='" + conid + "'"); Label1.Text = ds.Tables[0].Rows[0][1].ToString(); Label2.Text = ds.Tables[0].Rows[0][2].ToString(); Label3.Text = ds.Tables[0].Rows[0][3].ToString(); Label4.Text = ds.Tables[0].Rows[0][4].ToString(); Label5.Text = ds.Tables[0].Rows[0][6].ToString(); Label6.Text = ds.Tables[0].Rows[0][10].ToString(); Label7.Text = ds.Tables[0].Rows[0][11].ToString(); Label8.Text = ds.Tables[0].Rows[0][12].ToString(); Image1.ImageUrl = ds.Tables[0].Rows[0][7].ToString();

}

else

{

Database db = new Database("Enquete.mdb"); if (aaa == "x0010")

{

DataSet ds = db.select("SELECT * FROM Concurrent where

conid='x010'");

Label1.Text = ds.Tables[0].Rows[0][1].ToString(); Label2.Text = ds.Tables[0].Rows[0][2].ToString();

Label2.Text = ds.Tables[0].Rows[0][2].ToString(); Copyright © 2010-2011, eliematta.com . All rights reserved
Label2.Text = ds.Tables[0].Rows[0][2].ToString(); Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

Label3.Text = ds.Tables[0].Rows[0][3].ToString(); Label4.Text = ds.Tables[0].Rows[0][4].ToString(); Label5.Text = ds.Tables[0].Rows[0][6].ToString(); Label6.Text = ds.Tables[0].Rows[0][10].ToString(); Label7.Text = ds.Tables[0].Rows[0][11].ToString(); Label8.Text = ds.Tables[0].Rows[0][12].ToString(); Image1.ImageUrl = ds.Tables[0].Rows[0][7].ToString();

}

else

{

DataSet ds = db.select("SELECT * FROM Concurrent where conid='" + aaa + "'"); Label1.Text = ds.Tables[0].Rows[0][1].ToString(); Label2.Text = ds.Tables[0].Rows[0][2].ToString(); Label3.Text = ds.Tables[0].Rows[0][3].ToString(); Label4.Text = ds.Tables[0].Rows[0][4].ToString(); Label5.Text = ds.Tables[0].Rows[0][6].ToString(); Label6.Text = ds.Tables[0].Rows[0][10].ToString(); Label7.Text = ds.Tables[0].Rows[0][11].ToString(); Label8.Text = ds.Tables[0].Rows[0][12].ToString(); Image1.ImageUrl = ds.Tables[0].Rows[0][7].ToString();

}

}

}

protected void Button1_Click(object sender, EventArgs e)

{

Response.Redirect("vote.aspx?conid=" + conid);

}

protected void Button2_Click(object sender, EventArgs e)

{

if (aaa == null)

{

Database ao = new Database("Enquete.mdb"); DataSet ds = ao.select("select * from Concurrent where conid='" + conid + "'"); DataTable dt = ds.Tables[0]; int i = 2; if (dt.Rows[0]["Image"].ToString() == "images/image1.jpg")

{

while (i < 3)

{

Image1.ImageUrl = "images/nadinenjeim/image" + i; i++;

}

this.Button1.Enabled = false;

}

}

else

{

+ i; i++; } this .Button1.Enabled = false ; } } else { Copyright © 2010-2011,
+ i; i++; } this .Button1.Enabled = false ; } } else { Copyright © 2010-2011,

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

Database ao = new Database("Enquete.mdb"); DataSet ds = ao.select("select * from Concurrent where conid='" +

aaa + "'");

DataTable dt = ds.Tables[0]; int i = 1;

if (dt.Rows[0]["Image"].ToString() == "images/image1.jpg")

{

while (i < 3)

{

Image1.ImageUrl = "images/nadinenjeim/image"+i;

}

this.Button1.Enabled = false;

}

}

}

}

Vote :

+i; } this .Button1.Enabled = false ; } } } } Vote : Copyright © 2010-2011,
+i; } this .Button1.Enabled = false ; } } } } Vote : Copyright © 2010-2011,
+i; } this .Button1.Enabled = false ; } } } } Vote : Copyright © 2010-2011,

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

La page vote permet au user de voter pour chaque concurrente selon chaque critère. Trois critères sont présents permettant l’élimination de quelques filles suite a la présentation du résultat. Un bouton submit permet la disposition des données dans la data base et mène a une page étape voting.

Vote.aspx

<%
<%

@ Page Language="C#" MasterPageFile="~/MasterPage.master"

AutoEventWireup="true" CodeFile="vote.aspx.cs" Inherits="vote"

Title="Untitled Page"

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div class="tick_head">Voting: <span class="tick_head1">Steps and Criterias</span></div><br /><br /><br /><br /> <table style="width: 241px; height: 137px" border="0"> <tr> <td style="width: 3px; height: 150px; vertical-align: top;" align="left" valign="top"><asp:Label ID="lblCrit1" runat="server" /> <asp:Label ID="lblCrit1Id" runat="server" Visible="False" /></td> <td style="width: 3px; height: 150px;" valign="top"> <asp:RadioButton ID="RadioButton1" runat="server" GroupName="1" Text="excellent" /><br /> <asp:RadioButton ID="RadioButton3" runat="server" GroupName="1" Text="tresbien" /> <asp:RadioButton ID="RadioButton4" runat="server" GroupName="1" Text="bien" /> <asp:RadioButton ID="RadioButton5" runat="server" GroupName="1" Text="moyen" /> <asp:RadioButton ID="RadioButton6" runat="server" GroupName="1" Text="mauvais" /> <asp:RadioButton ID="RadioButton2" runat="server" GroupName="1" Text="nonreponse" /> </td> <td style="width: 3px; height: 150px;" align="left" valign="top"><asp:Label ID="lblCrit2" runat="server" /> <asp:Label ID="lblCrit2Id" runat="server" Text="Label" Width="54px" Visible="False"></asp:Label></td> <td style="width: 3px; height: 150px;" valign="top"><asp:RadioButton ID="RadioButton7" runat="server" GroupName="2" Text="excellent" OnCheckedChanged="RadioButton7_CheckedChanged" /><asp:RadioButton ID="RadioButton8" runat="server" GroupName="2" Text="tresbien" OnCheckedChanged="RadioButton8_CheckedChanged" /><br /> <asp:RadioButton ID="RadioButton9" runat="server" GroupName="2" Text="bien" OnCheckedChanged="RadioButton9_CheckedChanged" /><br /> <asp:RadioButton ID="RadioButton10" runat="server" GroupName="2" Text="moyen" OnCheckedChanged="RadioButton10_CheckedChanged" /><br />

%>
%>
/>< br /> %> Copyright © 2010-2011, eliematta.com . All rights reserved
/>< br /> %> Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

<asp:RadioButton ID="RadioButton11" runat="server" GroupName="2" Text="mauvais" OnCheckedChanged="RadioButton11_CheckedChanged" /><asp:RadioButton ID="RadioButton12" runat="server" GroupName="2" Text="nonreponse" OnCheckedChanged="RadioButton12_CheckedChanged" /><br />

</td> <td style="width: 3px; height: 150px;" valign="top"> <asp:Label ID="lblCrit4" runat="server" Text="Label"

Width="57px"></asp:Label>

<br /> <asp:Label ID="lblCrit4Id" runat="server" Text="Label" Visible="False"></asp:Label><br /> </td> <td style="width: 3px; height: 150px;" valign="top"> <asp:RadioButton ID="RadioButton13" runat="server"

OnCheckedChanged="RadioButton13_CheckedChanged"

Text="excellent" GroupName="3" /><br /> <asp:RadioButton ID="RadioButton14" runat="server"

OnCheckedChanged="RadioButton14_CheckedChanged"

Text="tresbien" GroupName="3" /><br /> <asp:RadioButton ID="RadioButton15" runat="server"

OnCheckedChanged="RadioButton15_CheckedChanged"

Text="bien" GroupName="3" /><br /> <asp:RadioButton ID="RadioButton16" runat="server"

OnCheckedChanged="RadioButton16_CheckedChanged"

Text="moyen" GroupName="3" /><br /> <asp:RadioButton ID="RadioButton17" runat="server"

OnCheckedChanged="RadioButton17_CheckedChanged"

Text="mauvais" GroupName="3" /><br /> <asp:RadioButton ID="RadioButton18" runat="server"

OnCheckedChanged="RadioButton18_CheckedChanged"

Text="nonreponse" GroupName="3" />

</td>

</tr>

</table> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" /><br /> </asp:Content>

Vote.aspx.cs

using System; using System.Data; using System.Configuration;

System; using System.Data; using System.Configuration; Copyright © 2010-2011, eliematta.com . All rights reserved
System; using System.Data; using System.Configuration; Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;

public partial class vote : System.Web.UI.Page

{

string etapeID = "";

protected void Page_Load(object sender, EventArgs e)

{

if (Session["etapeID"] != null)

{

 

etapeID = Session["etapeID"].ToString();

}

else

{

 

etapeID = "2 -Beaute";

}

user u = (user)Session["user"]; Database db = new Database("Enquete.mdb"); DataSet ds = db.select("SELECT etapeID FROM Resultat"); DataSet ds1 = db.select("SELECT userid FROM Resultat"); DataSet ds3 = db.select("SELECT userid FROM [user]"); DataTable dt = ds.Tables[0]; DataTable dt1 = ds1.Tables[0]; DataTable dt3 = ds3.Tables[0];

int b = Convert.ToInt32(dt1.Rows.Count); if (dt.Rows.Count <= 30)

{

DataSet ds2 = db.select("SELECT* FROM critere where etapeID='" + etapeID + "'");//like ('2%')"); DataTable dt2 = ds2.Tables[0]; lblCrit1.Text = dt2.Rows[0][2].ToString(); lblCrit1Id.Text = dt2.Rows[0][0].ToString();

lblCrit2.Text = dt2.Rows[1][2].ToString(); lblCrit2Id.Text = dt2.Rows[1][2].ToString();

lblCrit4.Text = dt2.Rows[2][2].ToString(); lblCrit4Id.Text = dt2.Rows[2][2].ToString();

}

else if ((dt.Rows.Count > 30) && (dt.Rows.Count < 51))

{

> 30) && (dt.Rows.Count < 51)) { Copyright © 2010-2011, eliematta.com . All rights reserved
> 30) && (dt.Rows.Count < 51)) { Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

DataSet ds2 = db.select("SELECT* FROM critere where etapeID ='" + etapeID + "'");//like ('3%')"); DataTable dt2 = ds2.Tables[0]; int a = dt2.Rows.Count; lblCrit1.Text = dt2.Rows[0][2].ToString(); lblCrit1Id.Text = dt2.Rows[0][0].ToString();

lblCrit2.Text = dt2.Rows[1][2].ToString(); lblCrit2Id.Text = dt2.Rows[1][2].ToString();

lblCrit4.Text = dt2.Rows[2][2].ToString(); lblCrit4Id.Text = dt2.Rows[2][2].ToString();

}

else if ((dt.Rows.Count > 51))

{

DataSet ds2 = db.select("SELECT* FROM critere where etapeID ='" + etapeID + "'"); //like ('4%')"); DataTable dt2 = ds2.Tables[0]; lblCrit1.Text = dt2.Rows[1][2].ToString(); lblCrit1Id.Text = dt2.Rows[0][0].ToString();

lblCrit2.Text = dt2.Rows[0][2].ToString(); lblCrit2Id.Text = dt2.Rows[1][2].ToString();

lblCrit4.Text = dt2.Rows[2][2].ToString(); lblCrit4Id.Text = dt2.Rows[2][2].ToString();

}

else

{

Response.Redirect("etapevoting.aspx");

}

}

protected void Button1_Click(object sender, EventArgs e)

{

if (RadioButton1.Checked)

{

Database db = new Database("Enquete.mdb"); user u = (user)Session["user"]; string conID = Session["conid"].ToString(); string query = "insert into resultat (criId,excellent,userid,etapeID,conID, Notes) values('" + lblCrit1Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '" + conID + "', 10)"; db.insert(query);

}

+ conID + "', 10)" ; db.insert(query); } Copyright © 2010-2011, eliematta.com . All rights reserved
+ conID + "', 10)" ; db.insert(query); } Copyright © 2010-2011, eliematta.com . All rights reserved

Application Web avec C#

Préparé par Elie Matta et al. Miss Lebanon Contest

else if (RadioButton2.Checked)

{

Database db = new Database("Enquete.mdb"); user u = (user)Session["user"]; string conID = Session["conid"].ToString(); string query = "insert into resultat (criId,nonreponse,userid,etapeID,conID, Notes) values('" + lblCrit1Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '" + conID + "', 0)"; db.insert(query);

}

else if (RadioButton3.Checked)

{

Database db = new Database("Enquete.mdb"); user u = (user)Session["user"]; string conID = Session["conid"].ToString(); string query = "insert into resultat (criId,tresbien,userid,etapeID,conID, Notes) values('" + lblCrit1Id.Text.ToString() + "',1,"