public ExchangeRateViewModel(ExchangeRate rate)
     : base(rate)
 {
     ApplicationId = rate.Application_Id;
     ValidTime = rate.ValidTime.ToShortDateString();
     ScoreToMoney = rate.ScoreToMoney.HasValue ? rate.ScoreToMoney.Value : 0;
     MoneyToCache = rate.MoneyToCache.HasValue ? rate.MoneyToCache.Value : 0;
     ScoreToCache = rate.ScoreToCache.HasValue ? rate.ScoreToCache.Value : 0;
 }
 public ExchangeRateModel(ExchangeRate eRate)
     : base(eRate)
 {
     if (eRate != null)
     {
         Application_Id = eRate.Application_Id;
         ValidTime = eRate.ValidTime.ToShortDateString();
         ScoreToMoney = eRate.ScoreToMoney;
         MoneyToCache = eRate.MoneyToCache;
         ScoreToCache = eRate.ScoreToCache;
     }
 }
Example #3
0
 public void UpdateExchangeRate(int appid, int userId, string token, ExchangeRate eRate)
 {
     try
     {
         CheckToken(appid, userId, token);
         CheckCommand(appid, eRate.Application_Id, userId, BuiltIns.DefineExchangeRateCommand.Id, BuiltIns.AllRole.Id);
         modelAccesser.Update(eRate);
     }
     catch (Exception)
     {
         throw new DatabaseException();
     }
 }
Example #4
0
 public void DeleteExchangeRate(int appid, int userId, string token, int id)
 {
     try
     {
         CheckToken(appid, userId, token);
         ExchangeRate rate = new ExchangeRate { Id = id };
         modelAccesser.Get<ExchangeRate>(rate);
         if (rate.Loaded)
         {
             CheckCommand(appid, rate.Application_Id, userId, BuiltIns.DefineExchangeRateCommand.Id, BuiltIns.AllRole.Id);
             modelAccesser.Delete(rate);
         }
     }
     catch (Exception)
     {
         throw new DatabaseException();
     }
 }
Example #5
0
 public void UpdateExchangeRate(int userId, string token, YoYoStudio.Model.Core.ExchangeRate eRate)
 {
     client.UpdateExchangeRate(application_Id, userId, token, eRate);
 }
Example #6
0
 public YoYoStudio.Model.Core.ExchangeRate AddExchangeRate(int userId, string token, YoYoStudio.Model.Core.ExchangeRate eRate)
 {
     return(client.AddExchangeRate(application_Id, userId, token, eRate));
 }