/// <summary>Snippet for GetAccountLinkAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetAccountLinkAsync()
        {
            // Create client
            AccountLinkServiceClient accountLinkServiceClient = await AccountLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/accountLinks/[ACCOUNT_LINK]";
            // Make the request
            AccountLink response = await accountLinkServiceClient.GetAccountLinkAsync(resourceName);
        }
示例#2
0
 /// <summary>Snippet for CreateAccountLink</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void CreateAccountLink()
 {
     // Create client
     AccountLinkServiceClient accountLinkServiceClient = AccountLinkServiceClient.Create();
     // Initialize request argument(s)
     string      customerId  = "";
     AccountLink accountLink = new AccountLink();
     // Make the request
     CreateAccountLinkResponse response = accountLinkServiceClient.CreateAccountLink(customerId, accountLink);
 }
示例#3
0
        /// <summary>Snippet for GetAccountLinkAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetAccountLinkResourceNamesAsync()
        {
            // Create client
            AccountLinkServiceClient accountLinkServiceClient = await AccountLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            AccountLinkName resourceName = AccountLinkName.FromCustomerAccountLink("[CUSTOMER]", "[ACCOUNT_LINK]");
            // Make the request
            AccountLink response = await accountLinkServiceClient.GetAccountLinkAsync(resourceName);
        }
示例#4
0
        public AccountLinkViewModel(
            ILoggerFactory loggerFactory,
            AccountLink accountLink)
        {
            m_logger = loggerFactory.CreateLogger <AccountLinkViewModel>();

            AccountId = accountLink.AccountId;
            m_name    = accountLink.Name;
            m_type    = accountLink.Type;
            m_subType = accountLink.SubType;
        }
示例#5
0
 /// <summary>Snippet for GetAccountLink</summary>
 public void GetAccountLink()
 {
     // Snippet: GetAccountLink(string, CallSettings)
     // Create client
     AccountLinkServiceClient accountLinkServiceClient = AccountLinkServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER]/accountLinks/[ACCOUNT_LINK]";
     // Make the request
     AccountLink response = accountLinkServiceClient.GetAccountLink(resourceName);
     // End snippet
 }
示例#6
0
        /// <summary>Snippet for CreateAccountLinkAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task CreateAccountLinkAsync()
        {
            // Create client
            AccountLinkServiceClient accountLinkServiceClient = await AccountLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            string      customerId  = "";
            AccountLink accountLink = new AccountLink();
            // Make the request
            CreateAccountLinkResponse response = await accountLinkServiceClient.CreateAccountLinkAsync(customerId, accountLink);
        }
示例#7
0
 /// <summary>Snippet for GetAccountLink</summary>
 public void GetAccountLinkResourceNames()
 {
     // Snippet: GetAccountLink(AccountLinkName, CallSettings)
     // Create client
     AccountLinkServiceClient accountLinkServiceClient = AccountLinkServiceClient.Create();
     // Initialize request argument(s)
     AccountLinkName resourceName = AccountLinkName.FromCustomerAccountLink("[CUSTOMER]", "[ACCOUNT_LINK]");
     // Make the request
     AccountLink response = accountLinkServiceClient.GetAccountLink(resourceName);
     // End snippet
 }
示例#8
0
 /// <summary>Snippet for GetAccountLink</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetAccountLinkRequestObject()
 {
     // Create client
     AccountLinkServiceClient accountLinkServiceClient = AccountLinkServiceClient.Create();
     // Initialize request argument(s)
     GetAccountLinkRequest request = new GetAccountLinkRequest
     {
         ResourceNameAsAccountLinkName = AccountLinkName.FromCustomerAccountLink("[CUSTOMER]", "[ACCOUNT_LINK]"),
     };
     // Make the request
     AccountLink response = accountLinkServiceClient.GetAccountLink(request);
 }
 /// <summary>Snippet for CreateAccountLink</summary>
 public void CreateAccountLink()
 {
     // Snippet: CreateAccountLink(string, AccountLink, CallSettings)
     // Create client
     AccountLinkServiceClient accountLinkServiceClient = AccountLinkServiceClient.Create();
     // Initialize request argument(s)
     string      customerId  = "";
     AccountLink accountLink = new AccountLink();
     // Make the request
     CreateAccountLinkResponse response = accountLinkServiceClient.CreateAccountLink(customerId, accountLink);
     // End snippet
 }
        /// <summary>Snippet for GetAccountLinkAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetAccountLinkRequestObjectAsync()
        {
            // Create client
            AccountLinkServiceClient accountLinkServiceClient = await AccountLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetAccountLinkRequest request = new GetAccountLinkRequest
            {
                ResourceNameAsAccountLinkName = AccountLinkName.FromCustomerAccountLink("[CUSTOMER_ID]", "[ACCOUNT_LINK_ID]"),
            };
            // Make the request
            AccountLink response = await accountLinkServiceClient.GetAccountLinkAsync(request);
        }
