private void FsNotify_CreateCompleted(object sender, SingleNodeOperationEventArgs e) { try { if (e.ResultNode.IsFile) { var callPath = $"{MethodBase.GetCurrentMethod().DeclaringType.Name}.{MethodBase.GetCurrentMethod().Name}"; Log.Information($"'{callPath}' '{ServerSession.Current.UserName}' file '{e.ResultNode.Path.StringPath}'"); using (var scope = _factory.CreateScope()) { var conf = scope.ServiceProvider.GetRequiredService <IConfiguration>(); var uow = scope.ServiceProvider.GetRequiredService <IUnitOfWork>(); var user = uow.Users.Get(QueryExpressionFactory.GetQueryExpression <tbl_User>() .Where(x => x.IdentityAlias == ServerSession.Current.UserName).ToLambda()) .Single(); var admin = scope.ServiceProvider.GetRequiredService <IAdminService>(); var alert = scope.ServiceProvider.GetRequiredService <IAlertService>(); var identity = admin.User_GetV1(user.IdentityId.ToString()).Result; alert.Email_EnqueueV1(new EmailV1() { FromEmail = conf["Notifications:SmtpSenderAddress"], FromDisplay = conf["Notifications:SmtpSenderDisplayName"], ToId = identity.Id, ToEmail = identity.Email, ToDisplay = $"{identity.FirstName} {identity.LastName}", Subject = "File Upload Notify", HtmlContent = Templates.NotifyEmailOnFileUpload(conf["Daemons:SftpService:Dns"], identity.UserName, identity.FirstName, identity.LastName, e.ResultNode.Path.StringPath, e.ResultNode.Length.ToString()) }); alert.Text_EnqueueV1(new TextV1() { FromPhoneNumber = conf["Notifications:SmsSenderNumber"], ToId = identity.Id, ToPhoneNumber = identity.PhoneNumber, Body = conf["Notifications:SmsSenderDisplayName"] + Environment.NewLine + Templates.NotifyTextOnFileUpload(conf["Daemons:SftpService:Dns"], identity.UserName, e.ResultNode.Path.StringPath, e.ResultNode.Length.ToString()) }); } } } catch (Exception ex) { Log.Error(ex.ToString()); } }
private void FsNotify_DeleteCompleted(object sender, SingleNodeOperationEventArgs e) { try { if (e.ResultNode.IsFile) { var callPath = $"{MethodBase.GetCurrentMethod().DeclaringType.Name}.{MethodBase.GetCurrentMethod().Name}"; Log.Information($"'{callPath}' '{ServerSession.Current.UserName}' file '{e.ResultNode.Path.StringPath}'"); } } catch (Exception ex) { Log.Error(ex.ToString()); } }