コード例 #1
0
ファイル: Current.cs プロジェクト: hieuuk/pingpoong
 /// <summary>
 /// Login with input information
 /// </summary>
 /// <param name="thisPage"></param>
 /// <param name="UserName"></param>
 /// <param name="Password"></param>
 /// <param name="Remember"></param>
 /// <returns></returns>
 public static int LogIn(string UserName, string Password, bool Remember)
 {
     ORM.User loginUser = new VL.ORM.User("UserName", UserName);
     //Check if user is exist or not. Return 1 if not
     if (loginUser.UserID == 0)
     {
         return 1;
     }
     //Check if the password is correct, if not, return 2
     if (loginUser.Password != Password)
     {
         return 2;
     }
     //Ok, now store the logged user into our main current.user
     User = loginUser;
     //Check to store the user in cookie
     if (Remember)
     {
         RememberUser = loginUser;
     }
     return 0;
 }
コード例 #2
0
ファイル: Current.cs プロジェクト: hieuuk/pingpoong
 /// <summary>
 /// Log user out and clear the cookie
 /// </summary>
 /// <param name="thisPage"></param>
 public static void LogOut()
 {
     User = null;
     RememberUser = null;
 }
コード例 #3
0
ファイル: Current.cs プロジェクト: hieuuk/pingpoong
 /// <summary>
 /// Load the user from the cookie. Return null if couldn't find the user
 /// </summary>
 /// <param name="thisPage"></param>
 /// <returns></returns>
 public static ORM.User LoadCookieUser()
 {
     User = RememberUser;
     return User;
 }