您好,登錄后才能下訂單哦!
先建如下項(xiàng)目:
先寫模型層
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; }
}
}
}
然后寫數(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;
}
}
}
然后寫業(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;
}
}
}
然后寫表示層
以上都只是部分的代碼及截圖。需要詳細(xì)代碼,以及數(shù)據(jù)庫腳本的可以留言,或發(fā)郵件。191660130@qq.com
整個(gè)項(xiàng)目效果圖如下:
通過審核的效果如下
未通過審核的效果如下:
后臺(tái)審核:
免責(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)容。