Example #1
0
        private void _AppendBalance(FinAcctBalResp aBal, StringBuilder sb)
        {
            FinAcct      aAcct       = aBal.Account;
            SwiftBalance aCurrentBal = aBal.CurrentBal;
            SwiftBalance aPendingBal = aBal.IncludingPendingTransBal;

            if (aCurrentBal != null)
            {
                sb.AppendFormat("BOOKED;{0};{1};{2};{3};{4}",
                                aAcct.BankCode,
                                aAcct.AcctNo,
                                aCurrentBal.Date.ToString(SwiftDateFormat.StandardDate),
                                aCurrentBal.Currency,
                                SwiftAmt.Format(aCurrentBal.DecValue, ',', 2));
                sb.Append(Environment.NewLine);
            }

            if (aPendingBal != null)
            {
                sb.AppendFormat("FORWARD;{0};{1};{2};{3};{4}",
                                aAcct.BankCode,
                                aAcct.AcctNo,
                                aPendingBal.Date.ToString(SwiftDateFormat.StandardDate),
                                aPendingBal.Currency,
                                SwiftAmt.Format(aPendingBal.DecValue, ',', 2));
                sb.Append(Environment.NewLine);
            }
        }
Example #2
0
        private string _GetCsvStatementData(Swift9xxBase aStmt)
        {
            StringBuilder sb = new StringBuilder(20000);

            sb.Append("EntryDate;ValueDate;Value;AcctNo;BankCode;Name1;Name2;PaymtPurpose;EntryText;PrimaNotaNo;TranTypeIdCode;ZkaTranCode;TextKeyExt;BankRef;OwnerRef;SupplementaryDetails");
            sb.Append(Environment.NewLine);

            foreach (SwiftStatementLine aStmtLine in aStmt.StatementLines)
            {
                CsvValues aCsv = new CsvValues(16);

                if (!aStmtLine.EntryDate.IsNull)
                {
                    aCsv[0] = aStmtLine.EntryDate.ToString(SwiftDateFormat.StandardDate);
                }
                if (!aStmtLine.ValueDate.IsNull)
                {
                    aCsv[1] = aStmtLine.ValueDate.ToString(SwiftDateFormat.StandardDate);
                }

                aCsv[2] = SwiftAmt.Format(aStmtLine.DecValue, ',', 2);
                aCsv[3] = aStmtLine.PayeePayerAcctNo;
                aCsv[4] = aStmtLine.PayeePayerBankCode;
                aCsv[5] = aStmtLine.PayeePayerName1;
                aCsv[6] = aStmtLine.PayeePayerName2;

                string[] vsPaymtPurpose = aStmtLine.PaymtPurpose;
                if (vsPaymtPurpose != null)
                {
                    aCsv[7] = String.Join("|", vsPaymtPurpose);
                }

                aCsv[8]  = aStmtLine.EntryText;
                aCsv[9]  = aStmtLine.PrimaNotaNo;
                aCsv[10] = aStmtLine.TranTypeIdCode;
                aCsv[11] = aStmtLine.ZkaTranCode;
                aCsv[12] = aStmtLine.TextKeyExt;
                aCsv[13] = aStmtLine.BankRef;
                aCsv[14] = aStmtLine.OwnerRef;
                aCsv[15] = aStmtLine.SupplementaryDetails;

                sb.Append(aCsv);
                sb.Append(Environment.NewLine);
            }

            return(sb.ToString());
        }
        protected override bool OnParse(string action, StringDictionary arguments)
        {
            string sPayeeName = arguments["-payeename"];

            if (string.IsNullOrEmpty(sPayeeName))
            {
                Io.Error.Write("Parameter -payeename fehlt!");
                return(false);
            }

            string sPayeeAcctNo = arguments["-payeeacctno"];

            if (string.IsNullOrEmpty(sPayeeAcctNo))
            {
                Io.Error.Write("Parameter -payeeacctno fehlt!");
                return(false);
            }

            string sPayeeBankCode = arguments["-payeebankcode"];

            if (string.IsNullOrEmpty(sPayeeBankCode))
            {
                Io.Error.Write("Parameter -payeebankcode fehlt!");
                return(false);
            }

            decimal dAmount = 0M;

            try
            {
                dAmount = SwiftAmt.Parse(arguments["-amount"]);
            }
            catch { /* IGNORE */ }
            if (dAmount == 0M)
            {
                Io.Error.Write("Parameter -amount fehlt oder fehlerhaft!");
                return(false);
            }

            string sTextKey    = arguments["-textkey"];
            string sTextKeyExt = arguments["-textkeyext"];

            string[] vsPurpose = arguments["-purpose"].Split('|');

            if (sTextKey == null)
            {
                sTextKey = "51";
            }

            m_aRemitt = new FinRemitt
            {
                PayeePayerAcct  = new FinAcct(sPayeeAcctNo, "280", sPayeeBankCode),
                PayeePayerName1 = sPayeeName,
                Amount          = new SwiftAmt(dAmount, "EUR"),
                TextKey         = sTextKey,
                TextKeyExt      = sTextKeyExt,
                PaymtPurpose    = vsPurpose
            };

            return(true);
        }