Base solution for your next web application

Activities of "datalab"

hi, I would need to redirect a user on a specific route based on the user's role, becouse i have utilized the roles system that customize the navigation menu base on role. when user login the user is redirect to nofications pages, it possible tu redirect user to specific route base on it roles ?

Best Regards

I have resolted it by add this line of code for every form input element

(click)="$event.stopPropagation();"

I used this code but when I place the cursor on the textbox the menu closes.

<div class="btn-group dropdown" dropdown container="body">
                            <button class="btn btn-primary btn-lg dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" dropdownToggle>
                                <i class="flaticon-email"></i> Invia Notifica
                            </button>
                            <div class="dropdown-menu dropdown-menu-lg dropdown-menu-lg-right" *dropdownMenu>
                                <form class="form-horizontal" #sendClaimNotification="ngForm">
                                    <div *ngIf="!isAdmin" class="form-group">
                                        <label for="notificationMessage">Destinatario</label>
                                        <select name="userId" id="userId" [(ngModel)]="claimNotification.toUserId" class="form-control" required>
                                            <option value="undefined">Seleziona un utente a cui inviare la notifica</option>
                                            <option *ngFor="let user of users" [value]="user.id">{{user.name}} + ' ' + {{user.surname}}</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label for="notificationMessage">Messaggio</label>
                                        <textarea name="notificationMessage" id="notificationMessage" rows="8" [(ngModel)]="claimNotification.message" class="form-control"></textarea>
                                    </div>
                                    <button [disabled]="!sendClaimNotification.form.valid" type="button" class="btn btn-primary" (click)="sendNotification()"><i class="flaticon2-send-1"></i> Invia</button>
                                </form>
                            </div>
                        </div>

I need to create a drop-down menu with a form inside, I used the code from the following link https://keenthemes.com/metronic/preview/demo2/features/bootstrap/dropdown.html

but it doesn't work. What is the correct way to make it happen whit your framework?

Myprodut is: ASP.NET Zero 8.1 for Angular and .Net core 3.1

Best Regards Dennis Bellancini

Hello, How can I upgrade my module zero version 8.0-angular-core 3.0 to version 8.1? is there a documentation or tutorial ? Do you just need to update packages via NuGet Package Manager and Installa .net core 3.1 ? How can update de angular application to 8.1 ?

Thank you.

Hello, I solved, there was a bug generated by asynchronous methods, I solved using AsyncHelper.RunSync for these methods. The bug could also involve ABP.ModulZero ImportUsersToExcelJob Current

[UnitOfWork]
        public override void Execute(ImportUsersFromExcelJobArgs args)
        {
            using (CurrentUnitOfWork.SetTenantId(args.TenantId))
            {
                var users = GetUserListFromExcelOrNull(args);
                if (users == null || !users.Any())
                {
                    SendInvalidExcelNotification(args);
                    return;
                }

                CreateUsers(args, users);
            }
        }
        
        private void SendInvalidExcelNotification(ImportUsersFromExcelJobArgs args)
        {
            _appNotifier.SendMessageAsync(
                args.User,
                _localizationSource.GetString("FileCantBeConvertedToUserList"),
                Abp.Notifications.NotificationSeverity.Warn);
        }

Rewrite

[UnitOfWork]
        public override void Execute(ImportUsersFromExcelJobArgs args)
        {
            using (CurrentUnitOfWork.SetTenantId(args.TenantId))
            {
                var users = GetUserListFromExcelOrNull(args);
                if (users == null || !users.Any())
                {
                     AsyncHelper.RunSync(() =>SendInvalidExcelNotification(args));
                    return;
                }

                CreateUsers(args, users);
            }
        }
        
        private async Task SendInvalidExcelNotification(ImportUsersFromExcelJobArgs args)
        {
           await  _appNotifier.SendMessageAsync(
                args.User,
                _localizationSource.GetString("FileCantBeConvertedToUserList"),
                Abp.Notifications.NotificationSeverity.Warn);
        }

Hi, no rows remains in the AbpBackgroundJobs table after download collected data.

