Web/Model/UserExtend.cs

(开头部分) 3KB

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

using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references

namespace StudentExamination.Model
{
    //扩展user类,增加自定义的方法
 
    public partial class User
    {
        public void Login(string loginName, string loginPassword)
        {
            //
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select Id,LoginName,Password,UserType,IsUsed,CreateDate from sys_user");
            strSql.Append(" where IsUsed = 1 and loginName=@loginName ");
            SqlParameter[] parameters = {
					new SqlParameter("@loginName", SqlDbType.NChar,30)			};
            parameters[0].Value = loginName;

            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    this.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LoginName"] != null && ds.Tables[0].Rows[0]["LoginName"].ToString() != "")
                {
                    this.LoginName = ds.Tables[0].Rows[0]["LoginName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Password"] != null && ds.Tables[0].Rows[0]["Password"].ToString() != "")
                {
                    this.Password = ds.Tables[0].Rows[0]["Password"].ToString();
                }
                if (ds.Tables[0].Rows[0]["UserType"] != null && ds.Tables[0].Rows[0]["UserType"].ToString() != "")
                {
                    this.UserType = int.Parse(ds.Tables[0].Rows[0]["UserType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsUsed"] != null && ds.Tables[0].Rows[0]["IsUsed"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsUsed"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsUsed"].ToString().ToLower() == "true"))
                    {
                        this.IsUsed = true;
                    }
                    else
                    {
                        this.IsUsed = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["CreateDate"] != null && ds.Tables[0].Rows[0]["CreateDate"].ToString() != "")
                {
                    this.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString());
                }

            }
            else
            {
后面还有 32 行代码,购买后查看完整代码

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

AI 解读 AI

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

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