コード例 #1
0
 private async Task CheckUpdateActiveOffersValidDates(EntityContext ctx, IQueryable<SpecialCommisionOffers> activeRecords)
 {
     for (int i = 0; i < activeRecords.Count(); i++)
     {
         if (_dateProvider.CompareDates(activeRecords.ElementAt(i).EndDate, _dateProvider.GetCurrentDateTime()))
         {
             ctx.SpecialCommisionOffers.Find(activeRecords.ElementAt(i).ID).ActiveStatus = false;
             await ctx.SaveChangesAsync();
         }
     }
 }
コード例 #2
0
 public async Task <BoolMessage> SetDefaultCommisions(DefaultSettings settings)
 {
     try
     {
         using (var ctx = new EntityContext())
         {
             var newCommission = new DefaultCommisions
             {
                 Country     = ctx.Country.Find(settings.CountryId),
                 Currency    = ctx.Currency.Find(settings.CurrencyId),
                 PaymentType = ctx.PaymentTypes.Find(settings.PaymentType),
                 DefaultCommisionPercentage = 2.0F,
                 MaxCommissionEachPayment   = 20.0F,
                 MaxPaymentVolume           = 0,
                 MinCommissionEachPayment   = 0.5F,
                 MinimumPaymentVolume       = 1,
                 LastUpdatedBy   = 1,
                 LastUpdatedDate = _dateProvider.GetCurrentDateTime(),
             };
             ctx.DefaultCommisions.Add(newCommission);
             await ctx.SaveChangesAsync();
         }
         return(new BoolMessage {
             Success = true, Message = "success bitch"
         });
     }
     catch (Exception e)
     {
         return(new BoolMessage {
             Success = false, Message = "fail " + e.ToString()
         });
     }
 }