using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace LYFZ.WanYuKeFuData.DAL { public class User : BaseDataOperate { public User(LYFZ.WanYuKeFuData.Model.DBConnection dbConn) { base.DBConn = dbConn; } /// /// 根据用户ID获取用户对象 /// /// /// public LYFZ.WanYuKeFuData.Model.User GetUser(string userID) { if (!String.IsNullOrEmpty(userID)) { return this.GetModel("UserID", userID); } else { return new Model.User(); } } /// /// 验证用户基本信息 /// /// /// /// public bool VerifyUserBaseInfo(LYFZ.WanYuKeFuData.Model.User userModel, ref string msg) { if (String.IsNullOrEmpty(userModel.UserID)) { msg = "帐号不能为空"; return false; } if (String.IsNullOrEmpty(userModel.Password)) { msg = "帐号密码不能为空"; return false; } if (!VerifyUserBaseInfo(userModel.UserID, ref msg)) { return false; } return true; } /// /// 验证用户基本信息 /// /// /// /// public bool VerifyUserBaseInfo(string userID, ref string msg) { if (userID.ToLower() == "admin") { msg = "“admin”管理员帐号为系统帐号不能修改和删除"; return false; } return true; } /// /// /// /// /// /// public bool VerifyUserExists(string userID, ref string msg) { if (this.Exists("UserID", userID)) { msg = "要添加的帐号“" + userID + "”已经存在,不能重复添加"; return false; } return true; } } }