示例#11
0
 public static DiscordEmbedBuilder GetLinkDataEmbed(AccountLink link)
 {
     return(new DiscordEmbedBuilder()
            .WithTitle($"Link for {link.DiscordUsername}")
            .AddField("Discord", $"```\n" +
                      $"Username : {link.DiscordUsername}\n" +
                      $"ID       : {link.DiscordId}" +
                      $"\n```", true)
            .AddField("FAF", $"```\n" +
                      $"Username : {link.FafUsername}\n" +
                      $"ID       : {link.FafId}" +
                      $"\n```", true));
 }
示例#12
0
        /// <summary>Snippet for GetAccountLinkAsync</summary>
        public async Task GetAccountLinkResourceNamesAsync()
        {
            // Snippet: GetAccountLinkAsync(AccountLinkName, CallSettings)
            // Additional: GetAccountLinkAsync(AccountLinkName, CancellationToken)
            // Create client
            AccountLinkServiceClient accountLinkServiceClient = await AccountLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            AccountLinkName resourceName = AccountLinkName.FromCustomerAccountLink("[CUSTOMER]", "[ACCOUNT_LINK]");
            // Make the request
            AccountLink response = await accountLinkServiceClient.GetAccountLinkAsync(resourceName);

            // End snippet
        }
示例#13
0
        /// <summary>Snippet for GetAccountLinkAsync</summary>
        public async Task GetAccountLinkAsync()
        {
            // Snippet: GetAccountLinkAsync(string, CallSettings)
            // Additional: GetAccountLinkAsync(string, CancellationToken)
            // Create client
            AccountLinkServiceClient accountLinkServiceClient = await AccountLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/accountLinks/[ACCOUNT_LINK]";
            // Make the request
            AccountLink response = await accountLinkServiceClient.GetAccountLinkAsync(resourceName);

            // End snippet
        }
        /// <summary>Snippet for CreateAccountLinkAsync</summary>
        public async Task CreateAccountLinkAsync()
        {
            // Snippet: CreateAccountLinkAsync(string, AccountLink, CallSettings)
            // Additional: CreateAccountLinkAsync(string, AccountLink, CancellationToken)
            // Create client
            AccountLinkServiceClient accountLinkServiceClient = await AccountLinkServiceClient.CreateAsync();

            // Initialize request argument(s)
            string      customerId  = "";
            AccountLink accountLink = new AccountLink();
            // Make the request
            CreateAccountLinkResponse response = await accountLinkServiceClient.CreateAccountLinkAsync(customerId, accountLink);

            // End snippet
        }
示例#15
0
        public static AccountLink MakeAccountLink(MYOBAccount account)
        {
            var lk = new AccountLink {
                UID = account.Uid, DisplayID = account.DisplayID, Name = account.Name
            };

            if (lk.UID == null)
            {
                throw new Exception($"UID not set for account {account.DisplayID}");
            }
            if (lk.URI == null)
            {
                throw new Exception($"URI not set for account {account.DisplayID}");
            }
            return(lk);
        }
