Exemple #1
0
 public T_Admin Get(string Name, string Password, int IsLock, DateTime LockTime)
 {
     if (IsLock == 0)
     {
         //未被锁定
         return(_dal.Get(Name, Password));
     }
     else if (IsLock == 1 && (DateTime.Now - LockTime).Minutes > 30)
     {
         //已被锁定,但锁定时间过期
         return(_dal.Get(Name, Password));
     }
     else if (Name.Length <= 0 && Password.Length <= 0)
     {
         throw new Exception("用户名或密码不能空");
     }
     else
     {
         throw new Exception(string.Format("账号已被锁定,请等待{0}分钟再试", (DateTime.Now - LockTime).Minutes));
     }
 }