MyBookShopBLL/UsersManager.cs

(开头部分) 2KB

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

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

namespace MyBookShop.BLL
{
    public class UsersManager
    {
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="user">要注册的用户对象</param>
        /// <returns>true或false</returns>
        public bool UserRegister(Users user, out string error)
        {
            error = "";
            if (new UsersService().ExistLoginId(user.LoginId) > 0)
            {
                error = "用户名已存在";
                return false;
            }
            if (user.Name == null)
            {
                user.Name = "";
            }
            if (user.Address == null)
            {
                user.Address = "";
            }
            if (user.Phone == null)
            {
                user.Phone = "";
            }
            user.UserRoleId = 1;
            user.UserStateId = 1;
            int count = new UsersService().AddUser(user);
            if (count > 0)
                return true;
            else
            {
                error = "注册失败";
                return false;
            }
        }

        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="user">要登录的用户对象</param>
        /// <returns>true或false</returns>
        public Users UserLogin(string loginId, string loginPwd)
        {
            return new UsersService().UserLogin(loginId, loginPwd);
        }

        /// <summary>
        /// 管理员登录
后面还有 17 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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