溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET)

發(fā)布時(shí)間:2020-05-31 12:01:38 來源:網(wǎng)絡(luò) 閱讀:1250 作者:磊磊愛技術(shù) 欄目:編程語言

 

先建如下項(xiàng)目:

 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET)

先寫模型層

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

namespace Model
{
    public class Student
    {
        private string stuId;

        public string StuId
        {
            get { return stuId; }
            set { stuId = value; }
        }
        private string stuPwd;

        public string StuPwd
        {
            get { return stuPwd; }
            set { stuPwd = value; }
        }
        private string stuName;

        public string StuName
        {
            get { return stuName; }
            set { stuName = value; }
        }
        private string stuAge;

        public string StuAge
        {
            get { return stuAge; }
            set { stuAge = value; }
        }
        private string stuSex;

        public string StuSex
        {
            get { return stuSex; }
            set { stuSex = value; }
        }
        private string stuTel;

        public string StuTel
        {
            get { return stuTel; }
            set { stuTel = value; }
        }
        private string stuAddr;

        public string StuAddr
        {
            get { return stuAddr; }
            set { stuAddr = value; }
        }
        private string stuAudit;

        public string StuAudit
        {
            get { return stuAudit; }
            set { stuAudit = value; }
        }
    }
}
 

 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET) 

 

然后寫數(shù)據(jù)鏈路層:

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

namespace DAL
{
    public class Student_DAL
    {
        /// <summary>
        /// 驗(yàn)證用戶登陸
        /// </summary>
        /// <param name="user"></param>
        /// <param name="right"></param>
        /// <returns></returns>
        public object CheckStuLogin(Student student,string right)
        {
            string sqlText;
            sqlText = "select stuPwd from stuInfo where stuId=@userId";
            SqlParameter[] paras = new SqlParameter[1]
            {
                new SqlParameter("userId",student.StuId)
            };
            object obj = SqlLink.GetScaler(sqlText, paras);
            return obj;
        }
    }
}
 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET) 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET) 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET)

然后寫業(yè)務(wù)層

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Model;
using System.Data;

namespace BLL
{
    public class Student_BLL
    {
        Student_DAL studal = new Student_DAL();
        public int CheckStuLogin(Student student, string right)
        {
            object obj = studal.CheckStuLogin(student, right);
            int result = -1;
            if (obj == null)
            {
                result = 0; //用戶不存在
            }
            else if (obj.ToString().Trim() == student.StuPwd)
            {
                result = 1;//正確
            }
            else if (obj.ToString().Trim() != student.StuPwd)
            {
                result = 2;//密碼錯(cuò)誤
            }
            else
            {
                result = 3; //系統(tǒng)錯(cuò)誤
            }
            return result;
        }
    }
}
 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET) 

 

然后寫表示層

 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET)

以上都只是部分的代碼及截圖。需要詳細(xì)代碼,以及數(shù)據(jù)庫腳本的可以留言,或發(fā)郵件。191660130@qq.com

 

整個(gè)項(xiàng)目效果圖如下:

通過審核的效果如下

 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET)

未通過審核的效果如下:

 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET) 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET)

后臺(tái)審核:

 

用三層架構(gòu)實(shí)現(xiàn)登錄,并模擬后臺(tái)審核功能,未審核成功不予登錄(ASP.NET)

 

 

 

 

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI