1234567891011121314151617181920212223242526272829303132 |
- using InABox.Core;
- using InABox.Poster.MYOB;
- using MYOB.AccountRight.SDK.Services.GeneralLedger;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using MYOBAccount = MYOB.AccountRight.SDK.Contracts.Version2.GeneralLedger.Account;
- namespace PRS.Shared.Posters.MYOB;
- public static class AccountMYOBUtils
- {
- public static Result<Guid, Exception> GetAccount(MYOBConnectionData data, string glCode)
- {
- if (!data.GetUID<AccountService, MYOBAccount>(
- new Filter<MYOBAccount>(x => x.DisplayID).IsEqualTo(glCode))
- .Get(out var accountID, out var error))
- {
- return Result.Error(new Exception($"Failed to find Account in MYOB with code {glCode}", error));
- }
- else if (accountID == Guid.Empty)
- {
- return Result.Error(new Exception($"Failed to find Account in MYOB with code {glCode}"));
- }
- else
- {
- return Result.Ok(accountID);
- }
- }
- }
|