示例#16
0
        public void TestGetAccountAsLink()
        {
            ILoggerFactory loggerFactory = new LoggerFactory();

            using (var sqliteMemoryWrapper = new SqliteMemoryWrapper())
            {
                var currencyFactory   = new CurrencyFactory();
                var usdCurrencyEntity = currencyFactory.Create(CurrencyPrefab.Usd, true);
                currencyFactory.Add(sqliteMemoryWrapper.DbContext, usdCurrencyEntity);

                var accountFactory = new AccountFactory();
                Entities.Account checkingAccountEntity = accountFactory.Create(AccountPrefab.Checking, usdCurrencyEntity);
                accountFactory.Add(sqliteMemoryWrapper.DbContext, checkingAccountEntity);

                var accountService = new AccountService(loggerFactory, sqliteMemoryWrapper.DbContext);

                AccountLink checkingAccountLink = accountService.GetAsLink(checkingAccountEntity.AccountId);

                Assert.AreEqual(checkingAccountEntity.AccountId, checkingAccountLink.AccountId);
                Assert.AreEqual(checkingAccountEntity.Name, checkingAccountLink.Name);
                Assert.AreEqual(AccountType.Asset, checkingAccountLink.Type);
            }
        }
        public void TestUpdateAccountRelationship()
        {
            ILoggerFactory loggerFactory = new LoggerFactory();

            using (var sqliteMemoryWrapper = new SqliteMemoryWrapper())
            {
                var currencyFactory   = new CurrencyFactory();
                var usdCurrencyEntity = currencyFactory.Create(CurrencyPrefab.Usd, true);
                currencyFactory.Add(sqliteMemoryWrapper.DbContext, usdCurrencyEntity);

                var accountFactory = new AccountFactory();
                Entities.Account incomeAccountEntity =
                    accountFactory.Create(AccountPrefab.Income, usdCurrencyEntity);
                Entities.Account checkingAccountEntity =
                    accountFactory.Create(AccountPrefab.Checking, usdCurrencyEntity);
                Entities.Account groceriesPrepaymentAccountEntity =
                    accountFactory.Create(AccountPrefab.GroceriesPrepayment, usdCurrencyEntity);
                Entities.Account rentPrepaymentAccountEntity =
                    accountFactory.Create(AccountPrefab.RentPrepayment, usdCurrencyEntity);
                Entities.Account rentExpenseAccountEntity =
                    accountFactory.Create(AccountPrefab.RentExpense, usdCurrencyEntity);
                accountFactory.Add(sqliteMemoryWrapper.DbContext, incomeAccountEntity);
                accountFactory.Add(sqliteMemoryWrapper.DbContext, checkingAccountEntity);
                accountFactory.Add(sqliteMemoryWrapper.DbContext, groceriesPrepaymentAccountEntity);
                accountFactory.Add(sqliteMemoryWrapper.DbContext, rentPrepaymentAccountEntity);
                accountFactory.Add(sqliteMemoryWrapper.DbContext, rentExpenseAccountEntity);

                var checkingToGroceriesPrepaymentRelationship = new Entities.AccountRelationship
                {
                    SourceAccount      = checkingAccountEntity,
                    DestinationAccount = groceriesPrepaymentAccountEntity,
                    Type = AccountRelationshipType.PhysicalToLogical
                };
                var checkingToRentPrepaymentRelationship = new Entities.AccountRelationship
                {
                    SourceAccount      = checkingAccountEntity,
                    DestinationAccount = rentPrepaymentAccountEntity,
                    Type = AccountRelationshipType.PhysicalToLogical
                };

                sqliteMemoryWrapper.DbContext.AccountRelationships.Add(checkingToGroceriesPrepaymentRelationship);
                sqliteMemoryWrapper.DbContext.AccountRelationships.Add(checkingToRentPrepaymentRelationship);
                sqliteMemoryWrapper.DbContext.SaveChanges();

                var accountService = new AccountService(
                    loggerFactory,
                    sqliteMemoryWrapper.DbContext
                    );

                AccountLink rentPrepaymentAccountLink = accountService.GetAsLink(rentPrepaymentAccountEntity.AccountId);
                AccountLink rentExpenseAccountLink    = accountService.GetAsLink(rentExpenseAccountEntity.AccountId);

                var accountRelationshipService = new AccountRelationshipService(
                    loggerFactory,
                    sqliteMemoryWrapper.DbContext
                    );

                AccountRelationship relationship = accountRelationshipService.Get(
                    checkingToRentPrepaymentRelationship.AccountRelationshipId);
                relationship.Type               = AccountRelationshipType.PrepaymentToExpense;
                relationship.SourceAccount      = rentPrepaymentAccountLink;
                relationship.DestinationAccount = rentExpenseAccountLink;
                accountRelationshipService.Update(relationship);

                List <Entities.AccountRelationship> accountRelationshipEntities =
                    sqliteMemoryWrapper.DbContext.AccountRelationships.ToList();

                Assert.AreEqual(2, accountRelationshipEntities.Count);
                Assert.AreEqual(AccountRelationshipType.PhysicalToLogical, accountRelationshipEntities[0].Type);
                Assert.AreEqual(checkingAccountEntity.AccountId, accountRelationshipEntities[0].SourceAccount.AccountId);
                Assert.AreEqual(checkingAccountEntity.Name, accountRelationshipEntities[0].SourceAccount.Name);
                Assert.AreEqual(groceriesPrepaymentAccountEntity.AccountId, accountRelationshipEntities[0].DestinationAccount.AccountId);
                Assert.AreEqual(groceriesPrepaymentAccountEntity.Name, accountRelationshipEntities[0].DestinationAccount.Name);
                Assert.AreEqual(AccountRelationshipType.PrepaymentToExpense, accountRelationshipEntities[1].Type);
                Assert.AreEqual(rentPrepaymentAccountEntity.AccountId, accountRelationshipEntities[1].SourceAccount.AccountId);
                Assert.AreEqual(rentPrepaymentAccountEntity.Name, accountRelationshipEntities[1].SourceAccount.Name);
                Assert.AreEqual(rentExpenseAccountEntity.AccountId, accountRelationshipEntities[1].DestinationAccount.AccountId);
                Assert.AreEqual(rentExpenseAccountEntity.Name, accountRelationshipEntities[1].DestinationAccount.Name);
            }
        }
