RentHouseDAL/UserService.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RentHouseModel;
using System.Data.SqlClient;
using System.Data;
namespace RentHouseDAL
{
public static class UserService
{
public static int AddUser(User user)
{
string sql = "insert into Users values(@UserName,@Password,@RealName,@Sex,@Phone,@Email,@Photo,@Mark,@Rank,@Question,@Answer,@RegDate,@Status)";
SqlParameter[] para = new SqlParameter[] {
new SqlParameter("@UserName",user.UserName),
new SqlParameter("@Password",user.Password),
new SqlParameter("@RealName",user.RealName),
new SqlParameter("@Sex",user.Sex),
new SqlParameter("@Phone",user.Phone),
new SqlParameter("@Email",user.Email),
new SqlParameter("@Photo",user.Photo),
new SqlParameter("@Mark",user.Mark),
new SqlParameter("@Rank",user.Rank),
new SqlParameter("@Question",user.Question),
new SqlParameter("@Answer",user.Answer),
new SqlParameter("@RegDate",user.RegDate),
new SqlParameter("@Status",user.Status)
};
return DBHelper.ExecuteCommand(sql, CommandType.Text, para);
}
public static int DeleteUserByUserName(string username)
{
string sql = "delete from Users where UserName=@UserName";
SqlParameter[] para = new SqlParameter[] {
new SqlParameter("@UserName",username)
};
return DBHelper.ExecuteCommand(sql, CommandType.Text, para);
}
#region Select
#region GetCount
public static int GetAllCount()
{
string sql = "select count(*) from Users";
return Convert.ToInt32(DBHelper.GetScalar(sql, CommandType.Text, null));
}
public static int GetFangCount()
{
string sql = "select count(*) from Users where Rank=N'房东'";
return Convert.ToInt32(DBHelper.GetScalar(sql, CommandType.Text, null));
}
public static int GetJingCount()
{
string sql = "select count(*) from Users where Rank=N'经纪人'";
return Convert.ToInt32(DBHelper.GetScalar(sql, CommandType.Text, null));
}
#endregion
后面还有 165 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。