DBServer BLL=extension. GetServer ();
Public Boolean Add (Models. The Users obj)
{
String STR="insert into users values (" + Comm. Addstr (obj. Usersname) +", "+ Comm. Addstr (obj. Pwd) +", "+ Comm. Addstr (obj. Del. ToString ()) +", "+ Comm. Addstr (obj. Role. The ToString ()) +") ";
Int a=the BLL. Get int (STR);
Return a==0 | | a==1? False: true,
}
Public bool Updata (Models. The Users obj)
{
String STR="update the users set usersname=" + Comm. Addstr (obj. Usersname) + ", the PWD="+ Comm. Addstr (obj. PWD) +", role="+ Comm. Addstr (obj. Role. The ToString ()) +" is the where id="+ Comm. Addstr (obj. Id. The ToString ());
Int a=the BLL. Get int (STR);
Return a==0 | | a==1? False: true,
}
Public bool Del (string id)
{
String STR="update the users set del=0 where id=" + Comm. Addstr (id);
Int a=the BLL. Get int (STR);
Return a==0 | | a==1? False: true,
}
Public DataSet Qurey (string where="")
{
String STR="select id, usersname as' user name 'role as' permissions' from the users where del!=0 and usersname like "+ Comm. Addstr (" %" + where + "%");
The DataSet set=the BLL. GetSet (STR);
Return the set;
}
Public Models. The Users GetUsers (string id)
{
String STR="select * from the users where id=" + Comm. Addstr (id);
The DataSet set=the BLL. GetSet (STR);
Models. The Users obj=new Models. The Users ();
Obj. Id=the Convert. ToInt16 (set Tables [0]. Rows [0] [r]. "Id" ToString ());
Obj. Usersname=set. Tables [0]. Rows [0] [r]. "Usersname" ToString ();
Obj. Pwd=set. Tables [0]. Rows [0] [r]. "Pwd" ToString ();
Obj. Del=the Convert. ToInt16 (set Tables [0]. Rows [0] [r]. "Del" ToString ());
Obj. Role=the Convert. ToInt16 (set Tables [0]. Rows [0] [r]. "Role" the ToString ());
Return obj.
}
Public int Exestl (string users, string PWD)
{
String STR="select the PWD from users where usersname=" + Comm. Addstr (users);
The DataSet set=the BLL. GetSet (STR);
If (set Tables [0]. Rows. Count & lt; 1)
{
return 0;
}
String PWDS=set. Tables [0]. Rows [0] [r]. "PWD" ToString ();
If (Comm. Md5 (PWD)==PWDS)
{
return 2;
}
The else
{
return 1;
}
}
Here ends:
Style:
Start:
The text {
width:200px;
Height: 25 px;
The line - height: 25 px;
Border: 1 px solid black;
border-radius:6px;
Outline: none;
Background - color: # ceec7c;
}
The BTN {
width: 80px;
height: 25px;
The line - height: 25 px;
Border: 1 px solid black;
Border - the radius: 3 px;
outline: none;
Background - color: # 8 df1f8;
}
The grid th {
text-align:center;
}
The grid td {
text-align:center;
}
The end of the
Login to:
<style>
Body {
Background - color: # 8 faaf5;
}
Fieldset {
Border: 2 px solid black;
Border - the radius: 7 px;
Margin: 100 px auto;
Width: 450 px;
Height: 400 px;
text-align:center;
Background - color: # 52 f540;
}
Legend {
text-align:center;
}
.txt {
Width: 300 px;
Height: 40 px;
Border: 1 px solid black;
border-radius:6px;
outline:none;
Background - color: # fcea97;
Margin - top: 30 px;
}
The BTN {
Width: 304 px;
Height: 41 px;
Border: 1 px solid black;
border-radius:6px;
outline:none;
Background - color: # 2 df7f3;
Margin - top: 40 px;
}
</style>
CodePudding user response:
I watched the