Ejemplo n.º 1
0
    void insertAccount(object obj)
    {
        lock (singletonLock)
        {
            try
            {
                //deleteAllAccount();

                Hashtable hash               = (Hashtable)obj;
                string    encryptUserId      = Encryption.Encrypt("" + hash [DatabaseManager.USER_ID]);
                string    encryptUserName    = Encryption.Encrypt("" + hash [DatabaseManager.USER_NAME]);
                string    encryptPassword    = Encryption.Encrypt("" + hash [DatabaseManager.PASSWORD]);
                string    encryptAccountType = Encryption.Encrypt("" + hash [DatabaseManager.ACCOUNT_TYPE]);

                var p = new AcountTable {
                    UserId      = encryptUserId,
                    UserName    = encryptUserName,
                    Password    = encryptPassword,
                    AccountType = encryptAccountType
                };
                int isSuccess = connection.Update(p);
                if (isSuccess == 0)
                {
                    connection.Insert(p);
                }
            }
            catch (Exception ex)
            {
                Debug.LogWarning(ex.Message);
            }
        }
    }
Ejemplo n.º 2
0
	void insertAccount (object obj)
	{
		lock (singletonLock)
		{
			try
			{
				//deleteAllAccount();

				Hashtable hash = (Hashtable)obj;
				string encryptUserId = Encryption.Encrypt ("" + hash [DatabaseManager.USER_ID]);
				string encryptUserName = Encryption.Encrypt ("" + hash [DatabaseManager.USER_NAME]);
				string encryptPassword = Encryption.Encrypt ("" + hash [DatabaseManager.PASSWORD]);
				string encryptAccountType = Encryption.Encrypt ("" + hash [DatabaseManager.ACCOUNT_TYPE]);

				var p = new AcountTable{
					UserId = encryptUserId,
					UserName = encryptUserName,
					Password = encryptPassword,
					AccountType = encryptAccountType
				};
				int isSuccess = connection.Update(p);
				if (isSuccess == 0 )
				{
					connection.Insert(p);
				}
			}
			catch(Exception ex)
			{
				Debug.LogWarning (ex.Message);
			}
		}
	}