示例#1
0
        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);
        }
示例#3
0
        public bool isBusy()
        {
            UserDatabaseController udb = new UserDatabaseController();

            if (udb.ReturnUserId(UserLogin) == -1)
            {
                return(false);
            }

            return(true);
        }
示例#4
0
        virtual public bool setValue(string gValue, int UserId)
        {
            if (!validation(gValue))
            {
                return(false);
            }

            UserDatabaseController udb = new UserDatabaseController();

            udb.SetFieldValue(UserId, this, gValue);

            return(true);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        public string returnValueOfField(Fields field)
        {
            UserDatabaseController udb = new UserDatabaseController();

            return(udb.ReturnFieldValue(UserId, field));
        }