App_Code/DAL/dalUserInfo.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

using ENTITY;

namespace DAL
{
    /*用户信息业务逻辑层实现*/
    public class dalUserInfo
    {
        /*待执行的sql语句*/
        public static string sql = "";

        /*添加用户信息实现*/
        public static bool AddUserInfo(ENTITY.UserInfo userInfo)
        {
            string sql = "insert into UserInfo(username,password,areaObjId,name,sex,birthday,cardNumber,telephone,address,userImage) values(@username,@password,@areaObjId,@name,@sex,@birthday,@cardNumber,@telephone,@address,@userImage)";
            /*构建sql参数*/
            SqlParameter[] parm = new SqlParameter[] {
             new SqlParameter("@username",SqlDbType.VarChar),
             new SqlParameter("@password",SqlDbType.VarChar),
             new SqlParameter("@areaObjId",SqlDbType.Int),
             new SqlParameter("@name",SqlDbType.VarChar),
             new SqlParameter("@sex",SqlDbType.VarChar),
             new SqlParameter("@birthday",SqlDbType.DateTime),
             new SqlParameter("@cardNumber",SqlDbType.VarChar),
             new SqlParameter("@telephone",SqlDbType.VarChar),
             new SqlParameter("@address",SqlDbType.VarChar),
             new SqlParameter("@userImage",SqlDbType.VarChar)
            };
            /*给参数赋值*/
            parm[0].Value = userInfo.username; //用户名
            parm[1].Value = userInfo.password; //宽带密码
            parm[2].Value = userInfo.areaObjId; //所在区域
            parm[3].Value = userInfo.name; //姓名
            parm[4].Value = userInfo.sex; //性别
            parm[5].Value = userInfo.birthday; //生日
            parm[6].Value = userInfo.cardNumber; //身份证号
            parm[7].Value = userInfo.telephone; //联系电话
            parm[8].Value = userInfo.address; //地址
            parm[9].Value = userInfo.userImage; //用户照片

            /*执行sql进行添加*/
            return (DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false;
        }

        /*根据username获取某条用户信息记录*/
        public static ENTITY.UserInfo getSomeUserInfo(string username)
        {
            /*构建查询sql*/
            string sql = "select * from UserInfo where username='" + username + "'"; 
            SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null);
            ENTITY.UserInfo userInfo = new ENTITY.UserInfo();
            /*如果查询存在记录,就包装到对象中返回*/
            if (DataRead.Read())
            {
后面还有 110 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。