public User LoginInit(string UserLogin, string UserPass) { User user; UserDatabaseController udb = new UserDatabaseController(); if (!udb.checkPassCompare(UserLogin, UserPass)) { user = new User(); return(user); } int DB_UserId = udb.ReturnUserId(UserLogin); int DB_UserPermId = udb.ReturnUserPermId(DB_UserId); user = new User(DB_UserId, new UserLoginField(), new UserPassField()); user.setUserLoginStatusTrue(); user.setUserPermId(DB_UserPermId); Perm permMachine = new Perm(); user = permMachine.ReturnObjectWithPerm(user); return(user); }
public bool isBusy(string gValue) { UserDatabaseController udb = new UserDatabaseController(); if (udb.ReturnUserId(gValue) == -1) { return(false); } return(true); }
public bool isBusy() { UserDatabaseController udb = new UserDatabaseController(); if (udb.ReturnUserId(UserLogin) == -1) { return(false); } return(true); }
virtual public bool setValue(string gValue, int UserId) { if (!validation(gValue)) { return(false); } UserDatabaseController udb = new UserDatabaseController(); udb.SetFieldValue(UserId, this, gValue); return(true); }
override public bool setValue(string gValue, int UserId) { if (!validation(gValue)) { return(false); } UserDatabaseController udb = new UserDatabaseController(); PasswordHasher Hasher = new PasswordHasher(); udb.SetFieldValue(UserId, this, Hasher.HashPassword(gValue)); return(true); }
public bool RegisterInit() { if (!checkDatas()) { return(false); } if (isBusy()) { return(false); } UserDatabaseController udb = new UserDatabaseController(); PasswordHasher Hasher = new PasswordHasher(); string query = "INSERT INTO users (login, pass, perm) VALUES('" + UserLogin + "', '" + Hasher.HashPassword(UserPassword) + "', '0')"; udb.Insert(query); return(true); }
public string returnValueOfField(Fields field) { UserDatabaseController udb = new UserDatabaseController(); return(udb.ReturnFieldValue(UserId, field)); }