BLL/AdminBLL.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Model;
using System.Data;
namespace BLL
{
public class AdminBLL
{
#region //添加管理员
public bool AdminAdd(Admin admin)
{
AdminDAL userDal = new AdminDAL();
if (admin.AdminId == "") {
throw new System.Exception("用户编号不能为空,请确认!");
}
else if (admin.AdminId.Length != 12) {
throw new System.Exception("用户编号的长度为12位,请确认!");
}
else if (admin.AdminName == "") {
throw new System.Exception("用户名称不能为空,请确认!");
}
else if (admin.Password == "") {
throw new System.Exception("密码不能为空,请确认!");
}
else if (admin.Password.Length != 6) {
throw new System.Exception("密码必须为6位数字,请确认!");
}
//如果用户身份为读者,则判断该读者ID是否存在,存在即可添加用户,否则不可以添加用户,需要先办理借书证
BorrowerDAL borrowerDAL = new BorrowerDAL();
Borrower borrmodel = new Borrower();
borrmodel = borrowerDAL.BorrowerCheck(admin.AdminId);
if (admin.AdminIdenti == "读者")
{
if (borrmodel == null)
{
throw new System.Exception("请先去办理借书证!");
}
else
{
Admin model = userDal.adminCheck(admin.AdminId);
if (model != null)
{
throw new System.Exception("该用户已存在,请确认!");
}
else
{
return userDal.AdminAdd(admin);
}
}
}
else {
Admin model = userDal.adminCheck(admin.AdminId);
if (model != null)
{
throw new System.Exception("该用户已存在,请确认!");
}
后面还有 117 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。