コード例 #1
0
ファイル: Balance.cs プロジェクト: dlsteuer/OFXSharp
        public Balance(XmlNode ledgerNode, XmlNode avaliableNode)
        {
            string tempLedgerBalance = ledgerNode.GetValue("BALAMT");

            if (!String.IsNullOrEmpty(tempLedgerBalance))
            {
                LedgerBalance = Convert.ToDecimal(tempLedgerBalance);
            }
            else
            {
                throw new OFXParseException("Ledger balance has not been set");
            }

            string tempAvaliableBalance = avaliableNode.GetValue("BALAMT");

            if (!String.IsNullOrEmpty(tempAvaliableBalance))
            {
                AvaliableBalance = Convert.ToDecimal(tempAvaliableBalance);
            }
            else
            {
                throw new OFXParseException("Avaliable balance has not been set");
            }

            LedgerBalanceDate = ledgerNode.GetValue("DTASOF").ToDate();
            AvaliableBalanceDate = avaliableNode.GetValue("DTASOF").ToDate();
        }
コード例 #2
0
ファイル: Rectangle.cs プロジェクト: unhammer/gimp-sharp
 public Rectangle(XmlNode node)
 {
     Left = new VerticalSlice(node.GetValue("left"));
       Right = new VerticalSlice(node.GetValue("right"));
       Top = new HorizontalSlice(node.GetValue("top"));
       Bottom = new HorizontalSlice(node.GetValue("bottom"));
 }
コード例 #3
0
ファイル: SignOn.cs プロジェクト: pguptac/OFXSharp
 public SignOn(XmlNode node)
 {
     StatusCode = Convert.ToInt32(node.GetValue("//CODE"));
     StatusSeverity = node.GetValue("//SEVERITY");
     DTServer = node.GetValue("//DTSERVER").ToDate();
     Language = node.GetValue("//LANGUAGE");
     IntuBid = node.GetValue("//INTU.BID");
 }
コード例 #4
0
ファイル: SignOn.cs プロジェクト: flashtopia/OFXSharp
 public SignOn(XmlNode node)
 {
     StatusCode = Convert.ToInt32(node.GetValue("STATUS/CODE"));
     StatusSeverity = node.GetValue("STATUS/SEVERITY");
     DTServer = Convert.ToInt64(node.GetValue("DTSERVER"));
     Language = node.GetValue("LANGUAGE");
     IntuBid = node.GetValue("INTU.BID");
 }
コード例 #5
0
ファイル: Balance.cs プロジェクト: flashtopia/OFXSharp
        public Balance(XmlNode ledgerNode, XmlNode avaliableNode)
        {
            var tempLedgerBalance = ledgerNode.GetValue("BALAMT");

             if (!String.IsNullOrEmpty(tempLedgerBalance))
             {
            // ***** Forced Invariant Culture.
            // If you don't force it, it will use the computer's default (defined in windows control panel, regional settings)
            // So, if the number format of the computer in use it's different from OFX standard (i suppose the english/invariant),
            // the next line of could crash or (worse) the number would be wrongly interpreted.
            // For example, my computer has a brazilian regional setting, with "." as thousand separator and "," as
            // decimal separator, so the value "10.99" (ten 'dollars' (or whatever currency) and ninetynine cents) would be interpreted as "1099"
            // (one thousand and ninetynine dollars - the "." would be ignored)
            LedgerBalance = Convert.ToDecimal(tempLedgerBalance, CultureInfo.InvariantCulture);
             }
             else
             {
            throw new OFXParseException("Ledger balance has not been set");
             }

             // ***** OFX files from my bank don't have the 'avaliableNode' node, so i manage a null situation
             if (avaliableNode == null)
             {
            AvaliableBalance = 0;

            // ***** this member veriable should be a nullable DateTime, declared as:
            // public DateTime? LedgerBalanceDate { get; set; }
            // and next line could be:
            // AvaliableBalanceDate = null;
            AvaliableBalanceDate = new DateTime();
             }
             else
             {
            var tempAvaliableBalance = avaliableNode.GetValue("BALAMT");

            if (!String.IsNullOrEmpty(tempAvaliableBalance))
            {
               // ***** Forced Invariant Culture. (same commment as above)
               AvaliableBalance = Convert.ToDecimal(tempAvaliableBalance, CultureInfo.InvariantCulture);
            }
            else
            {
               throw new OFXParseException("Avaliable balance has not been set");
            }
            AvaliableBalanceDate = avaliableNode.GetValue("DTASOF").ToDate();
             }

             LedgerBalanceDate = ledgerNode.GetValue("DTASOF").ToDate();
        }