示例#18
0
 public IAccountLinkViewModel Create(AccountLink accountLink)
 {
     return(new StubAccountLinkViewModel(accountLink));
 }
        private void BtnRecordClick(Object sender, EventArgs e)
        {
            var serviceInvoiceSvc = new ServiceInvoiceService(MyConfiguration, null,
                                                              MyOAuthKeyService);
            var serviceInvoice = new ServiceInvoice();

            if ((_invoice == null))
            {
                var customerLnk = new CustomerLink {
                    UID = (Guid)CmboCustomer.SelectedValue
                };
                serviceInvoice.Customer       = customerLnk;
                serviceInvoice.ShipToAddress  = TxtAddress.Text;
                serviceInvoice.Number         = TxtInvoiceNo.Text;
                serviceInvoice.Date           = DtDate.Value;
                serviceInvoice.IsTaxInclusive = ChkTaxInclusive.Checked;

                var lines = new List <ServiceInvoiceLine>();

                foreach (DataGridViewRow row in GrdServiceLines.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        var line = new ServiceInvoiceLine
                        {
                            Type        = InvoiceLineType.Transaction,
                            Description = (string)row.Cells["ColDescription"].Value,
                            Total       = Convert.ToDecimal(row.Cells["ColAmount"].Value)
                        };

                        if ((row.Cells["ColAccount"].Value == null))
                        {
                            MessageBox.Show("you must select an account on each row");
                            return;
                        }
                        var accountlnk = new AccountLink {
                            UID = (Guid)row.Cells["ColAccount"].Value
                        };
                        line.Account = accountlnk;

                        if ((row.Cells["ColTax"].Value == null))
                        {
                            MessageBox.Show("you must select a taxcode on each row");
                            return;
                        }
                        var taxcodelnk = new TaxCodeLink {
                            UID = (Guid)row.Cells["ColTax"].Value
                        };
                        line.TaxCode = taxcodelnk;

                        if ((row.Cells["ColJob"].Value != null))
                        {
                            var joblnk = new JobLink {
                                UID = (Guid)row.Cells["ColJob"].Value
                            };
                            line.Job = joblnk;
                        }

                        lines.Add(line);
                    }
                }


                serviceInvoice.Lines = lines;
                serviceInvoiceSvc.Insert(MyCompanyFile, serviceInvoice, MyCredentials, OnSaveComplete, OnError);
                ShowSpinner();
            }
        }
示例#20
0
 public IAccountLinkViewModel Create(AccountLink accountLink)
 {
     return(new AccountLinkViewModel(m_loggerFactory, accountLink));
 }
示例#21
0
 internal StubAccountLinkViewModel(
     AccountLink accountLink)
 {
     m_accountLink = accountLink;
 }
        private void createinvoice()
        {
            var serviceInvoiceSvc = new ServiceInvoiceService(configuration, null,
                                                              MyOAuthKeyService);
            var serviceInvoice = new ServiceInvoice();

            if ((_invoice == null))
            {
                var customerLnk = new CustomerLink {
                    UID = (Guid)CmboCustomer.SelectedValue
                };
                serviceInvoice.Customer       = customerLnk;
                serviceInvoice.Date           = DateTime.Parse;
                serviceInvoice.IsTaxInclusive = ChkTaxInclusive.Checked;

                var lines = new List <ServiceInvoiceLine>();

                foreach (GridView1 row in GrdServiceLines.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        var line = new ServiceInvoiceLine
                        {
                            Type        = InvoiceLineType.Transaction,
                            Description = (string)row.Cells["ColDescription"].Value,
                            Total       = Convert.ToDecimal(row.Cells["ColAmount"].Value)
                        };

                        if ((row.Cells["ColAccount"].Value == null))
                        {
                            MessageBox.Show("you must select an account on each row");
                            return;
                        }
                        var accountlnk = new AccountLink {
                            UID = (Guid)row.Cells["ColAccount"].Value
                        };
                        line.Account = accountlnk;

                        if ((row.Cells["ColTax"].Value == null))
                        {
                            MessageBox.Show("you must select a taxcode on each row");
                            return;
                        }
                        var taxcodelnk = new TaxCodeLink {
                            UID = (Guid)row.Cells["ColTax"].Value
                        };
                        line.TaxCode = taxcodelnk;

                        if ((row.Cells["ColJob"].Value != null))
                        {
                            var joblnk = new JobLink {
                                UID = (Guid)row.Cells["ColJob"].Value
                            };
                            line.Job = joblnk;
                        }

                        lines.Add(line);
                    }
                }
            }
        }