0% ont trouvé ce document utile (0 vote)
41 vues8 pages

GestionClient Mode Connecté

c# Connected Mode

Transféré par

Object NotFound
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats DOC, PDF, TXT ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
41 vues8 pages

GestionClient Mode Connecté

c# Connected Mode

Transféré par

Object NotFound
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats DOC, PDF, TXT ou lisez en ligne sur Scribd

using

using
using
using
using
using
using
using

System;
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];
[Link];

namespace maj_client_asp
{
public partial class maj_client : [Link]
{
public static SqlConnection cnx = new SqlConnection(@"Data Source=KHALILPC\SQLEXPP;Initial Catalog=gestion_client;Integrated Security=True");
SqlCommand cmd;
SqlDataAdapter da;
SqlDataReader reader;
int count;
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
[Link]();
cmd = new SqlCommand("select * from Tclient", cnx);
reader = [Link]();
DataTable dt = new DataTable();
[Link](reader);
[Link]();
[Link] = dt;
[Link] = "nomcli";
[Link] = "numcli";
[Link]();
}

protected void Ajouter_Click(object sender, EventArgs e)


{
try
{
cmd = new SqlCommand("insert into Tclient values ('" + [Link] + "','" +
[Link] + "','" + [Link] + "','" + [Link] + "','" +
[Link] + "')", cnx);
[Link]();

catch (Exception ex)


{}
}
protected void modifier_Click(object sender, EventArgs e)
{
try
{
cmd = new SqlCommand("update Tclient set nomcli ='" + [Link] +
"',prencli='" + [Link]
+ "',adrecli='" + [Link] + "',date_naissance='" + [Link] +
"'where numcli='" + [Link]([Link]) + "'", cnx);
[Link]();
}
catch (Exception ex)
{}
}
protected void rechecher_Click(object sender, EventArgs e)
{
try
{
cmd = new SqlCommand("select * from Tclient where numcli ='" + [Link] +
"'", cnx);
reader = [Link]();
while ([Link]())
{
[Link] = reader[0].ToString();
[Link] = reader[1].ToString();
[Link] = reader[2].ToString();
[Link] = reader[3].ToString();
[Link] = reader[4].ToString();
}
[Link]();

}
catch (Exception ex)
{}

protected void supprimer_Click(object sender, EventArgs e)


{

try
{
cmd = new SqlCommand("delete from Tclient where numcli =" +
[Link]([Link]), cnx);

[Link]();
}
catch (Exception ex)
{}
}
public void aa(int posi)
{
//[Link] = ;
//[Link] = ;
//[Link] = ;
//[Link] = ;
}
protected void Button1_Click1(object sender, EventArgs e)
{

}
protected void Button3_Click(object sender, EventArgs e)
{
}
protected void Button4_Click(object sender, EventArgs e)
{

}
protected void BTNdernier_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("select count(numcli) from Tclient", cnx);
count = [Link]([Link]().ToString());
[Link] = [Link]();

cmd = new SqlCommand("select [Link],[Link],[Link],[Link],a.date_naissance


from (select *,ROW_NUMBER() over (order by numcli) as row from Tclient) a where row=(select
count(numcli) from Tclient)", cnx);
reader = [Link]();
while ([Link]())
{
[Link] = reader[0].ToString();
[Link] = reader[1].ToString();
[Link] = reader[2].ToString();
[Link] = reader[3].ToString();
[Link] = reader[4].ToString();
}
[Link]();
[Link] = [Link]([Link]) - 1;
remplissage();
}
protected void BTNsuivant_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("select count(numcli) from Tclient", cnx);
count = [Link]([Link]().ToString());

if ([Link]("")) [Link] = "1";


else
{
if ([Link]([Link]) < count)
{
[Link] = ([Link]([Link]) + 1).ToString();
}
}
cmd = new SqlCommand("select [Link],[Link],[Link],[Link],a.date_naissance
from (select *,ROW_NUMBER() over (order by numcli) as row from Tclient) a where row=" +
[Link]([Link]), cnx);
reader = [Link]();
while ([Link]())
{
[Link] = reader[0].ToString();
[Link] = reader[1].ToString();
[Link] = reader[2].ToString();
[Link] = reader[3].ToString();
[Link] = reader[4].ToString();
}
[Link]();
[Link] = [Link]([Link]) - 1;
}

remplissage();

protected void BTNprecedent_Click(object sender, EventArgs e)


{

if ([Link]("")) [Link] = "1";


if ([Link]([Link]) > 1) [Link] = ([Link]([Link]) - 1).ToString();
string req = "select [Link],[Link],[Link],[Link],a.date_naissance from (select
*,ROW_NUMBER() over (order by numcli) as row from Tclient) a where row=" +
[Link]([Link]);
SqlCommand cmd = new SqlCommand(req, cnx);
reader = [Link]();
while ([Link]())
{
[Link] = reader[0].ToString();
[Link] = reader[1].ToString();
[Link] = reader[2].ToString();
[Link] = reader[3].ToString();
[Link] = reader[4].ToString();
}
[Link]();
[Link] = [Link]([Link]) - 1;

remplissage();
}
protected void BTNpremier_Click(object sender, EventArgs e)
{
[Link] = "1";
SqlCommand cmd = new SqlCommand("select
[Link],[Link],[Link],[Link],a.date_naissance from (select *,ROW_NUMBER() over (order
by numcli) as row from Tclient) a where row=" +[Link]([Link]), cnx);
reader = [Link]();
while ([Link]())
{
[Link] = reader[0].ToString();
[Link] = reader[1].ToString();
[Link] = reader[2].ToString();
[Link] = reader[3].ToString();
[Link] = reader[4].ToString();
}
[Link]();
[Link] = [Link]([Link]) - 1;
remplissage();
}
public void remplissage(string a=null)
{

if(a==null) cmd = new SqlCommand("select * from Tcommande where numcli=" +


[Link], cnx);

else
cmd = new SqlCommand("select * from Tcommande where numcli=" +
[Link], cnx);
reader = [Link]();
DataTable dt = new DataTable();
[Link](reader);
[Link]();
[Link] = dt;
[Link]();
if(a==null) cmd = new SqlCommand("select Sum(qte*pu) from Tcommande
c,Tproduit_Commande p where [Link]=[Link] and [Link]=" + [Link],
cnx);
else cmd = new SqlCommand("select Sum(qte*pu) from Tcommande
c,Tproduit_Commande p where [Link]=[Link] and [Link]=" +
[Link], cnx);
String montant = [Link]().ToString();
[Link] = montant;
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = [Link];
string col = [Link][1].Text;
cmd = new SqlCommand(" select sum(qte*pu) from Tproduit_Commande where
numcomm=" + col, cnx);
string res = [Link]().ToString();
[Link] = res;
cmd = new SqlCommand(" select [Link],[Link],[Link],qte,PU,qte*pu as
Montant from Tproduit_Commande t,Tproduit p where [Link]=[Link] and numcomm="
+ col, cnx);
reader = [Link]();
DataTable d = new DataTable();
[Link](reader);
[Link]();
[Link] = d;
[Link]();

}
protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)
{

SqlCommand cmd = new SqlCommand("select


numcli,nomcli,prencli,adrecli,date_naissance from Tclient where numcli=" +
[Link], cnx);
reader = [Link]();
while ([Link]())
{
[Link] = reader[0].ToString();
[Link] = reader[1].ToString();
[Link] = reader[2].ToString();
[Link] = reader[3].ToString();
[Link] = reader[4].ToString();
}
[Link]();
[Link] = ([Link] + 1).ToString();
remplissage("a");
}
protected void ComParCliNewpage_Click(object sender, EventArgs e)
{
[Link]("[Link]?Cli="+[Link]);
}

using System;
using [Link];
using [Link];

using
using
using
using
using

[Link];
[Link];
[Link];
[Link];
[Link];

namespace maj_client_asp
{
public partial class WebForm1 : [Link]
{
SqlDataReader reader;
protected void Page_Load(object sender, EventArgs e)
{
string s = [Link]["cli"];
SqlCommand cmd = new SqlCommand("select * from Tcommande where numcli="
+s,maj_client.cnx);
reader = [Link]();
DataTable dt = new DataTable();
[Link](reader);
[Link]();
[Link] = dt;
[Link]();
}
}

Vous aimerez peut-être aussi