先建如下項(xiàng)目:
創(chuàng)新互聯(lián)致力于互聯(lián)網(wǎng)品牌建設(shè)與網(wǎng)絡(luò)營(yíng)銷,包括成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、SEO優(yōu)化、網(wǎng)絡(luò)推廣、整站優(yōu)化營(yíng)銷策劃推廣、電子商務(wù)、移動(dòng)互聯(lián)網(wǎng)營(yíng)銷等。創(chuàng)新互聯(lián)為不同類型的客戶提供良好的互聯(lián)網(wǎng)應(yīng)用定制及解決方案,創(chuàng)新互聯(lián)核心團(tuán)隊(duì)10多年專注互聯(lián)網(wǎng)開發(fā),積累了豐富的網(wǎng)站經(jīng)驗(yàn),為廣大企業(yè)客戶提供一站式企業(yè)網(wǎng)站建設(shè)服務(wù),在網(wǎng)站建設(shè)行業(yè)內(nèi)樹立了良好口碑。
先寫模型層
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
{
///
/// 驗(yàn)證用戶登陸
///
///
///
///
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)審核: