/// <summary> /// Retrieves the account with the account ID. /// </summary> /// <since_tizen> 3 </since_tizen> /// <param name="accountId"> The account ID to be searched.</param> /// <returns>Account instance with reference to the given ID.</returns> /// <privilege>http://tizen.org/privilege/account.read</privilege> /// <feature>http://tizen.org/feature/account</feature> /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account ID.</exception> /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception> /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception> /// <exception cref="NotSupportedException">The required feature is not supported.</exception> public static Account GetAccountById(int accountId) { AccountErrorFactory.CheckAccountFeature(); AccountError err = (AccountError)Interop.Account.CreateUnmanagedHandle(out IntPtr handle); if (err != AccountError.None) { Log.Warn(AccountErrorFactory.LogTag, "Failed to create handle"); throw AccountErrorFactory.CreateException(err, "Failed to create unmanaged handle"); } SafeAccountHandle accountHandle = new SafeAccountHandle(handle, false); AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, ref accountHandle); if (res != AccountError.None) { throw AccountErrorFactory.CreateException(res, "Failed to get accounts from the database for account id: " + accountId); } Account ref_account = new Account(accountHandle); return(ref_account); }
/// <summary> /// Retrieves the account with the account ID. /// </summary> /// <since_tizen> 3 </since_tizen> /// <param name="accountId"> The account ID to be searched.</param> /// <returns>Account instance with reference to the given ID.</returns> /// <privilege>http://tizen.org/privilege/account.read</privilege> /// <feature>http://tizen.org/feature/account</feature> /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account ID.</exception> /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception> /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception> /// <exception cref="NotSupportedException">The required feature is not supported.</exception> public static Account GetAccountById(int accountId) { Account account = Account.CreateAccount(); SafeAccountHandle handle = account.SafeAccountHandle; AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, ref handle); if (res != AccountError.None) { throw AccountErrorFactory.CreateException(res, "Failed to get accounts from the database for account id: " + accountId); } Account ref_account = new Account(handle); return(ref_account); }
/// <summary> /// Account constructor. /// </summary> /// <since_tizen> 4 </since_tizen> /// <param name="handle"> The account handle.</param> public Account(SafeAccountHandle handle) { _handle = handle; }
/// <summary> /// Account constructor. /// </summary> /// <since_tizen> 4 </since_tizen> /// <param name="handle"> The account handle.</param> public Account(SafeAccountHandle handle) { AccountErrorFactory.CheckAccountFeature(); _handle = handle; }