Esempio n. 1
0
        private SaveResult SaveEdit(Cryptocurrencies cur)
        {
            List <PriceInfos> list = new List <PriceInfos>();

            if (cur.IsFixedPrice)
            {
                foreach (Currency item in FoundationDB.CurrencyDb.GetList())
                {
                    PriceInfos pi = new PriceInfos();
                    pi.CryptoID       = cur.Id;
                    pi.CurrencyID     = item.ID;
                    pi.LastUpdateDate = DateTime.Now;
                    pi.Price          = Convert.ToDecimal(Request.Form[item.Code]);
                    list.Add(pi);
                }
            }

            CryptocurrenciesBLL ab = new CryptocurrenciesBLL();

            return(ab.Update(cur, list, UserId, UserName));
        }
Esempio n. 2
0
        private SaveResult <int> SaveCreate(Cryptocurrencies cur)
        {
            List <PriceInfos>   list = new List <PriceInfos>();
            CryptocurrenciesBLL ab   = new CryptocurrenciesBLL();
            PriceInfoAgent      pia  = new PriceInfoAgent();
            var result = ab.Create(cur, UserId, UserName);

            if (cur.IsFixedPrice)
            {
                foreach (Currency item in FoundationDB.CurrencyDb.GetList())
                {
                    PriceInfos pi = new PriceInfos();
                    pi.CryptoID       = result.Data;
                    pi.CurrencyID     = item.ID;
                    pi.LastUpdateDate = DateTime.Now;
                    pi.Price          = Convert.ToDecimal(Request.Form[item.Code]);
                    list.Add(pi);
                }
                pia.Insert(list);
            }
            return(result);
        }