Exemplo n.º 1
0
 /// <summary>
 /// 异常信息报告,报告完后直接终止导入的所有操作
 /// </summary>
 /// <param name="ex"></param>
 public void ErrorReport(ReportArgs args)
 {
     args.Status = 3;
     Rollback();
     args.Message = $"<strong style='color:red'>{ args.Message}</strong>";
     SendToClient(args);
     StatusReport?.Invoke(args);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 警告信息报告,产生警告信息后,除非手动调用ErrorReport 否则直到执行异常才会退出
 /// </summary>
 /// <param name="args"></param>
 public void WarningReport(ReportArgs args)
 {
     args.Status = 2;
     WarningCount++;
     args.Message = $"<strong style='color:red'>{ args.Message}</strong>";
     SendToClient(args);
     StatusReport?.Invoke(args);
 }
Exemplo n.º 3
0
        private void SendToClient(ReportArgs args, int status = 0)
        {
            string token = TwinkleContext.UserToken;

            AuthUser user = TwinkleContext.GetService <TokenAuthManager>().GetUser(token);

            IRealTimeNotifier rtf = TwinkleContext.GetService <IRealTimeNotifier>();

            rtf.SendNotificationsAsync(new UserNotification[] {
                new UserNotification {
                    TenantId = user.TenantId,
                    UserId   = user.UserId,
                    Data     = new NotifyData {
                        Channel = "signalr.reveive",
                        Data    = new {
                            uploadId = TwinkleContext.HttpContext.Request.Form["uploadId"].ToString(),//有待测试验证
                            message  = args.Message,
                            status   = args.Status
                        }
                    }
                }
            });
        }
Exemplo n.º 4
0
 /// <summary>
 /// 普通消息报告,不影响操作流程
 /// </summary>
 /// <param name="args"></param>
 public void InfoReport(ReportArgs args, int status = 0)
 {
     args.Status = status;
     SendToClient(args);
     StatusReport?.Invoke(args);
 }