예제 #1
0
    /**
     * 打开收集系统初始数据请求返回
     * @param itemData1 抽奖券
     * @param itemData2 碎片数量
     */
    public void GC_COLLECT_INIT(InputMessage data)
    {
        int       i, size;
        ArrayList itemData1 = new ArrayList();

        size = data.GetShort();
        for (i = 0; i < size; i++)
        {
            ItemData1 itemData1_Datas = new ItemData1();
            itemData1_Datas.cardType = data.GetInt();       //1 铜 2 银 3 金
            itemData1_Datas.num      = data.GetInt();       //数量
            itemData1.Add(itemData1_Datas);
        }
        ArrayList itemData2 = new ArrayList();

        size = data.GetShort();
        for (i = 0; i < size; i++)
        {
            ItemData2 itemData2_Datas = new ItemData2();
            itemData2_Datas.Itemid = data.GetInt();         //碎片物品ID
            itemData2_Datas.num    = data.GetInt();         //数量
            itemData2.Add(itemData2_Datas);
        }
        CollectHandler.Instance().GC_COLLECT_INIT(itemData1, itemData2);
    }
예제 #2
0
 public void viewItems(UserContext userContext)
 {
     ItemSummary[] itemSummaries = (ItemSummary[])dataService.getItemSummaries(userContext);
     if (itemSummaries == null || itemSummaries.Length == 0)
     {
         System.Console.WriteLine("You have no Items Added.");
     }
     else
     {
         for (int i = 0; i < itemSummaries.Length; i++)
         {
             ItemSummary itemSummary = (ItemSummary)itemSummaries[i];
             String      displayName = itemSummary.contentServiceInfo.contentServiceDisplayName;
             System.Console.WriteLine("ItemId: " + itemSummary.itemId + " DisplayName: "
                                      + displayName + " errorCode: " + itemSummary.refreshInfo.statusCode +
                                      " refreshInfo time: " /**new Date(itemSummary.refreshInfo.lastUpdatedTime * 1000)*/);
             ItemData1 id = itemSummary.itemData;
             if (id != null)
             {
                 ItemAccountData[] itemAccounts = (ItemAccountData[])id.accounts;
                 for (int j = 0; j < itemAccounts.Length; j++)
                 {
                     ItemAccountData iad = (ItemAccountData)itemAccounts[j];
                     System.Console.WriteLine("\tItemAccountId: " + iad.itemAccountInfo.itemAccountId);
                 }
             }
         }
     }
 }