Hello, i have write a BackgroundJob for send email to some user, but after the job is completed with out exception it remain in queue in DB table AbpBackgroundJobs, so the emails are sent continuously until I delete manually the record from the database. My Version: ABP.Zero 8.0, Angular, AspNet Core 3.0

	[AbpAuthorize(AppPermissions.Pages_Surveies_SendRequest)]
        public async Task SendSurvey(SendSurveyInput input)
        {
            string jobId = await _backgroundJobManager.EnqueueAsync<SendSurveyJob, SendSurveyJobArgs>(
            new SendSurveyJobArgs
            {
                 Contacts = input.Contacts,
                 SurveyId = input.SurveyId,
                 TenantId = AbpSession.TenantId.Value,
                 User = AbpSession.ToUserIdentifier(),

            });
        }

 public class SendSurveyJob : BackgroundJob<SendSurveyJobArgs>, ITransientDependency
    {
        private readonly IAppNotifier _appNotifier;
        private readonly ILocalizationSource _localizationSource;
        private readonly IObjectMapper _objectMapper;
        private readonly IRepository<Survey> _surveyRepository;
        private readonly IRepository<Contact> _contactRepository;
        private readonly EMailTemplateManager _eMailTemplateManager;
        private readonly TenantManager _tenantManager;
        private readonly SurveyManager _surveyManager;
        private readonly IRepository<SurveyRequest> _surveyRequestRepository;
        private readonly IUserEmailer _userEmailer;

        public SendSurveyJob(
            IRepository<Survey> surveyRepository,
            IRepository<Contact> contactRepository,
            EMailTemplateManager eMailTemplateManager,
            IAppNotifier appNotifier,
            ILocalizationManager localizationManager,
            IObjectMapper objectMapper,
            TenantManager tenantManager,
            SurveyManager surveyManager,
            IRepository<SurveyRequest> surveyRequestRepository,
            IUserEmailer userEmailer)
        {
            _contactRepository = contactRepository;
            _appNotifier = appNotifier;
            _objectMapper = objectMapper;
            _localizationSource = localizationManager.GetSource(GerecoConsts.LocalizationSourceName);
            _tenantManager = tenantManager;
            _surveyRepository = surveyRepository;
            _eMailTemplateManager = eMailTemplateManager;
            _surveyManager = surveyManager;
            _surveyRequestRepository = surveyRequestRepository;
            _userEmailer = userEmailer;

        }

        [UnitOfWork]
        public override void Execute(SendSurveyJobArgs args)
        {
            using (CurrentUnitOfWork.SetTenantId(args.TenantId))
            {
                Survey survey = _surveyRepository.Get(args.SurveyId);
                SendSurveyRequest(args, survey);
            }
        }

        private void SendSurveyRequest(SendSurveyJobArgs args, Survey survey)
        {
           
            string invalidSendMessage = "Non è stato possibile inviare il messaggio al seguente destinatario {0} per il seguente motivo {1}";

            List<Contact> recipients = _contactRepository
            .GetAll()
            .Include(c => c.Location)
            .Where(c => args.Contacts.Select(cs => cs.Id).Contains(c.Id))
            .ToList();

            EmailTemplate emailTemplate = _eMailTemplateManager.GetDefaultEMailTemplate();

            Tenant tenant = _tenantManager.GetById(args.TenantId);


            foreach (var recipient in recipients)
            {
                try
                {
                    var PendingOrVisitedRequest = _surveyRequestRepository
                   .GetAll()
                   .Where(r => r.ContactId == recipient.Id & r.SurveyId == survey.Id & (r.Status == SurveyRequestStatus.Pending | r.Status == SurveyRequestStatus.Visited));

                    //Imposto lo status su cancelled se il contatto ha già aperte delle richieste per il questionario che si sta inviano nello stato di Pending o Visited
                    foreach (var request in PendingOrVisitedRequest)
                    {
                        request.Status = SurveyRequestStatus.Cancelled;
                    }

                    //Inserisco la survey request in pending 
                    SurveyRequest surveyRequest = new SurveyRequest()
                    {
                        SurveyLinkId = Guid.NewGuid(),
                        SurveyId = survey.Id,
                        ContactId = recipient.Id,
                        EmailTo = recipient.EMail,
                        Status = SurveyRequestStatus.Pending
                    };

                    _surveyRequestRepository.Insert(surveyRequest);

                    _userEmailer.TryToSendEmailSurveyRequest(survey, recipient, tenant, surveyRequest, emailTemplate);

                    CurrentUnitOfWork.SaveChanges();
                }
                catch (UserFriendlyException exception)
                {
                    SendInvalidEmailNotification(args, string.Format(invalidSendMessage, recipient.FullCompanyName, exception.Message));
                }
                catch (Exception exception)
                {
                    SendInvalidEmailNotification(args, string.Format(invalidSendMessage, recipient.FullCompanyName, exception.ToString()));
                }
            }

            SendSurveyCompletedNotification(args, string.Format("L'invio del questionario {0} è stato completato.", survey.Name));
        }
 
        private void SendInvalidSurveyNotification(SendSurveyJobArgs args)
        {
            _appNotifier.SendMessageAsync(
                args.User,
                _localizationSource.GetString("SendInvalidSurveyNotification"),
                Abp.Notifications.NotificationSeverity.Warn);
        }

        private void SendInvalidEmailNotification(SendSurveyJobArgs args, string message)
        {
            _appNotifier.SendMessageAsync(
                args.User,
                message,
                Abp.Notifications.NotificationSeverity.Warn);
        }

        private void SendSurveyCompletedNotification(SendSurveyJobArgs args, string message)
        {
            _appNotifier.SendMessageAsync(
                args.User,
                message,
                Abp.Notifications.NotificationSeverity.Success);
        }
    }
         
       public async Task TryToSendEmailSurveyRequest(Survey survey, Contact recipient, Tenant tenant, SurveyRequest surveyRequest, EmailTemplate emailBodyTemplate = null)
        {
            try
            {
                var emailTemplate = new StringBuilder(_emailTemplateProvider.GetSurveyRequestTemplate(tenant.Id));
                emailTemplate.Replace("{EMAIL_TITLE}", L("SendSurveyRequestMessageEmail_Title"));
                emailTemplate.Replace("{EMAIL_SUB_TITLE}", L("SendSurveyRequestMessageEmail_SubTitle"));
                                 
                var surveyRequestMessage = GetSurveyRequestMessage(survey, recipient, emailBodyTemplate, tenant, surveyRequest);
                var surveyRequestSubject = GetSurveyRequestSubject(survey, recipient, emailBodyTemplate, tenant);

                await ReplaceBodyAndSend(recipient.EMail, surveyRequestSubject.ToString(), emailTemplate, surveyRequestMessage);                  
                             
            }
            catch (Exception exception)
            {
                Logger.Error(exception.Message, exception);
            }
        }
Question

Hi, where can i find metronic documentation ? i'm go for example to https://keenthemes.com/metronic/preview/angular/demo1/ngbootstrap/tabs, but if copy and paste some code example it not work. My Asp.Net Zero Version 8.0, Angular, .Net Core 3.0.

Ok, I subscribed to the numbers 2829.

Thanks.

Showing 11 to 20 of 23 entries