예제 #1
0
        public ConfirmPage(WizardData wizardData)
        {
            InitializeComponent();

            AccountResource account = wizardData.Account;

            try
            {
                IJKEService         channel           = ServiceManager.GetChannel();
                string              today             = DateTime.Now.ToShortDateString();
                TransactionResource previewTansaction = channel.GetTransactionPreview(account.AccountNumber,
                                                                                      wizardData.Organization.Name, today, wizardData.Percentage);
                wizardData.PreviewTransaction = previewTansaction;

                AccountResource previewAccount = new AccountResource();
                previewAccount.Balance          = previewTansaction.PostBalance;
                previewAccount.Dividends        = account.Dividends;
                previewAccount.DividendsETD     = account.DividendsETD;
                previewAccount.Contributions    = account.Contributions + previewTansaction.Amount;
                previewAccount.ContributionsETD = account.ContributionsETD + previewTansaction.Amount;
                wizardData.PreviewAccount       = previewAccount;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            // Bind wizard state to UI
            this.DataContext = wizardData;
        }
예제 #2
0
        public void GetTransactionsForAccountTest()
        {
            using (JKEFactory factory = ServiceManager.CreateFactory())
            {
                IJKEService target = factory.CreateChannel();
                string      userId = "jbrown";

                AccountResource[] accounts = target.GetUserAccounts(userId);
                Assert.IsNotNull(accounts);
                Assert.IsTrue(accounts.Length > 0);
                AccountResource account = accounts[0];

                TransactionResource[] transactions = target.GetTransactionsForAccount(userId, account.Type);
                Assert.IsNotNull(transactions);
                if (transactions.Length > 0)
                {
                    foreach (TransactionResource transaction in transactions)
                    {
                        Assert.AreEqual(account.AccountNumber, transaction.AccountNumber);
                    }
                    TransactionResource lastTransaction = transactions[transactions.Length - 1];
                    Assert.AreEqual(account.Balance, lastTransaction.PostBalance);
                }
            }
        }
예제 #3
0
 public static IJKEService GetChannel()
 {
     if (channel == null)
     {
         factory = CreateFactory();
         channel = factory.CreateChannel();
     }
     return(channel);
 }
예제 #4
0
 public static IJKEService GetChannel()
 {
     if (channel == null)
     {
         factory = CreateFactory();
         channel = factory.CreateChannel();
     }
     return channel;
 }
예제 #5
0
 public void GetOrganizationsTest()
 {
     using (JKEFactory factory = ServiceManager.CreateFactory())
     {
         IJKEService            target        = factory.CreateChannel();
         OrganizationResource[] organizations = target.GetOrganizations();
         Assert.IsNotNull(organizations);
         Assert.AreEqual(4, organizations.Length);
     }
 }
예제 #6
0
 public void GetUserResourceTest()
 {
     using (JKEFactory factory = ServiceManager.CreateFactory())
     {
         IJKEService  target = factory.CreateChannel();
         string       userId = "jbrown";
         UserResource user   = target.GetUserResource(userId);
         Assert.IsNotNull(user);
         Assert.AreEqual(userId, user.UserName);
     }
 }
 public void Populate(UserResource user)
 {
     try
     {
         IJKEService       channel  = ServiceManager.GetChannel();
         AccountResource[] accounts = channel.GetUserAccounts(user.UserName);
         this.DataContext = accounts;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #8
0
 public void GetUserAccountsTest()
 {
     using (JKEFactory factory = ServiceManager.CreateFactory())
     {
         IJKEService       target   = factory.CreateChannel();
         string            userId   = "jbrown";
         AccountResource[] accounts = target.GetUserAccounts(userId);
         Assert.IsNotNull(accounts);
         foreach (AccountResource account in accounts)
         {
             Assert.AreEqual(userId, account.UserName);
         }
     }
 }
예제 #9
0
 private void Populate(AccountResource account)
 {
     try
     {
         IJKEService           channel      = ServiceManager.GetChannel();
         TransactionResource[] transactions = channel.GetTransactionsForAccount(account.UserName, account.Type);
         AccountTransactions   data         = new AccountTransactions(account, transactions);
         this.DataContext = data;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #10
0
 void AccountAccessControl_LogIn(object sender, LoginArgs e)
 {
     try
     {
         IJKEService channel = ServiceManager.GetChannel();
         this.user     = channel.GetUserResource(e.Username);
         NameText.Text = string.Format("Welcome, {0}", this.user.FirstName);
         ShowAccountsOverview();
         OnChanged("IsLoggedIn");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #11
0
 public void Populate(UserResource user)
 {
     EnableSelection(true);
     try
     {
         IJKEService       channel  = ServiceManager.GetChannel();
         AccountResource[] accounts = channel.GetUserAccounts(user.UserName);
         AccountsComboBox.ItemsSource = accounts;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     this.DataContext = null;
 }
예제 #12
0
        public AccountPage(WizardData wizardData)
        {
            InitializeComponent();

            // Bind wizard state to UI
            this.DataContext = wizardData;
            try
            {
                IJKEService            channel = ServiceManager.GetChannel();
                OrganizationResource[] orgs    = channel.GetOrganizations();
                this.OrganizationsComboBox.ItemsSource = orgs;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #13
0
        public void PostTransactionTest()
        {
            using (JKEFactory factory = ServiceManager.CreateFactory())
            {
                IJKEService target = factory.CreateChannel();
                string      userId = "jbrown";

                AccountResource[] accounts = target.GetUserAccounts(userId);
                Assert.IsNotNull(accounts);
                Assert.IsTrue(accounts.Length > 0);
                AccountResource account = accounts[0];

                OrganizationResource[] organizations = target.GetOrganizations();
                Assert.IsNotNull(organizations);
                Assert.IsTrue(organizations.Length > 0);
                OrganizationResource organization = organizations[0];

                TransactionResource[] transactions = target.GetTransactionsForAccount(userId, account.Type);
                Assert.IsNotNull(transactions);
                int before = transactions.Length;

                double percentage = 2;
                double amount     = account.Dividends * percentage / 100;

                string today = DateTime.Now.ToShortDateString();

                TransactionResource newTransaction = target.PostTransaction(account.AccountNumber, organization.Name, today, percentage);
                Assert.IsNotNull(newTransaction);

                Assert.AreEqual(amount, newTransaction.Amount);
                Assert.AreEqual(account.AccountNumber, newTransaction.AccountNumber);

                DateTime newDate = Convert.ToDateTime(newTransaction.Date, CultureInfo.InvariantCulture);
                Assert.AreEqual(today, newDate.ToShortDateString());

                Assert.AreEqual(organization.Name, newTransaction.Source);
                Assert.AreEqual(account.Balance - amount, newTransaction.PostBalance);

                transactions = target.GetTransactionsForAccount(userId, account.Type);
                Assert.IsNotNull(transactions);
                int after = transactions.Length;

                Assert.AreEqual(before + 1, after);
            }
        }
예제 #14
0
        public ReturnPage(WizardData wizardData)
        {
            InitializeComponent();

            try
            {
                IJKEService         channel     = ServiceManager.GetChannel();
                string              today       = DateTime.Now.ToShortDateString();
                TransactionResource transaction = channel.PostTransaction(wizardData.Account.AccountNumber,
                                                                          wizardData.Organization.Name, today, wizardData.Percentage);
                wizardData.Transaction = transaction;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            // Bind wizard state to UI
            this.DataContext = wizardData;
        }