Ejemplo n.º 1
0
 public FundType(string typeCode, string amount, string itemCount, string fundsType)
 {
     TypeCode  = typeCode;
     Detail    = BaiFileHelpers.GetTransactionDetail(typeCode);
     Amount    = amount;
     ItemCount = itemCount;
     FundsType = fundsType;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a List of DetailSummary
        /// </summary>
        /// <param name="data">The translated BAI object</param>
        /// <param name="dictionaryKeys">Any Keys in the Detail.TextDictionary (if any) you would like to export</param>
        /// <returns>A List of DetailSummary</returns>
        public static List <DetailSummary> GetDetailInformation(TranslatedBaiFile data, List <string> dictionaryKeys)
        {
            var ret = new List <DetailSummary>();

            foreach (var group in data.Groups)
            {
                foreach (var account in group.Accounts)
                {
                    foreach (var detail in account.Details)
                    {
                        var detailType     = BaiFileHelpers.GetTransactionDetail(detail.TypeCode);
                        var textDictionary = new Dictionary <string, string>();

                        if (dictionaryKeys != null)
                        {
                            foreach (var key in dictionaryKeys)
                            {
                                if (detail.TextDictionary.ContainsKey(key))
                                {
                                    textDictionary.Add(key, detail.TextDictionary[key]);
                                }
                            }
                        }

                        var ds = new DetailSummary()
                        {
                            Date                     = group.AsOfDateTime,
                            CreationDate             = data.FileCreationDateTime,
                            FileIdentificationNumber = data.FileIdentificationNumber,
                            SenderIdentification     = data.SenderIdentification,
                            Amount                   = BaiFileHelpers.GetAmount(detail.Amount, group.CurrencyCode),
                            BankReferenceNumber      = detail.BankReferenceNumber,
                            CustomerReferenceNumber  = detail.CustomerReferenceNumber,
                            CustomerAccountNumber    = account.CustomerAccountNumber,
                            Text                     = detail.Text,
                            TypeCode                 = detailType.TypeCode,
                            TypeDescription          = detailType.Description,
                            FundType                 = detail.FundsType,
                            TextDictionary           = textDictionary
                        };

                        // I don't want to return an optional, I want a blank string
                        if (!string.IsNullOrEmpty(detail.Immediate))
                        {
                            ds.Immediate = BaiFileHelpers.GetAmount(detail.Immediate, group.CurrencyCode).ToString(CultureInfo.CurrentCulture);
                        }
                        if (!string.IsNullOrEmpty(detail.OneDay))
                        {
                            ds.OneDay = BaiFileHelpers.GetAmount(detail.OneDay, group.CurrencyCode).ToString(CultureInfo.CurrentCulture);
                        }
                        if (!string.IsNullOrEmpty(detail.TwoOrMoreDays))
                        {
                            ds.TwoOrMoreDays = BaiFileHelpers.GetAmount(detail.TwoOrMoreDays, group.CurrencyCode).ToString(CultureInfo.CurrentCulture);
                        }

                        ret.Add(ds);
                    }
                }
            }
            return(ret);
        }