public void Setup() { _builder = new DotLiquidMessageBuilder(_efContextMock.Object); _appSettingsMock.Setup(a => a.Value).Returns(new AppSettings { ActivityLogMaxRetry = MaxRetry, SupportEmailAddress = "*****@*****.**" }); _target = new ActivityLogService(_efContextMock.Object, _builder, _supportNotificationServiceMock.Object, _appSettingsMock.Object); var activityLogs = new List <ActivityLog>(); var deliveries = new List <ActivityLogDelivery>(); var activityLogDbSet = _efContextMock.MockAsyncQueryable(activityLogs.AsQueryable(), d => d.ActivityLog); var deliverDbSet = _efContextMock.MockAsyncQueryable(deliveries.AsQueryable(), d => d.ActivityLogDelivery); activityLogDbSet.Setup(d => d.Add(It.IsAny <ActivityLog>())).Callback((ActivityLog a) => { activityLogs.Add(a); }); deliverDbSet.Setup(d => d.Add(It.IsAny <ActivityLogDelivery>())).Callback((ActivityLogDelivery d) => { deliveries.Add(d); }); _efContextMock.MockAsyncQueryable(_templates.AsQueryable(), d => d.ActivityLogMessageTemplate); }
public LogController() { //ActivityLogService var logElasticConnection = new ElasticConnection <UserActivityLog>(new UserActivityLogElasticConfig()); _activityLogService = new ActivityLogService <UserActivityLog> (new ActivityLogElasticRepository <UserActivityLog>(logElasticConnection)); }
public UserDetailsModel(SysRoleService sysRoleService, SysUserService sysUserService, SysUserJwtService sysUserJwtService, SysUserLoginService sysUserLoginService, ActivityLogService activityLogService) { _activityLogService = activityLogService; _sysUserLoginService = sysUserLoginService; _sysUserService = sysUserService; _sysRoleService = sysRoleService; _sysUserJwtService = sysUserJwtService; }
/// <summary> /// /// </summary> public SysUserController(SysUserService sysUserService, SysRoleService sysRoleService, SysUserLoginService sysUserLoginLogService, ActivityLogService activityLogService, SysUserJwtService sysUserJwtService, IMapper mapper) { _sysUserJwtService = sysUserJwtService; _sysUserLoginLogService = sysUserLoginLogService; _sysRoleService = sysRoleService; _sysUserService = sysUserService; _activityLogService = activityLogService; _mapper = mapper; }
protected async Task DeleteActivityLog(int id) { bool?result = await DialogService.Confirm("Are you sure?", "DELETE ACTIVITY LOG", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No", ShowClose = false }); if (result.Value == true) { var deletedNotification = await ActivityLogService.DeleteAsync(id); if (deletedNotification > 0) { } else { } } }
private async Task <string> GetTryCountRes(long tryCount, string activityKey, int logId) { await ActivityLogService.AddFailureCountAsync(logId); if (tryCount == RuleConst.IdiomsMaxTryCount) { // 移除活动缓存 await _database.KeyDeleteAsync(activityKey); var log = await ActivityLogService.CloseActivityAsync(logId, "活动结束,挑战次数使用完毕!"); return($@" >>>>>>>>>尝试次数已用完,欢迎下次再来挑战!<<<<<<<<<<<< 本次挑战成果: 成功次数:{log.SuccessCount.ToString()} 失败次数:{log.FailureCount.ToString()} 希望大家再接再厉! "); } return($"还剩下{(RuleConst.IdiomsMaxTryCount - tryCount).ToString()} 尝试次数!"); }
protected async override Task OnInitializedAsync() { if (!string.IsNullOrEmpty(activitylog)) { if (int.TryParse(activitylog, out int Id)) { ActivityLogVM = await ActivityLogService.FetchByIdAsync(Id); NotificationId = ActivityLogVM.Id; } else { var values = activitylog.Split("_"); Id = int.Parse(values[0]); PageLinkName = values[1]; ActivityLogVM = await ActivityLogService.FetchByIdAsync(Id); NotificationId = ActivityLogVM.Id; } } }
public JsonResult Update(ThirdPartyPaymentModel model) { var thirdpayment = PaymentService.FindThirdPartyPaymentById(model.ThirdPartyScheduleId); Dictionary <string, object> dicThirdPartySchedule = new Dictionary <string, object>(); ActivityLogService.CreateDictionaryForThirdParty(ref dicThirdPartySchedule, thirdpayment); ActivityLogService.CreateActivityLog(new ActivityLog { Comment = XmlHelper.SerializeKeyValuePairs("ThirdPartySchedule", dicThirdPartySchedule), ObjectTypeId = (int)AuditObjectType.PaymentThirdPartySchedule, ObjectId = thirdpayment.ThirdPartyScheduleId.ToString() }, "ThirdPartySchedule.Update"); thirdpayment.FirstInstallmentAmount = 0; thirdpayment.SecondInstallmentAmount = 0; thirdpayment.SinglePaymentAmount = 0; if (model.IsSinglePayment) { thirdpayment.SinglePaymentAmount = model.SinglePaymentAmount; thirdpayment.OrderAmount = model.SinglePaymentAmount; } else { thirdpayment.FirstInstallmentAmount = model.FirstInstallmentAmount; thirdpayment.SecondInstallmentAmount = model.SecondInstallmentAmount; thirdpayment.OrderAmount = model.FirstInstallmentAmount + model.SecondInstallmentAmount; } thirdpayment.Comment = model.Comment; thirdpayment.ModifiedDateTime = System.DateTime.UtcNow; thirdpayment.ModifiedBy = WebHelper.GetUserName(); PaymentService.ModifyThirdPayment(thirdpayment); return(Json(new BasicDataTablesResult(new { Status = "OK" }))); }
protected async Task EditActivityLog() { if (NotificationId > 0) { await ActivityLogService.UpdateAsync(ActivityLogVM); } if (NotificationId > 0 && PageLinkName == "ActivityLogDateRange") { navigationManager.NavigateTo("/activitylogdaterange"); } else if (NotificationId > 0 && PageLinkName == "ActivityLogUrl") { navigationManager.NavigateTo("/activityloggetbyurl"); } else if (NotificationId > 0 && PageLinkName == "ActivityAppName") { navigationManager.NavigateTo("/activityloggetbyappname"); } else { navigationManager.NavigateTo("/activitlogs"); } }
protected async override Task OnInitializedAsync() { activityLogVMs = await ActivityLogService.FetchAllAsync(); }
protected async Task AddActivityLog() { IsTrue = true; activityLogDateRangeVMs = await ActivityLogService.FetchByDateRangeAsync(activityLogDateRangeVM); }
public ActivityLogModel(ActivityLogService activityLogService) { _activityLogService = activityLogService; }
/// <summary> /// /// </summary> /// <param name="activityLogService"></param> public ActivityLogController(ActivityLogService activityLogService) { _activityLogService = activityLogService; }
public ActivityLogsController(ActivityLogService service, LogService logService) { _service = service; _logService = logService; }
protected async Task SearchActivityLogByUrl() { IsTrue = true; activityLogVMs = await ActivityLogService.FetchByUrl(activityLogGetByUrlVM.Url.ToString()); }
public async Task <GroupRes> Run(string msg, string account, string groupNo, Lazy <string> getLoginAccount) { var activityKey = CacheConst.GetGroupActivityKey(groupNo); var groupActivity = _database.StringGet(activityKey); if (CacheConst.IdiomsSolitaire.Equals(groupActivity)) { var idiomsKey = CacheConst.GetIdiomsKey(groupNo); var idiomsTryCountKey = CacheConst.GetIdiomsTryCountKey(groupNo); var logId = int.Parse(await _database.StringGetAsync(CacheConst.GetActivityLogKey(groupNo))); var activityLog = ActivityLogService.GetActivity(logId); if (activityLog.ActivityStateType == Data.Pikachu.Menu.ActivityStateTypes.Close) { // 移除活动缓存 await _database.KeyDeleteAsync(activityKey); return("成语接龙活动已关闭!"); } if ("关闭活动".Equals(msg) && await ManageService.IsManageAsync(account))// 管理员主动结束活动. { // 移除活动缓存 await _database.KeyDeleteAsync(activityKey); var log = await ActivityLogService.CloseActivityAsync(logId, "活动结束,管理员主动结束活动!"); return($@" >>>>>>>>>本次活动已结束,欢迎下次再来挑战!<<<<<<<<<<<< 本次挑战成果: 成功次数:{log.SuccessCount.ToString()} 失败次数:{log.FailureCount.ToString()} 希望大家再接再厉! "); } // 增加尝试次数 var tryCount = await _database.StringIncrementAsync(idiomsTryCountKey); var idiomId = await _database.StringGetAsync(idiomsKey); var spell = await IdiomsService.GetInfoAsync(int.Parse(idiomId)); var confrimStr = $@" >>>>>>>>>成语接龙火热进行中<<<<<<<<<<<< 当前成语:{spell.Word} 尾拼:{spell.LastSpell} 成语解析:{spell.Explanation} "; if (msg.Length != 4) { return(GroupRes.GetSuccess(new GroupItemRes() { AtTa = true, Msg = "输入格式有误!" }, await GetTryCountRes(tryCount, activityKey, logId), confrimStr)); } var info = await IdiomsService.GetByWordAsync(msg); if (info == null) { return(GroupRes.GetSuccess(new GroupItemRes() { AtTa = true, Msg = "词语输入有误!" }, await GetTryCountRes(tryCount, activityKey, logId), confrimStr)); } if (!spell.LastSpell.Equals(info.FirstSpell)) { return(GroupRes.GetSuccess(new GroupItemRes() { AtTa = true, Msg = "你输入的词语并不能接上呢!" }, await GetTryCountRes(tryCount, activityKey, logId), confrimStr)); } // 积分奖励 var amount = _random.Next(100) + 5; await ActivityLogService.AddSuccessCountAsync(logId); await BillFlowService.AddBillAsync(groupNo, account, amount, amount, Data.Pikachu.Menu.BillTypes.Reward, "成语接龙奖励"); await MemberInfoService.ChangeAmountAsync(groupNo, account, amount); // 重新缓存 await _database.StringSetAsync(idiomsKey, info.Id, RuleConst.GroupActivityExpiry); // 重新缓存 await _database.StringSetAsync(idiomsTryCountKey, 0, RuleConst.GroupActivityExpiry); return(GroupRes.GetSuccess(new GroupItemRes() { AtTa = true, Msg = $" 恭喜你获得{amount.ToString()}钻石奖励!" }, $@" >>>>>>>>>【成语接龙】下一回合<<<<<<<<<<<< 当前成语:{info.Word} 尾拼:{info.LastSpell} 成语解析:{info.Explanation} " )); } return(null); }
private void BtnAddActivityClick(object sender, RoutedEventArgs e) { ActivityLogService als=new ActivityLogService(); var item = this.CbActivityList.SelectedItem as Activity; if (item != null) { ActivityLog log=new ActivityLog(); if(!dpDate.SelectedDate.HasValue) { MessageBox.Show("请选择日期!"); return; } log.Date = dpDate.SelectedDate.Value; var aa = als.GetAll().Where(a => a.ActivityId == item.Id) .OrderByDescending(a => a.Date) .FirstOrDefault(); if(aa==null) { log.Distance = 0; log.LastDate = DateTime.Now; } else { log.Distance = (DateTime.Now-aa.Date).Days; log.LastDate = aa.Date; } log.ActivityId = item.Id; new ActivityLogService().Add(log); } MessageBox.Show("添加成功!"); }
protected async Task SearchActivityLogByAppName() { IsTrue = true; activityLogVMs = await ActivityLogService.FetchByApplicationName(model.ApplictionName.ToString()); }