夏林的专属文档,旁人别看

CQCET-1720 2020-10-15 02:35:16
这里开始开始:


DBServer bll = Faction.GetServer();

public bool Add(Models.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.ToString())+")";
int a = bll.GetInt(str);
return a == 0 || a == -1 ? false : true;
}
public bool Updata(Models.Users obj)
{
string str = "update users set usersname ="+Comm.Addstr(obj.Usersname)+", pwd="+Comm.Addstr(obj.Pwd)+", role="+Comm.Addstr(obj.Role.ToString())+"where id="+Comm.Addstr(obj.Id.ToString());
int a = bll.GetInt(str);
return a == 0 || a == -1 ? false : true;
}

public bool Del(string id)
{
string str = "update users set del=0 where id="+Comm.Addstr(id);
int a = bll.GetInt(str);
return a == 0 || a == -1 ? false : true;
}

public DataSet Qurey(string where = "")
{
string str = "select id,usersname as '用户名',role as '权限' from users where del!=0 and usersname like "+Comm.Addstr("%"+where+"%");
DataSet set = bll.GetSet(str);
return set;
}
public Models.Users GetUsers(string id)
{
string str = "select * from users where id="+Comm.Addstr(id);
DataSet set = bll.GetSet(str);
Models.Users obj = new Models.Users();
obj.Id = Convert.ToInt16(set.Tables[0].Rows[0]["id"].ToString());
obj.Usersname = set.Tables[0].Rows[0]["usersname"].ToString();
obj.Pwd = set.Tables[0].Rows[0]["pwd"].ToString();
obj.Del = Convert.ToInt16(set.Tables[0].Rows[0]["del"].ToString());
obj.Role = Convert.ToInt16(set.Tables[0].Rows[0]["role"].ToString());
return obj;
}

public int Exestl(string users,string pwd)
{
string str = "select pwd from users where usersname=" + Comm.Addstr(users);
DataSet set = bll.GetSet(str);
if (set.Tables[0].Rows.Count < 1)
{
return 0;
}
string pwds = set.Tables[0].Rows[0]["pwd"].ToString();
if (Comm.Md5(pwd) == pwds)
{
return 2;

}
else
{
return 1;
}
}

这里结束:
样式:
开始:

.text{
width:200px;
height:25px;
line-height:25px;
border:1px solid black;
border-radius:6px;
outline:none;
background-color:#ceec7c;
}
.btn {
width: 80px;
height: 25px;
line-height:25px;
border: 1px solid black;
border-radius: 3px;
outline: none;
background-color:#8df1f8;
}
.grid th{
text-align:center;
}
.grid td{
text-align:center;
}

结束

login开始:

<style>
body{
background-color:#8faaf5;
}
fieldset{
border:2px solid black;
border-radius:7px;
margin:100px auto;
width:450px;
height:400px;
text-align:center;
background-color:#52f540;
}
legend{
text-align:center;

}
.txt{
width:300px;
height:40px;
border:1px solid black;
border-radius:6px;
outline:none;
background-color:#fcea97;
margin-top:30px;
}
.btn{
width:304px;
height:41px;
border:1px solid black;
border-radius:6px;
outline:none;
background-color:#2df7f3;
margin-top:40px;
}
</style>


<div>
<fieldset>
<legend>登 录</legend>
<input style="margin-top:60px" type="text" id="txtUsers" runat="server" class="txt" placeholder="输入用户名:" /><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="用户名不为空!" ForeColor="Red" ControlToValidate="txtUsers"></asp:RequiredFieldValidator><br />
<input type="password" id="txtPwd" runat="server" class="txt" placeholder="输入密码:" /><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="密码不为空!" ForeColor="Red" ControlToValidate="txtPwd"></asp:RequiredFieldValidator><br />
<asp:Button ID="Button1" CssClass="btn" runat="server" Text="登 录" OnClick="Button1_Click" />
</fieldset>
</div>
...全文
14045 2 点赞 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
CPU不够了 2020-10-16
钓鱼,我也看了
  • 打赏
  • 举报
回复
我看了
  • 打赏
  • 举报
回复
相关推荐
发帖
C#
加入

10.6w+

社区成员

.NET技术 C#
申请成为版主
帖子事件
创建了帖子
2020-10-15 02:35
社区公告

让您成为最强悍的C#开发者