コード例 #6
0
ファイル: Account.cs プロジェクト: jbob24/fp
        public Account(XmlNode node, AccountType type)
        {
            AccountType = type;

            AccountID = node.GetValue("//ACCTID");
            AccountKey = node.GetValue("//ACCTKEY");

            switch (AccountType)
            {
                case AccountType.BANK:
                    InitializeBank(node);
                    break;
                case AccountType.AP:
                    InitializeAP(node);
                    break;
                case AccountType.AR:
                    InitializeAR(node);
                    break;
                default:
                    break;
            }
        }
コード例 #7
0
ファイル: Slice.cs プロジェクト: unhammer/gimp-sharp
        protected static Slice LoadFromNode(XmlNode node, Slice slice)
        {
            slice.Position = node.GetValue("position");
              slice.Index = node.GetValue("index");
              slice.Begin = new HorizontalSlice(node.GetValue("begin"));
              slice.End = new HorizontalSlice(node.GetValue("end"));
              slice.Changed = false;

              return slice;
        }
コード例 #8
0
ファイル: Account.cs プロジェクト: jbob24/fp
        /// <summary>
        /// Initializes information specific to bank
        /// </summary>
        private void InitializeBank(XmlNode node)
        {
            BankID = node.GetValue("//BANKID");
            BranchID = node.GetValue("//BRANCHID");

            //Get Bank Account Type from XML
            string bankAccountType = node.GetValue("//ACCTTYPE");

            //Check that it has been set
            if (String.IsNullOrEmpty(bankAccountType))
                throw new OFXParseException("Bank Account type unknown");

            //Set bank account enum
            _BankAccountType = bankAccountType.GetBankAccountType();
        }
コード例 #9
0
ファイル: Transaction.cs プロジェクト: rapidone/OFXSharp
        public Transaction(XmlNode node, string currency)
        {
            TransType = GetTransactionType(node.GetValue("//TRNTYPE"));
             Date = node.GetValue("//DTPOSTED").ToDate();
             TransactionInitializationDate = node.GetValue("//DTUSER").ToDate();
             FundAvaliabilityDate = node.GetValue("//DTAVAIL").ToDate();

             try
             {
            Amount = Convert.ToDecimal(node.GetValue("//TRNAMT"), CultureInfo.InvariantCulture);
             }
             catch (Exception ex)
             {
            throw new OFXParseException("Transaction Amount unknown", ex);
             }

             try
             {
            TransactionID = node.GetValue("//FITID");
             }
             catch (Exception ex)
             {
            throw new OFXParseException("Transaction ID unknown", ex);
             }

             IncorrectTransactionID = node.GetValue("//CORRECTFITID");

             //If Transaction Correction Action exists, populate
             var tempCorrectionAction = node.GetValue("//CORRECTACTION");

             TransactionCorrectionAction = !String.IsNullOrEmpty(tempCorrectionAction)
                                          ? GetTransactionCorrectionType(tempCorrectionAction)
                                          : TransactionCorrectionType.NA;

             ServerTransactionID = node.GetValue("//SRVRTID");
             CheckNum = node.GetValue("//CHECKNUM");
             ReferenceNumber = node.GetValue("//REFNUM");
             Sic = node.GetValue("//SIC");
             PayeeID = node.GetValue("//PAYEEID");
             Name = node.GetValue("//NAME");
             Memo = node.GetValue("//MEMO");

             //If differenct currency to CURDEF, populate currency
             if (NodeExists(node, "//CURRENCY"))
            Currency = node.GetValue("//CURRENCY");
             else if (NodeExists(node, "//ORIGCURRENCY"))
            Currency = node.GetValue("//ORIGCURRENCY");
            //If currency not different, set to CURDEF
             else
            Currency = currency;

             //If senders bank/credit card details avaliable, add
             if (NodeExists(node, "//BANKACCTTO"))
            TransactionSenderAccount = new Account(node.SelectSingleNode("//BANKACCTTO"), AccountType.BANK);
             else if (NodeExists(node, "//CCACCTTO"))
            TransactionSenderAccount = new Account(node.SelectSingleNode("//CCACCTTO"), AccountType.CC);
        }