Ejemplo n.º 1
0
    public void createNewUser(string userName, string password)
    {
        // Give ourselves a dbAccess object to work with, and open it
        db = new dbAccess();
        db.OpenDB(DatabaseName);
        // Let's make sure we've got a table to work with as well!
        string tableName   = TableName;
        var    columnNames = new ArrayList();

        columnNames.Add(userNameKey);
        columnNames.Add(passwordKey);
        columnNames.Add(serializedDataKey);
        var columnValues = new ArrayList();

        columnValues.Add(userName);
        columnValues.Add(password);
        columnValues.Add(DEFAULT_NEW_SAVE);
        try {
            if (!userName.Equals("") && password.Length >= MIN_PASS_LENGTH)
            {
                db.Insert(tableName, columnNames, columnValues);
            }
            else
            {
                errorLabelScript.text = "Could not create new user";
            }
        }
        catch (Exception e) {       // Do nothing - our table was already created
            Debug.Log(e.Message);
            errorLabelScript.text = "User already exists in system";
        }
//		createUser = false;
    }