public static User getUserProperties() { DataRow row = DBHandler.getTable("SELECT * FROM UserProperties").Rows[0]; User user = new User(); user.Email = row["email"].ToString(); user.UserId = row["userId"].ToString(); user.Name = row["name"].ToString(); user.Password = row["password"].ToString(); user.SecurityCode = row["securityCode"].ToString(); user.ImageId = row["imageId"].ToString(); return user; }
//insert user's properties private Boolean setProperties(String name, String email, String password, String userId) { const string NOT_CONFIRMED = "not confirmed"; //userId = userId.Substring(0, 32); User user = new User(); user.Email = email; user.Name = name; user.Password = password; user.UserId = userId; user.SecurityCode = NOT_CONFIRMED; DBHandler.initDB(); String result = LocalData.addUser(user); if (result == null) { //MessageBox.Show("in set"); return true; } // else { //MessageBox.Show("SQL ERROR: " + result); } return true; }
//creates a new user object private User createUser(string userName) { Utility myUtility = new Utility(); User myUser = new User { UserName = myUtility.formatUpperCase(userName) }; return myUser; }
public static string updateUser(User user) { StringBuilder sb = new StringBuilder(); sb.Append("email='" + user.Email + "',"); sb.Append("userId='" + user.UserId + "',"); sb.Append("name='" + user.Name + "',"); sb.Append("password='******',"); sb.Append("securityCode='" + user.SecurityCode + "',"); sb.Append("imageId='" + user.ImageId + "'"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(sb); Console.WriteLine(); return DBHandler.executeCmd("UPDATE UserProperties SET " + sb + " WHERE email='" + user.Email + "'"); }
public static string deleteUser(User user) { return DBHandler.executeCmd("DELETE FROM UserProperties WHERE email='" + user.Email + "'"); }
public static string addUser(User user) { return DBHandler.insert("INSERT INTO UserProperties(email , name , userId , password , securityCode) VALUES('" + user.Email + "' , '" + user.Name + "' , '" + user.UserId + "' ,'" + user.Password + "' , '" + user.SecurityCode + "')"); }