Application Web C#

Transcription

Application Web C#
UNIVERSITÉ ANTONINE
Faculté d’ingénieurs en Informatique,
Multimédia, Réseaux & Télécommunications
Miss Lebanon Contest
Matière : Application Web avec C#
Effectué par :
NOM Prénom
INF#
MATTA Elie
Privacy
applied
et al.
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 :
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 1
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
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
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)
{
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 2
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");
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 3
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>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 4
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>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 5
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>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 6
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...</p>
</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">
<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>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 7
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>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 8
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Default :
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">
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 9
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
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 10
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Jurelogin
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">
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 11
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
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
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)
{
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 12
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 :
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" %>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 13
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
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
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)
{
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 14
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;
}
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 15
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() + "' ";
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 16
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");
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 17
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);
}
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 18
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Miss :
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>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 19
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>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 20
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Miss.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
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();
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 21
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
{
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 22
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 :
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 23
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 />
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 24
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;
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 25
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
using
using
using
using
using
using
using
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
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))
{
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 26
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);
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 27
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," + u.userid + ",'" + etapeID
conID + "', 8)";
db.insert(query);
}
else if (RadioButton4.Checked)
{
Database db = new Database("Enquete.mdb");
user u = (user)Session["user"];
string conID = Session["conid"].ToString();
string query = "insert into resultat
(criId,bien,userid,etapeID,conID, Notes) values('" +
lblCrit1Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID
conID + "', 6)";
db.insert(query);
}
else if (RadioButton5.Checked)
{
Database db = new Database("Enquete.mdb");
user u = (user)Session["user"];
string conID = Session["conid"].ToString();
string query = "insert into resultat
(criId,moyen,userid,etapeID,conID, Notes) values('" +
lblCrit1Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID
conID + "', 4)";
db.insert(query);
}
else if (RadioButton6.Checked)
{
Database db = new Database("Enquete.mdb");
user u = (user)Session["user"];
string conID = Session["conid"].ToString();
string query = "insert into resultat
(criId,mauvais,userid,etapeID,conID, Notes) values('" +
lblCrit1Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID
conID + "', 2)";
Copyright © 2010-2011, eliematta.com. All rights reserved
+ "', '" +
+ "', '" +
+ "', '" +
+ "', '" +
+ "', '" +
Page 28
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
db.insert(query);
}
Server.Transfer("etapevoting.aspx");
}
protected void RadioButton7_CheckedChanged(object sender, EventArgs e)
{
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('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '" +
conID + "', 10)";
db.insert(query);
}
protected void RadioButton8_CheckedChanged(object sender, EventArgs e)
{
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('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '" +
conID + "', 8)";
db.insert(query);
}
protected void RadioButton9_CheckedChanged(object sender, EventArgs e)
{
Database db = new Database("Enquete.mdb");
user u = (user)Session["user"];
string conID = Session["conid"].ToString();
string query = "insert into resultat
(criId,bien,userid,etapeID,conID, Notes) values('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '" +
conID + "', 6)";
db.insert(query);
}
protected void RadioButton10_CheckedChanged(object sender, EventArgs e)
{
Database db = new Database("Enquete.mdb");
user u = (user)Session["user"];
string conID = Session["conid"].ToString();
string query = "insert into resultat
(criId,moyen,userid,etapeID,conID, Notes) values('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '" +
conID + "', 4)";
db.insert(query);
}
protected void RadioButton11_CheckedChanged(object sender, EventArgs e)
{
Database db = new Database("Enquete.mdb");
user u = (user)Session["user"];
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 29
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
string conID = Session["conid"].ToString();
string query = "insert into resultat
(criId,mauvais,userid,etapeID,conID, Notes) values('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '" +
conID + "', 2)";
db.insert(query);
}
protected void RadioButton12_CheckedChanged(object sender, EventArgs
{
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('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '"
conID + "', 0)";
db.insert(query);
}
protected void RadioButton13_CheckedChanged(object sender, EventArgs
{
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('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '"
conID + "', 10)";
db.insert(query);
}
protected void RadioButton14_CheckedChanged(object sender, EventArgs
{
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('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '"
conID + "', 8)";
db.insert(query);
e)
+
e)
+
e)
+
}
protected void RadioButton15_CheckedChanged(object sender, EventArgs e)
{
Database db = new Database("Enquete.mdb");
user u = (user)Session["user"];
string conID = Session["conid"].ToString();
string query = "insert into resultat
(criId,bien,userid,etapeID,conID, Notes) values('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '" +
conID + "', 6)";
db.insert(query);
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 30
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
protected void RadioButton16_CheckedChanged(object sender, EventArgs
{
Database db = new Database("Enquete.mdb");
user u = (user)Session["user"];
string conID = Session["conid"].ToString();
string query = "insert into resultat
(criId,moyen,userid,etapeID,conID, Notes) values('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '"
conID + "', 4)";
db.insert(query);
}
protected void RadioButton17_CheckedChanged(object sender, EventArgs
{
Database db = new Database("Enquete.mdb");
user u = (user)Session["user"];
string conID = Session["conid"].ToString();
string query = "insert into resultat
(criId,mauvais,userid,etapeID,conID, Notes) values('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '"
conID + "', 2)";
db.insert(query);
e)
+
e)
+
}
protected void RadioButton18_CheckedChanged(object sender, EventArgs e)
{
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('" +
lblCrit2Id.Text.ToString() + "',1," + u.userid + ",'" + etapeID + "', '" +
conID + "', 0)";
db.insert(query);
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 31
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Etape voting :
Cette page est une page de séparation entre la page du vote et celle du résultat dans
laquelle un message se présente pour informer l’utilisateur qu’il attende le vote des
autre utilisateurs afin de pouvoir afficher le résultat final et un link vers la page
concurrent pour pouvoir voter aux autres concurrentes. Suite au vote de tous les
users pour toutes les concurrentes, un bouton résultat initialement invisible apparait
menant a la page des résultats.
Etapevoting.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 32
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
public partial class erreurlogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
user u = (user)Session["user"];
Database db = new Database("Enquete.mdb");
DataSet ds1 = db.select("SELECT * FROM Resultat");
DataSet ds2 = db.select("SELECT * FROM Resultat WHERE etapeID ='3Mesure et poids'");
DataSet ds3 = db.select("SELECT * FROM Resultat WHERE etapeID ='4
Questions generales'");
DataTable dt1 = ds1.Tables[0];
DataTable dt2 = ds3.Tables[0];
DataTable dt3 = ds3.Tables[0];
-
if (dt1.Rows.Count < 30)
{
Button1.Visible = false;
Label1.Visible = true;
}
else if ((dt1.Rows.Count > 30) && (dt1.Rows.Count < 51))
{
Button1.Visible = false;
Label1.Visible = true;
}
else if ((dt3.Rows.Count > 51) && (dt1.Rows.Count < 66))
{
Button1.Visible = false;
Label1.Visible = true;
}
else
{
Button1.Visible = true;
Label1.Visible = false;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("resultat.aspx");
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 33
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Etapevoting.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="etapevoting.aspx.cs" Inherits="erreurlogin"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div class="tick_head">Voting:<span
class="tick_head1">Results</span></div><br /><br /><br />
<asp:Label ID="Label1" runat="server" Height="50px" Text="Your vote has
been casted, please wait while the other juries give their vote"
Width="514px">
</asp:Label>
<br /><br /><asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Results!" />
<br /><br /><a href="concurrent.aspx">Click here</a> at any time to see
the contestants.
</asp:Content>
Résultat :
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 34
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Cette page représente un grid view dans lequel sont affichées les sept filles
restantes dans ce concours. En cliquant sur select on aboutit a la page miss qui
nous permet d’aboutir de nouveau a la page du vote mais cette fois pour l’étape 2.
Et ainsi de suite jusqu'à l’annonce des trois premières gagnantes du concours.
Resultat.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="resultat.aspx.cs" Inherits="resultat"
Title="Untitled Page" %>
<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>
Resultat.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;
using System.Web.UI.MobileControls;
using System.Collections.Generic;
public partial class resultat : System.Web.UI.Page
{
DataTable dt5 = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 35
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
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];
ArrayList arOne = new ArrayList();
List<ArrayList> listAll = new List<ArrayList>();
string etapIDForResult = "";
if (dtEtape.Rows.Count > 0)
{
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 == "2 -Beaute")
Session["etapeID"] = "3- Mesure et poids";
else if (etapIDForResult == "3- Mesure et poids")
Session["etapeID"] = "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;
}
}
}
string qFinal = "Select conid, nom, prenom, lieu_naiss, date_naiss
from
Concurrent where ";
if (Convert.ToInt32(etapIDForResult.Substring(0, 1).ToString()) == 2)
{
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 36
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
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() + "' ";
}
}
}
DataSet dss = db.select(qFinal);
DataTable dtt = dss.Tables[0];
int aaa = dtt.Rows.Count;
GridView1.DataSource = dtt;
GridView1.DataBind();
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 37
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
from
GridView1.Visible = true;
if (Convert.ToInt32(etapIDForResult.Substring(0, 1).ToString()) == 4)
{
string qMiss = "Select conid, nom, prenom, lieu_naiss, date_naiss
Concurrent where conid ='" + listAllSorted[0][1].ToString() + "'";
DataSet dsMiss = db.select(qFinal);
DataTable dtMiss = dsMiss.Tables[0];
string missName = dt.Rows[0][2].ToString();
}
}
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;
Response.Redirect("miss.aspx?conid" + Session["conid"].ToString());
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 38
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
About us :
Aboutus.aspx:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Aboutus.aspx.cs" Inherits="Aboutus"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<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">
For over 30 years, Miss Lebanon Committee has been devoted to bringing you
everything that you need in relation to the world of Beauty Pageants.<br />
Lebanon has won many International Beauty Titles in the past. To name but a
few, Miss Universe in 1972, Ms Globe in 2000, Miss International in 2002,
Miss Model of the World in 2005, Mr. Teen of The World in 2005, Mr.
International in 2006….<br />
Miss Lebanon is the only national beauty contest that awards big prizes worth
over half a million US dollars to its winners. <br />
We Strictly DENY any relation to other fake websites pretending to represent
any beauty contests taking place in Lebanon such as Miss Lebanon, Miss
Lebanon Emigrant, Mr. Lebanon and all other official titles given.<br />
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 39
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Surf our site, choose the section of your interest, submit your application
and let your journey in the world of fame and beauty begins!
To know more about us, you can contact us at any time you want just
<asp:LinkButton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click">click here</asp:LinkButton>!<br />
</font></p></asp:Content>
Aboutus.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class Aboutus : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("Contactus.aspx");
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 40
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Beautytip.aspx:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Beautytip.aspx.cs" Inherits="Beautytip"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<br />
<br />
<br />
<asp:LinkButton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click" Font-Bold="True" Font-Size="Large">Body
care</asp:LinkButton>
||
<asp:LinkButton ID="LinkButton2" runat="server"
OnClick="LinkButton2_Click" Font-Bold="True" Font-Size="Large">Eye
care</asp:LinkButton>
||
<asp:LinkButton ID="LinkButton3" runat="server"
OnClick="LinkButton3_Click" Font-Bold="True" Font-Size="Large">Lip
care</asp:LinkButton><br />
<asp:Panel ID="Panel1" runat="server" Visible="False" Width="691px">
<br /><br />
<div class="tick_head">Body care<br /><br /><br />
</div>
<br /><br /><br /><br />
-Mix six-teaspoon petroleum jelly, two-teaspoon glycerin and two-teaspoon
lemon juice.<br />
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 41
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Apply this moisturizing lotion at least twice a week if you have dry and
flaky,
arms and legs<br />
-Peel and grate a cucumber. Squeeze the juice to this, mix half-a-teaspoon
glycerin and half-a-teaspoon rose water.<br />
Apply this on sunburns, leave it for some time.<br />
-If you have cracked heels, melt paraffin wax; mix it with little mustard oil
and
apply on the affected area. Leave it overnight.<br />
After 10 or 15 days, your heels will become smooth.
-Massage your body with a mixture of coconut oil and any of your favourite
scented oils like lavender or rosemary. <br />
-For rough palms, use a mixture of glycerin and limejuice in equal
proportion.<br />
-For cracked heals, massage the foot with coconut oil and keep the foot in
warm water for some time. Wipe the water off the feet and apply a mixture of
hibiscus flower(10), Henna (1 handful) and juice of half a lemon. when dry
wash it off.<br />
-Remove scars on your hands and feet by rubbing them with lemon peel.<br />
</asp:Panel>
<asp:Panel ID="Panel2" runat="server" Visible="False" Width="690px">
<br /><br />
<div class="tick_head"> Eye care<br /><br />
</div>
<br /><br /><br /><br />
-Dip wads of cotton in a chilled mixture of cucumber and potato juice. Keep
this on your eyelids for 15 to 20 minutes and gently wash it off. Apply a
little baby oil.
-For long eyelashes .., apply a thin coat of castor oil every night. It
strengthens lashes and cools your eyes.<br />
-Massage a few drops of coconut oil around the eyes to get rid off dark
circles. <br />
-To reduce puffiness of your eyes, grate a potato; tie in a cloth and place
the cloth over your eyes for about 15 minutes.<br />
-Add a small pinch of salt in water and wash for bright and sparkling
eyes.<br />
-Mix tomato juice and lemon juice in equal quantity and apply around the
eyes. After 30 minutes wash it off with cold and hot water alternatively.<br
/>
-Make a paste of sandal wood and nutmeg. Apply the paste around the eyes
before sleeping and wash it off in the morning.<br />
-Crush a cucumber and take the juice. Add a little rose water and apply
around the eyes and wash it after 30 minutes.<br />
-Place cotton wool swabs dipped in cold milk on closed eyes for removing dark
circles. <br />
</asp:Panel>
<asp:Panel ID="Panel3" runat="server" Visible="False" Width="690px">
<br /><br />
<div class="tick_head"> Lip Care <br /><br /><br />
</div>
<br /><br /><br /><br />
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 42
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
-You can mix one-tablespoon cranberry sauce juice with two tablespoons
Vaseline for a delicious home made lip balm.<br />
-Apply the juice of lemon skin for avoiding black colour of lips.<br />
-Massage your lips with coriander leaf juice for soft and rosy lips.<br />
</asp:Panel>
<br />
</asp:Content>
Beautytip.aspx.cs:
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class Beautytip : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Panel1.Visible = true;
Panel2.Visible = false;
Panel3.Visible = false;
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = true;
Panel3.Visible = false;
}
protected void LinkButton3_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = false;
Panel3.Visible = true;
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 43
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Comments.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="comments.aspx.cs" Inherits="comments"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div class="tick_head">Comments<span class="tick_head1">
Area</span></div>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="AccessDataSource1" Width="494px"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged" CellPadding="1"
CellSpacing="2">
<RowStyle BorderWidth="0px" />
<Columns>
<asp:BoundField DataField="namee" HeaderText="Name"
SortExpression="namee" />
<asp:BoundField DataField="comments" HeaderText="Comments"
SortExpression="comments" />
</Columns>
</asp:GridView>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 44
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/Enquete.mdb"
SelectCommand="SELECT [namee], [comments] FROM
[contact]"></asp:AccessDataSource>
<br />
<br />
Want to cast your comment? <a href="Contactus.aspx">Click here</a> to
contact us at any time!
</asp:Content>
comments.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class comments : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 45
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Commentsuccess.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="commentsuccess.aspx.cs"
Inherits="commentsuccess" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div class="tick_head">Thank you for your <span
class="tick_head1">FeedBack</span></div><br /><br /><br /><br /><br />
Your comment has been casted.<br />
Thank you for your patience, hope you enjoyed our website and dont forget to
visit our <a href="gallery.aspx">Gallery</a>!
</asp:Content>
Commentsuccess.aspx.cs
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 46
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class commentsuccess : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Gallery.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="gallery.aspx.cs" Inherits="gallery"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div class="tick_head">Welcome to <span class="tick_head1">the
contestants</span> Photo Gallery!</div>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</asp:Content>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 47
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Gallery.aspx.cs
using
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
System.Data.OleDb;
public partial class gallery : System.Web.UI.Page
{
string reqs;
protected void Page_Load(object sender, EventArgs e)
{
Database ao = new Database("Enquete.mdb");
int i = 0;
int j=1;
reqs = "<table><tr>";
DataSet ds = ao.select("select * from Concurrent");
DataTable dt = ds.Tables[0];
while (j-1<dt.Rows.Count)
{
if (i < 5)
{
reqs += "<td>";
reqs += "<a href=miss.aspx?id=x00" + j + ">";
reqs += "<image src=" + dt.Rows[j-1]["Image"].ToString() + "
width ='100' height ='150'></img>";
reqs += "</a>";
reqs += "</td>";
i++;
j++;
}
else
{
i = 0;
reqs += "</tr>";
reqs += "<tr>";
reqs += "<td>";
reqs += "<a href=miss.aspx?id=x00" + j + ">";
reqs += "<image src=" + dt.Rows[j - 1]["Image"].ToString() +
" width ='100' height ='150'>";
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 48
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
reqs += "</a>";
reqs += "</img>";
i++;
j++;
}
}
reqs += "</tr>";
reqs += "</table>";
Literal1.Text = reqs;
}
}
Contactus.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Contest.aspx.cs" Inherits="Contest"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<br /><br />
<div class="tick_head">
Facts & Information about Miss Lebanon<br />
</div>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 49
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
<div>
<p dir="ltr"><font face="Arial" color ="#3b3b3b" size="2">
<br /><br /><br />
Miss Lebanon is the most important and the official beauty contest in
Lebanon.<br />
While the contest dates back to even before the 1960s.<br />
The last few years, the show undertook major changes, <br />
when the contest took the form of a reality television show thanks to LBC
which hosts this beauty contest.<br />
Miss Lebanon is the only national beauty contest that awards big prizes worth
over half a million US dollars to its winners.<br />
Thanks to the Lebanese Broadcasting Corporation (LBC) who has been hosting
Miss Lebanon Contest for many years,<br />
the show took a dramatic change in the year 2004.<br />
The beauty contestants who compete for the crown,<br />
live together for six weeks in a Villa in Adma (The same villa which hosts
Star Academy Lebanon).<br />
Some Lebanese beauty contestants have reached the semi-finals of Miss World
such as Joelle Behlock and Marie Jose Hnein.<br />
However the only Miss Lebanon to have won a title were Georgina Rizk (Miss
Universe 1971) and Christina Sawaya (Miss International 2001).<br />
</font></p>
</div></asp:Content>
Contactus.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class contactus : System.Web.UI.Page
{
int s;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 50
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
}
protected void TextBox3_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox4_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox5_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox6_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox7_TextChanged(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
contact c = new contact();
c.namee = TextBox1.Text;
c.email = TextBox2.Text;
c.address = TextBox3.Text;
c.phone = TextBox4.Text;
c.subject = TextBox5.Text;
c.comments = TextBox6.Text;
c.tel = TextBox7.Text;
if (c.test())
{
s = 1;
}
else
{
s = 0;
}
if (s == 1)
{
Response.Redirect("commentsuccess.aspx");
}
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 51
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Contest.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Contest.aspx.cs" Inherits="Contest"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<br /><br />
<div class="tick_head">
Facts & Information about Miss Lebanon<br />
</div>
<div>
<p dir="ltr"><font face="Arial" color ="#3b3b3b" size="2">
<br /><br /><br />
Miss Lebanon is the most important and the official beauty contest in
Lebanon.<br />
While the contest dates back to even before the 1960s.<br />
The last few years, the show undertook major changes, <br />
when the contest took the form of a reality television show thanks to LBC
which hosts this beauty contest.<br />
Miss Lebanon is the only national beauty contest that awards big prizes worth
over half a million US dollars to its winners.<br />
Thanks to the Lebanese Broadcasting Corporation (LBC) who has been hosting
Miss Lebanon Contest for many years,<br />
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 52
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
the show took a dramatic change in the year 2004.<br />
The beauty contestants who compete for the crown,<br />
live together for six weeks in a Villa in Adma (The same villa which hosts
Star Academy Lebanon).<br />
Some Lebanese beauty contestants have reached the semi-finals of Miss World
such as Joelle Behlock and Marie Jose Hnein.<br />
However the only Miss Lebanon to have won a title were Georgina Rizk (Miss
Universe 1971) and Christina Sawaya (Miss International 2001).<br />
</font></p>
</div></asp:Content>
Contest.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class Contest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 53
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Jurylist.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="comments.aspx.cs" Inherits="comments"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div class="tick_head">Jury's<span class="tick_head1"> List</span></div>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="AccessDataSource1" Width="531px"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged" CellPadding="1"
CellSpacing="2">
<RowStyle BorderWidth="0px" />
<Columns>
<asp:BoundField DataField="prenom" HeaderText="Prenom"
SortExpression="prenom" />
<asp:BoundField DataField="nom" HeaderText="Nom"
SortExpression="nom" />
<asp:BoundField DataField="sexe" HeaderText="Sexe"
SortExpression="sexe" />
<asp:BoundField DataField="profession" HeaderText="Profession"
SortExpression="profession" />
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 54
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
<asp:BoundField DataField="mail" HeaderText="Mail"
SortExpression="mail" />
</Columns>
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/Enquete.mdb"
SelectCommand="SELECT [prenom], [nom], [sexe], [profession], [mail]
FROM [user]"></asp:AccessDataSource>
<br />
</asp:Content>
Jurylist.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class jurylist : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 55
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Membersarea.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Membersarea.aspx.cs" Inherits="Membersarea"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div class="tick_head">Teachers</div>
<p dir="ltr"><font face="Arial" color ="#3b3b3b" size="3">
<br /><br /><br />
-Rigina Finianos Director of Bal Des Debutants Company<br />
-Papou Lahoud The international and lebanese fashion designer.<br />
-Sylvio Tabet The international and lebanese fashion director.<br />
-Dr. Sami Helou Doctor and Specialist in cosmetic surgery.<br />
-Magui Farah journalist.<br />
-Mona Fares Head of the unit of tourist improvment in the council of
tourism.<br />
-Antoine Kerbaj Lebanese actor and Director of the actors syndicate.<br />
-Jean Louis Mangui Interior Design and decoration.<br />
-Nayla De Freige Vice president of the "L'orient le jour".<br />
</font></p></asp:Content>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 56
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Membersarea.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class Membersarea : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
News.aspx
Puis
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 57
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
<%@ Page Language=”C#” MasterPageFile=”~/MasterPage.master”
AutoEventWireup=”true” CodeFile=”News.aspx.cs” Inherits=”News”
Title=”Untitled Page” %>
<asp:Content ID=”Content1” ContentPlaceHolderID=”ContentPlaceHolder1”
Runat=”Server”>
<div class=”tick_head”><a href=”gabriellebourached.aspx”><span
class=”tick_head1”>”Gabrielle Bou Rached”</span></a></div><br /><br /><br
/><br /><br />
Gabrielle Bou Rached was crowned Miss Campus of USJ University Beirut, she
represented her country in Miss Asia …
<div class=”tab_readmore”>
<p align=”right” class=”tab_head”><a href=”gabriellebourached.aspx”
class=”readmore”>Read More </a></p>
</div>
<div class=”tick_head”><a href=”christinasawaya.aspx”><span
class=”tick_head1”>”Christina Sawaya”</span></a></div><br /><br /><br /><br
/><br />
Christina Sawaya went on to win …
<div class=”tab_readmore”>
<p align=”right” class=”tab_head”><a href=”christinasawaya.aspx”
class=”readmore”>Read More </a></p>
</div>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 58
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
<div class=”tick_head”><a href=”georginarizk.aspx”><span
class=”tick_head1”>”Georgina Rizk”</span></a></div><br /><br /><br /><br
/><br />
In the 1972 Miss Universe pageant in Dorado, Puerto Rico, the 1971 winner,
Georgina Rizk, was not
allowed to attend due to government restrictions because of fears of a
terrorist attack….
<div class=”tab_readmore”>
<p align=”right” class=”tab_head”><a href=”georginarizk.aspx”
class=”readmore”>Read More </a></p>
</div>
</asp:Content>
News.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class News : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 59
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Sponsors.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="sponsors.aspx.cs" Inherits="sponsors"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div class="tick_head">Sponsors<br /><br /><br />
</div>
<table>
<tr>
<td style="height: 134px; width: 170px;">
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/sponsor12.jpg"
Height="100px" Width="150px" /></td>
<td style="height: 134px; width: 170px;">
<asp:Image ID="Image2" runat="server" ImageUrl="~/images/z1.jpg"
Height="100px" Width="150px" /></td>
<td style="height: 134px">
<asp:Image ID="Image3" runat="server" ImageUrl="~/images/sponsor4.jpg"
Height="100px" Width="150px" /></td>
</tr>
<tr>
<td style="width: 170px">
<asp:Image ID="Image4" runat="server"
ImageUrl="~/images/sponsor22.jpg" Height="100px" Width="150px" /></td>
<td>
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 60
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
<asp:Image ID="Image5" runat="server" Height="100px"
ImageUrl="~/images/sponsor6.jpg"
Width="150px" /></td>
<td>
<asp:Image ID="Image6" runat="server" Height="100px"
ImageUrl="~/images/sponsor21.jpg"
Width="150px" /></td>
</tr>
</table>
</asp:Content>
Sponsors.aspx.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
public partial class sponsors : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 61
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
Error_Login.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Error_Login.aspx.cs" Inherits="Error_Login"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div class="tick_head">Access<span class="tick_head1">
Denied</span></div><br /><br /><br /><br /><br />
<font color="red">You do not have access to this page as you are not logged
in.</font>
</asp:Content>
Error_Login.aspx.cs
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 62
Application Web avec C#
Préparé par Elie Matta et al.
Miss Lebanon Contest
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Error_Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Merci d’avance !
Copyright © 2010-2011, eliematta.com. All rights reserved
Page 63

Documents pareils