예제 #3
0
        public void viewItems(UserContext userContext)
        {
            var itemSummaries = (ItemSummary[])dataService.getItemSummaries(userContext);

            if (itemSummaries == null || itemSummaries.Length == 0)
            {
                Console.WriteLine("You have no Items Added.");
            }
            else
            {
                foreach (ItemSummary itemSummary in itemSummaries)
                {
                    String displayName = itemSummary.contentServiceInfo.contentServiceDisplayName;
                    Console.WriteLine("ItemId: " + itemSummary.itemId + " DisplayName: "
                                      + displayName + " errorCode: " + itemSummary.refreshInfo.statusCode +
                                      " refreshInfo time: " /**new Date(itemSummary.refreshInfo.lastUpdatedTime * 1000)*/);
                    ItemData1 id = itemSummary.itemData;
                    if (id != null)
                    {
                        var itemAccounts = (ItemAccountData[])id.accounts;
                        foreach (var iad in itemAccounts)
                        {
                            Console.WriteLine("\tItemAccountId: " + iad.itemAccountInfo.itemAccountId);
                        }
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Displays the item information and item data information
        /// for the given loan itemSummary.
        /// </summary>
        /// <param name="itemSummary">an itemSummary whose containerType is 'loan'</param>
        public void displayLoanDataForItem(ItemSummary itemSummary)
        {
            System.Console.WriteLine("");
            String containerType = itemSummary.contentServiceInfo.containerInfo.containerName;

            if (!containerType.Equals(ContainerTypes.LOAN))
            {
                throw new Exception("DisplayLoanDataForItem called with invalid container type" +
                                    containerType);
            }

            DisplayItemInfo displayItemInfo = new DisplayItemInfo();

            displayItemInfo.displayItemSummaryInfo(itemSummary);

            // Get ItemData
            ItemData1 itemData = itemSummary.itemData;

            if (itemData == null)
            {
                System.Console.WriteLine("\tItemData is null");
            }
            else
            {
                // LoanLoginAccountData
                object[] accounts = itemData.accounts;
                if (accounts == null || accounts.Length == 0)
                {
                    System.Console.WriteLine("\tNo accounts");
                }
                else
                {
                    System.Console.WriteLine("\n\t\t**LoanLoginAccountData**");
                    for (int i = 0; i < accounts.Length; i++)
                    {
                        LoanLoginAccountData llad = (LoanLoginAccountData)accounts[i];
                        System.Console.WriteLine("\t\tLoanLoginAccountData.loanAccountNumber: " + llad.loanAccountNumber);
                        System.Console.WriteLine("\t\tLoanLoginAccountData.loanAccountNumber: " + UtcToDateTime(llad.lastUpdated.Value));

                        // Loan
                        object[] loans = llad.loans;
                        if (loans == null || loans.Length == 0)
                        {
                            System.Console.WriteLine("\t\tNo Loans.");
                        }
                        else
                        {
                            System.Console.WriteLine("\t\t\t**Loan**");
                            for (int j = 0; j < loans.Length; j++)
                            {
                                Loan loan = (Loan)loans[j];
                                System.Console.WriteLine("\t\t\tLoan.accountName: " + loan.accountName);
                                System.Console.WriteLine("\t\t\tLoan.accountNumber: " + loan.accountNumber);
                                System.Console.WriteLine("\t\t\tLoan.interestRate: " + loan.interestRate);

                                // LoanPayOffs
                                object[] loanPayOffs = loan.loanPayOffs;
                                if (loanPayOffs == null || loanPayOffs.Length == 0)
                                {
                                    System.Console.WriteLine("\t\t\tNo loanPayOffs");
                                }
                                else
                                {
                                    System.Console.WriteLine("\t\t\t\t**LoanPayoff**");
                                    for (int u = 0; u < loanPayOffs.Length; u++)
                                    {
                                        LoanPayoff loanPayOff = (LoanPayoff)loanPayOffs[u];
                                        System.Console.WriteLine("\t\t\t\tLoanPayoff.payoffAmount: " + loanPayOff.payoffAmount.amount);
                                        System.Console.WriteLine("\t\t\t\tLoan Pay By Date: " + loanPayOff.payByDate.date);
                                    }
                                }
                                // End LoanPayOffs

                                // LoanPayMentDues
                                object[] loanPaymentDues = loan.loanPaymentDues;
                                if (loanPaymentDues == null || loanPaymentDues.Length == 0)
                                {
                                    System.Console.WriteLine("\t\t\tNo loanPaymentDues");
                                }
                                else
                                {
                                    System.Console.WriteLine("\t\t\t\t**LoanPaymentDue**");
                                    for (int u = 0; u < loanPaymentDues.Length; u++)
                                    {
                                        LoanPaymentDue lpd = (LoanPaymentDue)loanPaymentDues[u];
                                        System.Console.WriteLine("\t\t\t\tLoanPaymentDue.interestAmount: " + lpd.interestAmount.amount);
                                        System.Console.WriteLine("\t\t\t\tLoanPaymentDue.principalAmount: " + lpd.principalAmount.amount);

                                        // Bill
                                        Bill bill = lpd.bill;
                                        if (bill == null)
                                        {
                                            System.Console.WriteLine("\t\t\t\t\tNo Bill");
                                        }
                                        else
                                        {
                                            System.Console.WriteLine("\t\t\t\tBill.dueDate: " + bill.dueDate.date);
                                            System.Console.WriteLine("\t\t\t\tBill.minPayment: " + bill.minPayment.amount);
                                        }
                                        // end Bill
                                    }
                                }
                                // End LoanPayMentDues

                                // LoanTransaction
                                object[] loanTransactions = loan.loanTransactions;
                                if (loanTransactions == null || loanTransactions.Length == 0)
                                {
                                    System.Console.WriteLine("\t\tNo loan tranactions");
                                }
                                else
                                {
                                    System.Console.WriteLine("\t\t\t**LoanTransaction**");
                                    for (int u = 0; u < loanTransactions.Length; u++)
                                    {
                                        LoanTransaction trans =
                                            (LoanTransaction)loanTransactions[u];
                                        System.Console.WriteLine("\t\t\t\tTranaction.amount: " + trans.amount.amount);
                                        System.Console.WriteLine("\t\t\t\tTranaction.transDate : " + (trans.transactionDate.month + '-' + trans.transactionDate.dayOfMonth + '-' + trans.transactionDate.year));
                                        System.Console.WriteLine("\t\t\t\tTransaction.description: " + trans.description);
                                        System.Console.WriteLine("\t\t\t\tTranaction.transactionType : " + trans.transactionType);
                                    }
                                }
                                // End LoanTransaction
                            }
                        }
                        // End Loan
                    }
                }
                // End LoanLoginAccountData
            }

            /*// Get AccountHistory
             * object[] acctHistories = itemData.accountHistory;
             * if(acctHistories == null || acctHistories.Length == 0)
             * {
             *      System.Console.WriteLine("\tNo Account History");
             * }
             * else
             * {
             *      System.Console.WriteLine("\n\t**Account History**");
             * for(int i = 0; i < acctHistories.Length; i++)
             *      {
             *              AccountHistory acctHistory = (AccountHistory)acctHistories[i];
             *
             *              System.Console.WriteLine("\tAccount ID: {0}", acctHistory.accountId );
             *
             *              // Get History
             *              object[] histories = acctHistory.history;
             *              if(histories == null || histories.Length == 0)
             *              {
             *                      System.Console.WriteLine("\t\tNo History");
             *              }
             *              else
             *              {
             *                      System.Console.WriteLine("\t\t**History**");
             *                      for(int j = 0; j < histories.Length; j++)
             *                      {
             *                              LoanLoginAccountData llad = (LoanLoginAccountData) histories[j];
             *                              System.Console.WriteLine("\t\tLoanLoginAccountData.loanAccountNumber: "+ llad.loanAccountNumber );
             *                              System.Console.WriteLine("\t\tLoanLoginAccountData.loanAccountNumber: " + UtcToDateTime(llad.lastUpdated.Value) );
             *
             *                              // Loan
             *                              object[] loans = llad.loans;
             *                              if (loans == null || loans.Length == 0)
             *                              {
             *                                      System.Console.WriteLine("\t\tNo Loans.");
             *                              }
             *                              else
             *                              {
             *                                      System.Console.WriteLine("\t\t\t**Loan**");
             *                                      for (int u = 0; u < loans.Length; u++)
             *                                      {
             *                                              Loan loan = (Loan) loans[u];
             *                                              System.Console.WriteLine("\t\t\tLoan.accountName: " + loan.accountName );
             *                                              System.Console.WriteLine("\t\t\tLoan.accountNumber: " + loan.accountNumber );
             *                                              System.Console.WriteLine("\t\t\tLoan.interestRate: " + loan.interestRate );
             *
             *                                      }
             *                              }
             *                      }
             *              }
             *      }
             * }
             * // end AccountHistory
             *
             */
        }
예제 #5
0
        /// <summary>
        /// Displays the item information and item data information
        /// for the given Insurance itemSummary.
        /// </summary>
        /// <param name="itemSummary">an itemSummary whose containerType is 'insurance'</param>
        public void displayInsuranceDataForItem(ItemSummary itemSummary)
        {
            System.Console.WriteLine("");
            String containerType = itemSummary.contentServiceInfo.containerInfo.containerName;

            if (!containerType.Equals(ContainerTypes.INSURANCE))
            {
                throw new Exception("DisplayInsuranceDataForItem called with invalid container type" +
                                    containerType);
            }

            DisplayItemInfo displayItemInfo = new DisplayItemInfo();

            displayItemInfo.displayItemSummaryInfo(itemSummary);

            // Get ItemData
            ItemData1 itemData = itemSummary.itemData;

            if (itemData == null)
            {
                System.Console.WriteLine("\tItemData is null");
            }
            else
            {
                // InsuranceLoginAccountData
                object[] accounts = itemData.accounts;
                if (accounts == null || accounts.Length == 0)
                {
                    System.Console.WriteLine("\tNo accounts");
                }
                else
                {
                    System.Console.WriteLine("\n\t\t**InsuranceLoginAccountData**");
                    for (int i = 0; i < accounts.Length; i++)
                    {
                        InsuranceLoginAccountData ilad = (InsuranceLoginAccountData)accounts[i];
                        System.Console.WriteLine("\t\tInsuranceLoginAccountData.lastUpdated: " + UtcToDateTime(ilad.lastUpdated.Value));

                        // InsuranceData
                        object[] insurancePolicys = ilad.insurancePolicys;
                        if (insurancePolicys == null || insurancePolicys.Length == 0)
                        {
                            System.Console.WriteLine("\t\tNo InsuranceData.");
                        }
                        else
                        {
                            System.Console.WriteLine("\t\t\t**InsuranceData**");
                            for (int j = 0; j < insurancePolicys.Length; j++)
                            {
                                InsuranceData insData = (InsuranceData)insurancePolicys[j];
                                System.Console.WriteLine("\t\t\tInsuranceData.accountNumber: " + insData.accountNumber);
                                System.Console.WriteLine("\t\t\tInsuranceData.cashValue: " + insData.cashValue.amount);
                                System.Console.WriteLine("\t\t\tInsuranceData.insuranceType: " + insData.insuranceType);
                            }
                        }
                        // End InsuranceData
                    }
                }
                // End InsuranceLoginAccountData
            }
        }
예제 #6
0
        /// <summary>
        /// Displays the item information and item data information
        /// for the given investment itemSummary.
        /// </summary>
        /// <param name="itemSummary">an itemSummary whose containerType is 'stocks'</param>
        public void displayInvestmentDataForItem(ItemSummary itemSummary)
        {
            System.Console.WriteLine("");
            String containerType = itemSummary.contentServiceInfo.containerInfo.containerName;

            if (!containerType.Equals(ContainerTypes.INVESTMENT))
            {
                throw new Exception("DisplayInvestmentDataForItem called with invalid container type" +
                                    containerType);
            }

            DisplayItemInfo displayItemInfo = new DisplayItemInfo();

            displayItemInfo.displayItemSummaryInfo(itemSummary);

            // Get ItemData
            ItemData1 itemData = itemSummary.itemData;

            if (itemData == null)
            {
                System.Console.WriteLine("\tItemData is null");
            }
            else
            {
                // InvestmentData
                object[] accounts = itemData.accounts;
                if (accounts == null || accounts.Length == 0)
                {
                    System.Console.WriteLine("\tNo accounts");
                }
                else
                {
                    System.Console.WriteLine("\n\t\t**InvestmentData**");
                    for (int i = 0; i < accounts.Length; i++)
                    {
                        InvestmentData investment = (InvestmentData)accounts[i];
                        System.Console.WriteLine("\t\tAccount Name: " + investment.accountName);
                        System.Console.WriteLine("\t\tAccount Number: " + investment.accountNumber);
                        System.Console.WriteLine("\t\tAccount Holder: " + investment.accountHolder);
                        System.Console.WriteLine("\t\tAccount Type: " + investment.acctType);
                        System.Console.WriteLine("\t\tCash: " + investment.cash);
                        System.Console.WriteLine("\t\tTotal Balance: " + investment.totalBalance.amount);
                        System.Console.WriteLine("\t\tTotal Vested Balance: " + investment.totalVestedBalance.amount);
                        System.Console.WriteLine("\t\tTotal Unvested Balance: " + investment.totalUnvestedBalance.amount);
                        System.Console.WriteLine("\t\tMargin Balance: " + investment.marginBalance.amount);
                        System.Console.WriteLine("\t\tlastUpdated: " + UtcToDateTime(investment.lastUpdated.Value));

                        // HoldingData
                        object[] holdings = investment.holdings;
                        if (holdings == null || holdings.Length == 0)
                        {
                            System.Console.WriteLine("\t\tNo investment holdings.");
                        }
                        else
                        {
                            System.Console.WriteLine("\t\t\t**HoldingData**");
                            for (int j = 0; j < holdings.Length; j++)
                            {
                                HoldingData holding = (HoldingData)holdings[j];
                                System.Console.WriteLine("\t\t\tHoldingData Symbol: " + holding.symbol);
                                System.Console.WriteLine("\t\t\tHoldingData Quantity: " + holding.quantity);
                                System.Console.WriteLine("\t\t\tHoldingData Value: " + holding.value.amount);
                                System.Console.WriteLine("\t\t\tHoldingData Description: " + holding.description);
                                System.Console.WriteLine("\t\t\tHoldingData Price: " + holding.price.amount);
                                System.Console.WriteLine("\t\t\tHoldingData Link: " + holding.link);
                                System.Console.WriteLine("\t\t\tHoldingData HoldingType: " + holding.holdingType);
                                System.Console.WriteLine("\t\t\tHoldingData HoldingTypeId: " + holding.holdingTypeId);
                                System.Console.WriteLine("\t\t\tHoldingData Percentage Allocaton: " + holding.percentAllocation);
                                System.Console.WriteLine("\t\t\tHoldingData Percantage Change: " + holding.percentageChange);
                                System.Console.WriteLine("\t\t\tHoldingData Employee Contribution: " + holding.employeeContribution);
                                System.Console.WriteLine("\t\t\tHoldingData Employeer Contribution: " + holding.employerContribution);
                                System.Console.WriteLine("\t\t\tHoldingData Cusip Number: " + holding.cusipNumber);
                                System.Console.WriteLine("\t\t\tHoldingData Daily Change: " + holding.dailyChange);
                                System.Console.WriteLine("\t\t\tHoldingData Cost Basis: " + holding.costBasis.amount + "\n");

                                // TaxLots
                                object[] taxLots = holding.taxLots;
                                if (taxLots == null || taxLots.Length == 0)
                                {
                                    System.Console.WriteLine("\t\t\tNo holdings taxLots");
                                }
                                else
                                {
                                    System.Console.WriteLine("\t\t\t\t**TaxLot**");
                                    for (int u = 0; u < taxLots.Length; u++)
                                    {
                                        TaxLot taxLot = (TaxLot)taxLots[u];
                                        System.Console.WriteLine("\t\t\t\tTaxLot Symbol: " + taxLot.symbol);
                                        System.Console.WriteLine("\t\t\t\tTaxLot Description: " + taxLot.description);
                                        System.Console.WriteLine("\t\t\t\tTaxLot Quantity: " + taxLot.quantity);
                                        System.Console.WriteLine("\t\t\t\tTaxLot Amount: " + taxLot.amount.amount);
                                        System.Console.WriteLine("\t\t\t\tTaxLot Price: " + taxLot.price.amount);
                                        System.Console.WriteLine("\t\t\t\tTaxLot Link: " + taxLot.link);
                                        System.Console.WriteLine("\t\t\t\tTaxLot Cusip Number: " + taxLot.cusipNumber + "\n");
                                    }
                                }
                                // End TaxLot
                            }
                        }
                        // End HoldingData

                        // InvestmentTransactionData
                        object[] investTransactions = investment.investmentTransactions;
                        if (investTransactions == null || investTransactions.Length == 0)
                        {
                            System.Console.WriteLine("\t\tNo investment tranactions");
                        }
                        else
                        {
                            System.Console.WriteLine("\t\t\t**InvestmentTransactionsData**");
                            for (int j = 0; j < investTransactions.Length; j++)
                            {
                                InvestmentTransactionsData trans =
                                    (InvestmentTransactionsData)investTransactions[j];
                                System.Console.WriteLine("\t\t\tTranaction.symbol: " + trans.symbol);
                                System.Console.WriteLine("\t\t\tTranaction.amount: " + trans.amount.amount);
                                System.Console.WriteLine("\t\t\tTranaction.price : " + trans.price.amount);
                                System.Console.WriteLine("\t\t\tTranaction.quantity : " + trans.quantity);
                                System.Console.WriteLine("\t\t\tTranaction.transDate : " + trans.transDate.date);
                                System.Console.WriteLine("\t\t\tTransaction.description: " + trans.description);
                                System.Console.WriteLine("\t\t\tTranaction.link : " + trans.link);
                                System.Console.WriteLine("\t\t\tTranaction.transactionType : " + trans.transactionType);
                                System.Console.WriteLine("\t\t\tTranaction.confirmantionNumber : " + trans.confirmationNumber + "\n");
                            }
                        }
                        // End InvestmentTransactionData
                    }
                }
                // End InvestmentData
            }

/*
 *                      // Get AccountHistory
 *                      object[] acctHistories = itemData.accountHistory;
 *                      if(acctHistories == null || acctHistories.Length == 0)
 *                      {
 *                              System.Console.WriteLine("\tNo Account History");
 *                      }
 *                      else
 *                      {
 *                              System.Console.WriteLine("\n\t**Account History**");
 *                              for(int i = 0; i < acctHistories.Length; i++)
 *                              {
 *                                      AccountHistory acctHistory = (AccountHistory)acctHistories[i];
 *
 *                                      System.Console.WriteLine("\tAccount ID: {0}", acctHistory.accountId );
 *
 *                                      // Get History
 *                                      object[] histories = acctHistory.history;
 *                                      if(histories == null || histories.Length == 0)
 *                                      {
 *                                              System.Console.WriteLine("\t\tNo History");
 *                                      }
 *                                      else
 *                                      {
 *                                              System.Console.WriteLine("\t\t**History**");
 *                                              for(int j = 0; j < histories.Length; j++)
 *                                              {
 *                                                      InvestmentData investment = (InvestmentData) histories[j];
 *                                                      System.Console.WriteLine("\t\taccountName: "+ investment.accountName );
 *                                                      System.Console.WriteLine("\t\taccountNumber: "+ investment.accountNumber );
 *                                                      System.Console.WriteLine("\t\taccountHolder: "+ investment.accountHolder );
 *                                                      System.Console.WriteLine("\t\tacctType: "+ investment.acctType );
 *                                                      System.Console.WriteLine("\t\tcash: "+ investment.cash );
 *                                                      System.Console.WriteLine("\t\ttotalBalance: "+ investment.totalBalance.amount );
 *                                                      System.Console.WriteLine("\t\ttotalVestedBalance: "+ investment.totalVestedBalance.amount );
 *                                                      System.Console.WriteLine("\t\ttotalUnvestedBalance: "+ investment.totalUnvestedBalance.amount );
 *                                                      System.Console.WriteLine("\t\tmarginBalance: "+ investment.marginBalance.amount );
 *                                                      System.Console.WriteLine("\t\tlastUpdated: " + UtcToDateTime(investment.lastUpdated.Value) + "\n");
 *                                              }
 *                                      }
 *                              }
 *                      }
 *                      // AccountHistory*/
        }
예제 #7
0
        /// <summary>
        /// Displays the item information and item data information
        /// for the given bank itemSummary.
        /// </summary>
        /// <param name="itemSummary">an itemSummary whose containerType is 'bank'</param>
        public void DisplayCardDataForItem(ItemSummary itemSummary)
        {
            System.Console.WriteLine("");
            String containerType = itemSummary.contentServiceInfo.containerInfo.containerName;

            if (!containerType.Equals(ContainerTypes.CREDIT_CARD))
            {
                throw new Exception("DisplayCardDataForItem called with invalid container type" +
                                    containerType);
            }

            DisplayItemInfo displayItemInfo = new DisplayItemInfo();

            displayItemInfo.displayItemSummaryInfo(itemSummary);

            // Get ItemData
            ItemData1 itemData = itemSummary.itemData;

            if (itemData == null)
            {
                System.Console.WriteLine("\tItemData is null");
            }
            else
            {
                // CardData
                object[] accounts = itemData.accounts;
                if (accounts == null || accounts.Length == 0)
                {
                    System.Console.WriteLine("\tNo accounts");
                }
                else
                {
                    System.Console.WriteLine("\n\t\t**CardData**");
                    for (int i = 0; i < accounts.Length; i++)
                    {
                        CardData cardData = (CardData)accounts[i];
                        System.Console.WriteLine("\t\taccountNumber : " + cardData.accountNumber);
                        System.Console.WriteLine("\t\taccountId : " + cardData.accountId);
                        System.Console.WriteLine("\t\tamountDue : " + cardData.amountDue.amount);
                        System.Console.WriteLine("\t\tlastPayment : " + cardData.lastPayment.amount);
                        System.Console.WriteLine("\t\tminPayment : " + cardData.minPayment);
                        System.Console.WriteLine("\t\trunningBalance : " + cardData.runningBalance.amount);
                        System.Console.WriteLine("\t\tavailableCredit : " + cardData.availableCredit.amount);
                        System.Console.WriteLine("\t\ttotalCreditLine : " + cardData.totalCreditLine.amount);
                        System.Console.WriteLine("\t\tlastUpdated: " + UtcToDateTime(cardData.lastUpdated.Value));

                        // CardStatementData
                        object[] cardStatements = cardData.cardStatements;
                        if (cardStatements == null || cardStatements.Length == 0)
                        {
                            System.Console.WriteLine("\t\tNo card statements");
                        }
                        else
                        {
                            System.Console.WriteLine("\t\t\t**CardStatementData**");
                            for (int j = 0; j < cardStatements.Length; j++)
                            {
                                CardStatementData csd = (CardStatementData)cardStatements[j];
                                System.Console.WriteLine("\t\t\tCardStatementData availableCredit: " + csd.availableCredit.amount);
                                System.Console.WriteLine("\t\t\tCardStatementData availableCash: " + csd.availableCash.amount);
                                System.Console.WriteLine("\t\t\tCardStatementData credit: " + csd.credit.amount);
                                System.Console.WriteLine("\t\t\tCardStatementData payments: " + csd.payments.amount);

                                // CardTransactionData
                                object[] cardStatementTransactions = csd.cardTransactions;
                                if (cardStatementTransactions == null || cardStatementTransactions.Length == 0)
                                {
                                    System.Console.WriteLine("\t\t\tNo card transactions");
                                }
                                else
                                {
                                    System.Console.WriteLine("\t\t\t\t**CardTransactionData**");
                                    for (int u = 0; u < cardStatementTransactions.Length; u++)
                                    {
                                        CardTransactionData ctd =
                                            (CardTransactionData)cardStatementTransactions[u];
                                        System.Console.WriteLine("\t\t\t\tTransaction transactionType: " + ctd.transactionType);
                                        System.Console.WriteLine("\t\t\t\tTransaction description: " + ctd.description);
                                        System.Console.WriteLine("\t\t\t\tTransaction postDate: " + ctd.postDate.date);
                                        System.Console.WriteLine("\t\t\t\tTransaction transAmount: " + ctd.transAmount.amount);
                                        System.Console.WriteLine("\t\t\t\tTransaction transDate: " + ctd.transDate.date);
                                    }
                                }
                                // End CardTransactionData
                            }
                        }
                        // End CardStatementData

                        // CardTransactionData
                        object[] cardTransactions = cardData.cardTransactions;
                        if (cardTransactions == null || cardTransactions.Length == 0)
                        {
                            System.Console.WriteLine("\t\tNo card transactions");
                        }
                        else
                        {
                            System.Console.WriteLine("\t\t\t**CardTransactionData**");
                            for (int j = 0; j < cardTransactions.Length; j++)
                            {
                                CardTransactionData ctd =
                                    (CardTransactionData)cardTransactions[j];
                                System.Console.WriteLine("\t\t\tTransaction transactionType: " + ctd.transactionType);
                                System.Console.WriteLine("\t\t\tTransaction description: " + ctd.description);
                                System.Console.WriteLine("\t\t\tTransaction postDate: " + ctd.postDate.date);
                                System.Console.WriteLine("\t\t\tTransaction transAmount: " + ctd.transAmount.amount);
                                System.Console.WriteLine("\t\t\tTransaction transDate: " + ctd.transDate.date);
                            }
                        }
                        // End CardTransactionData
                    }
                }
                // End CardData
            }

            /*// Get AccountHistory
             * object[] acctHistories = itemData.accountHistory;
             * if(acctHistories == null || acctHistories.Length == 0)
             * {
             *      System.Console.WriteLine("\tNo Account History");
             * }
             * else
             * {
             *      System.Console.WriteLine("\n\t**Account History**");
             *      for(int i = 0; i < acctHistories.Length; i++)
             *      {
             *              AccountHistory acctHistory = (AccountHistory)acctHistories[i];
             *
             *              System.Console.WriteLine("\tAccount ID: {0}", acctHistory.accountId );
             *
             *              // Get History
             *              object[] histories = acctHistory.history;
             *              if(histories == null || histories.Length == 0)
             *              {
             *                      System.Console.WriteLine("\t\tNo History");
             *              }
             *              else
             *              {
             *                      System.Console.WriteLine("\t\t**History**");
             *                      for(int j = 0; j < histories.Length; j++)
             *                      {
             *                              //BankData bankData = (BankData)histories[j];
             *                              CardData cardData = (CardData) histories[j];
             *                              System.Console.WriteLine("\t\taccountNumber : " + cardData.accountNumber );
             *                              System.Console.WriteLine("\t\taccountId : " + cardData.accountId );
             *                              System.Console.WriteLine("\t\tamountDue : " + cardData.amountDue.amount );
             *                              System.Console.WriteLine("\t\tlastPayment : " + cardData.lastPayment.amount );
             *                              System.Console.WriteLine("\t\tminPayment : " + cardData.minPayment );
             *                              System.Console.WriteLine("\t\trunningBalance : " + cardData.runningBalance.amount );
             *                              System.Console.WriteLine("\t\tavailableCredit : " + cardData.availableCredit.amount );
             *                              System.Console.WriteLine("\t\ttotalCreditLine : " + cardData.totalCreditLine.amount );
             *                              System.Console.WriteLine("\t\tlastUpdated: " + UtcToDateTime(cardData.lastUpdated.Value) );
             *                      }
             *              }
             *      }
             * }
             * // AccountHistory*/
        }
예제 #8
0
        /// <summary>
        /// Displays the item information and item data information
        /// for the given bank itemSummary.
        /// </summary>
        /// <param name="itemSummary">an itemSummary whose containerType is 'bank'</param>
        public void displayBankDataForItem(ItemSummary itemSummary)
        {
            System.Console.WriteLine("");
            String containerType = itemSummary.contentServiceInfo.containerInfo.containerName;

            if (!containerType.Equals("bank"))
            {
                throw new Exception("displayBankDataForItem called with invalid container type" + containerType);
            }

            DisplayItemInfo displayItemInfo = new DisplayItemInfo();

            displayItemInfo.displayItemSummaryInfo(itemSummary);

            // Get ItemData
            ItemData1 itemData = itemSummary.itemData;

            if (itemData == null)
            {
                System.Console.WriteLine("\tItemData is null");
            }
            else
            {
                object[] accounts = itemData.accounts;
                if (accounts == null || accounts.Length == 0)
                {
                    System.Console.WriteLine("\tNo accounts");
                }
                else
                {
                    for (int i = 0; i < accounts.Length; i++)
                    {
                        System.Console.WriteLine("\n\t\t**BankData**");
                        BankData bankData = (BankData)accounts[i];
                        System.Console.WriteLine("\t\tBank Account Name: {0}",
                                                 bankData.accountName);
                        System.Console.WriteLine("\t\tBank Account Cust Description: {0}",
                                                 bankData.customDescription);
                        System.Console.WriteLine("\t\tBank Account Identifier: {0}",
                                                 bankData.bankAccountId);
                        System.Console.WriteLine("\t\tBank Account Balance: {0}",
                                                 bankData.availableBalance.amount);
                        System.Console.WriteLine("\t\tBank Current Balance: {0}",
                                                 bankData.currentBalance.amount);
                        System.Console.WriteLine("\t\tBank Current Acct Type: {0}",
                                                 bankData.acctType);
                        System.Console.WriteLine("\t\tBank Current As of Date: {0}",
                                                 bankData.asOfDate.date);

                        // BankTransactionData
                        object[] bankTransactions = bankData.bankTransactions;
                        if (bankTransactions == null || bankTransactions.Length == 0)
                        {
                            System.Console.WriteLine("\t\tNo bank transactions");
                        }
                        else
                        {
                            System.Console.WriteLine("\n\t\t**BankTransactionData**");
                            for (int j = 0; j < bankTransactions.Length; j++)
                            {
                                BankTransactionData transactionData =
                                    (BankTransactionData)bankTransactions[j];
                                System.Console.WriteLine("\t\t\tTransaction Id: {0}",
                                                         transactionData.bankTransactionId);
                                System.Console.WriteLine("\t\t\tTransaction Description: {0}",
                                                         transactionData.description);
                                System.Console.WriteLine("\t\t\tTransaction Amount: {0}",
                                                         transactionData.transactionAmount.amount);
                                System.Console.WriteLine("\t\t\tTransaction Base Type: {0}",
                                                         transactionData.transactionBaseType);
                                System.Console.WriteLine("\t\t\tCategory: {0}",
                                                         transactionData.category);
                                System.Console.WriteLine("");
                            }
                        }
                        System.Console.WriteLine("");
                    }
                }
            }

            // Get AccountHistory

            object[] acctHistories = itemData.accountHistory;
            if (acctHistories == null || acctHistories.Length == 0)
            {
                System.Console.WriteLine("\tNo Account History");
            }
            else
            {
                System.Console.WriteLine("\n\t**Account History**");
                for (int i = 0; i < acctHistories.Length; i++)
                {
                    AccountHistory acctHistory = (AccountHistory)acctHistories[i];

                    System.Console.WriteLine("\tAccount ID: {0}", acctHistory.accountId);

                    // Get History
                    object[] histories = acctHistory.history;
                    if (histories == null || histories.Length == 0)
                    {
                        System.Console.WriteLine("\t\tNo History");
                    }
                    else
                    {
                        System.Console.WriteLine("\t\t**History**");
                        for (int j = 0; j < histories.Length; j++)
                        {
                            BankData bankData = (BankData)histories[j];
                            System.Console.WriteLine("\t\tBank Account Name: {0}",
                                                     bankData.accountName);
                            System.Console.WriteLine("\t\tBank Account Cust Description: {0}",
                                                     bankData.customDescription);
                            System.Console.WriteLine("\t\tBank Account Identifier: {0}",
                                                     bankData.bankAccountId);
                            System.Console.WriteLine("\t\tBank Account Balance: {0}",
                                                     bankData.availableBalance.amount);
                            System.Console.WriteLine("\t\tBank Current Balance: {0}",
                                                     bankData.currentBalance.amount);
                            System.Console.WriteLine("\t\tBank Current Acct Type: {0}",
                                                     bankData.acctType);
                            System.Console.WriteLine("\t\tBank Current As of Date: {0}",
                                                     bankData.asOfDate.date);
                            System.Console.WriteLine("\t\tLast Updated: {0}\n",
                                                     UtcToDateTime(bankData.lastUpdated.Value));
                        }
                    }
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Displays the item information and item data information
        /// for the given bank itemSummary.
        /// </summary>
        /// <param name="userContext"></param>
        /// <param name="itemId"></param>
        /// <param name="itemSummaryInfo"></param>
        /// <param name="error"></param>
        /// <param name="bankTransactionDataList"></param>
        public void GetBankDataForItem(UserContext userContext, long itemId, out string itemSummaryInfo, out string error, out Dictionary <BankData, List <BankTransactionData> > bankTransactionDataList)
        {
            Log.Debug(string.Format("GetBankDataForItem: userContex valid {0}, itemId {1}", userContext.valid, itemId));
            var dataExtent = new DataExtent
            {
                startLevel          = 0,
                endLevel            = int.MaxValue,
                startLevelSpecified = true,
                endLevelSpecified   = true
            };

            ItemSummary itemSummary = dataService.getItemSummaryForItem1(userContext, itemId, true, dataExtent);

            if (itemSummary == null)
            {
                throw new Exception(string.Format("Item for item id {0} not found", itemId));
            }

            error = "";
            bankTransactionDataList = new Dictionary <BankData, List <BankTransactionData> >();

            String containerType = itemSummary.contentServiceInfo.containerInfo.containerName;

            if (!containerType.Equals("bank"))
            {
                throw new Exception("displayBankDataForItem called with invalid container type" + containerType);
            }

            var displayItemInfo = new DisplayItemInfo();

            itemSummaryInfo = displayItemInfo.getItemSummaryInfo(itemSummary);
            Log.Debug(itemSummaryInfo);
            // Get ItemData
            ItemData1 itemData = itemSummary.itemData;

            if (itemData == null)
            {
                error += "\tItemData is null";
            }
            else
            {
                object[] accounts = itemData.accounts;
                if (accounts == null || accounts.Length == 0)
                {
                    Log.Warn("Yodlee get bank data: No accounts");
                }
                else
                {
                    foreach (object account in accounts)
                    {
                        var bankData = (BankData)account;
                        bankTransactionDataList.Add(bankData, new List <BankTransactionData>());
                        object[] bankTransactions = bankData.bankTransactions;
                        if (bankTransactions == null || bankTransactions.Length == 0)
                        {
                            Log.Warn("Yodlee get bank data: No bank transactions");
                        }
                        else
                        {
                            foreach (object bankTransaction in bankTransactions)
                            {
                                var transactionData =
                                    (BankTransactionData)bankTransaction;
                                bankTransactionDataList[bankData].Add(transactionData);
                            }
                        }
                    }
                }
            }
            // Get AccountHistory

            if (itemData != null)
            {
                object[] acctHistories = itemData.accountHistory;
                if (acctHistories == null || acctHistories.Length == 0)
                {
                    //error += "\tNo Account History";
                }
                else
                {
                    foreach (object accountHistory in acctHistories)
                    {
                        var acctHistory = (AccountHistory)accountHistory;

                        Log.Debug(string.Format("\tHistory For Account ID: {0}", acctHistory.accountId));

                        // Get History
                        object[] histories = acctHistory.history;
                        if (histories == null || histories.Length == 0)
                        {
                            Log.Warn("Yodlee get bank data: No History");
                        }
                        else
                        {
                            foreach (object history in histories)
                            {
                                var bankData = (BankData)history;
                                Log.Debug(
                                    string.Format(
                                        "Account History: Bank Account Name: {0}, Bank Account Cust Description: {1} Bank Account Identifier: {2} Bank Account Balance: {3} Bank Current Balance: {4} Bank Current Acct Type: {5} Bank Current As of Date: {6} Last Updated: {7}",
                                        bankData.accountName, bankData.customDescription, bankData.bankAccountId, bankData.availableBalance.amount,
                                        bankData.currentBalance.amount, bankData.acctType, bankData.asOfDate.date,
                                        UtcToDateTime(bankData.lastUpdated.HasValue ? bankData.lastUpdated.Value : 0)));
                            }
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(error))
            {
                Log.Warn(error);
            }
        }
예제 #10
0
        /// <summary>
        /// Displays the item information and item data information
        /// for the given bill itemSummary.
        /// </summary>
        /// <param name="itemSummary">an itemSummary whose containerType is 'bills'</param>
        public void displayBillsDataForItem(ItemSummary itemSummary)
        {
            System.Console.WriteLine("");
            String containerType = itemSummary.contentServiceInfo.containerInfo.containerName;

            if (!containerType.Equals(ContainerTypes.BILL))
            {
                throw new Exception("DisplayBillsDataForItem called with invalid container type" +
                                    containerType);
            }

            DisplayItemInfo displayItemInfo = new DisplayItemInfo();

            displayItemInfo.displayItemSummaryInfo(itemSummary);

            // Get ItemData
            ItemData1 itemData = itemSummary.itemData;

            if (itemData == null)
            {
                System.Console.WriteLine("\tItemData is null");
            }
            else
            {
                // BillsData
                object[] accounts = itemData.accounts;
                if (accounts == null || accounts.Length == 0)
                {
                    System.Console.WriteLine("\tNo accounts");
                }
                else
                {
                    System.Console.WriteLine("\n\t\t**BillsData**");
                    for (int i = 0; i < accounts.Length; i++)
                    {
                        BillsData billsData = (BillsData)accounts[i];
                        System.Console.WriteLine("\t\tBillsData.accountHolder: " + billsData.accountHolder);
                        System.Console.WriteLine("\t\tBillsData.accountId: " + billsData.accountId);
                        System.Console.WriteLine("\t\tBillsData.lastUpdated: " + UtcToDateTime(billsData.lastUpdated.Value));

                        // Bills
                        object[] bills = billsData.bills;
                        if (bills == null || bills.Length == 0)
                        {
                            System.Console.WriteLine("\t\tNo bills holdings.");
                        }
                        else
                        {
                            System.Console.WriteLine("\t\t\t**HoldingData**");
                            for (int j = 0; j < bills.Length; j++)
                            {
                                Bill bill = (Bill)bills[j];
                                System.Console.WriteLine("\t\t\tBill.accountNumber: " + bill.accountNumber);
                                System.Console.WriteLine("\t\t\tBill.acctType: " + bill.acctType);
                                System.Console.WriteLine("\t\t\tBill.pastDue: " + bill.pastDue.amount);
                                System.Console.WriteLine("\t\t\tBill.lastpayment: " + bill.lastPayment);
                                System.Console.WriteLine("\t\t\tBill.amountDue: " + bill.amountDue);
                                System.Console.WriteLine("\t\t\tBill.minPayment: " + bill.minPayment);

                                // AccountUsageData
                                object[] accountUsages = bill.accountUsages;
                                if (accountUsages == null || accountUsages.Length == 0)
                                {
                                    System.Console.WriteLine("\t\t\tNo accountUsages");
                                }
                                else
                                {
                                    System.Console.WriteLine("\t\t\t\t**AccountUsageData**");
                                    for (int u = 0; u < accountUsages.Length; u++)
                                    {
                                        AccountUsageData aud = (AccountUsageData)accountUsages[u];
                                        System.Console.WriteLine("\t\t\t\tAccountUsageData.billId: " + aud.billId);
                                        System.Console.WriteLine("\t\t\t\tAccountUsageData.unitsUsed: " + aud.unitsUsed);
                                    }
                                }
                                // End AccountUsageData
                            }
                        }
                        // End Bills
                    }
                }
                // End BillsData
            }
        }