Beispiel #1
0
 public ERDataBase(ICurrencyMetada metaData, float buy, float?sell)
 {
     ISOName  = metaData.ISOName;
     Name     = metaData.Name;
     Country  = metaData.Country;
     Quantity = metaData.Quantity;
     Buy      = buy;
     Sell     = sell;
 }
Beispiel #2
0
        private ExchangeRateTicket ParseYearExchangeRateData(string[] section, List <ICurrencyMetada> currencyInfos)
        {
            ExchangeRateTicket ticket = new ExchangeRateTicket();

            for (int i = 1; i < section.Length; i++)
            {
                float           buy    = float.Parse(section[i], CultureInfo.GetCultureInfo("cs-CZ"));
                ICurrencyMetada metada = currencyInfos[i - 1];

                ERDataBase data = new ERDataBase(metada, buy, null);
                ticket.AddExchangeRateData(data);
            }
            return(ticket);
        }
Beispiel #3
0
        private void SaveBankCurrencyMetada(BCCContext context, ICurrencyMetada metaData)
        {
            CurrencyMetadata ret = context.CurrencyMetadata.Where(x => x.IsoName == metaData.ISOName).FirstOrDefault();

            if (ret == null)
            {
                if (string.IsNullOrWhiteSpace(metaData.ISOName))
                {
                    return;
                }
                if (metaData.Quantity < 1)
                {
                    return;
                }
                ret = new CurrencyMetadata()
                {
                    IsoName  = metaData.ISOName,
                    Name     = metaData.Name,
                    Quantity = metaData.Quantity,
                    Country  = metaData.Country
                };
                context.CurrencyMetadata.Add(ret);
                context.SaveChanges();
            }
            else
            {
                if (string.IsNullOrWhiteSpace(ret.Name) && !string.IsNullOrWhiteSpace(metaData.Name))
                {
                    ret.Name = metaData.Name;
                }
                if (string.IsNullOrWhiteSpace(ret.Country) && !string.IsNullOrWhiteSpace(ret.Country))
                {
                    ret.Country = metaData.Country;
                }
            }
        }