コード例 #1
0
 partial void DeleteUser(User instance);
コード例 #2
0
 partial void InsertUser(User instance);
コード例 #3
0
 partial void UpdateUser(User instance);
コード例 #4
0
ファイル: UserLogin.cs プロジェクト: Deadpikle/LightWriter
 /// <summary>
 /// Creates a user login after checking to see whether the username
 /// exists in the database. Adds the user login to the database .
 /// </summary>
 /// <param name="username">The username to register with the system.</param>
 /// <param name="password">The password to use in the system.</param>
 /// <returns>True if successful, false otherwise (usually because the username exists).</returns>
 public static bool CreateUserLogin(string username, string password)
 {
     if (!checkUserExists(username))
     {
         LightWriterDataContext dataContext = new LightWriterDataContext();
         ulong passHash = generatePasswordKey(password);
         User user = new User();
         user.Username = username;
         user.Password = passHash.ToString();
         dataContext.Users.InsertOnSubmit(user);
         dataContext.SubmitChanges();
         Login(username, password); // Log the user in now that they're registered
         return true;
     }
     return false;
 }