Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "firnas"

Solved the issue. It seemed that my wrokspace solution was corrupted somehow. taking a fresh copy to a different location solved the issue.

Thanks

Thanks. I implemented a NullSendGridEmailSender and it worked.

Is there any examples of such implementation i can refer to?

Thanks aaron for ths support.

if i dont use the async then the await operators thorws a error.

I changed my code to send the email after the using block. Nowit works fine. But is that a good way to do a task outside the using statement?

[UnitOfWork]
protected override async void DoWork()
{
	//disable filter to get all user data
	using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))
	{
		//list to hold the missing documents
		IList<MissingDocumentDto> missingDocumentDtos = new List<MissingDocumentDto>();

		//get all non profits and uploaded documents
		IList<NonProfit> nonProfits = _nonProfitRepository.GetAllIncluding(np => np.Documents).ToList();

		//loop through the non profits
		foreach (NonProfit nonProfit in nonProfits)
		{
			//get tenant id for the non profit.
			int nonProfitTenantId = nonProfit.TenantId;

			//get the required document types for the tenant
			IList<DocumentType> requiredDocumentTypes = _documentTypeRepository.GetAllList(np =>
															np.TenantId == nonProfitTenantId &&
															np.Required == true);

			IList<long> missingDocumentIds = new List<long>();

			//get the list of required documents not uploaded or commented by the non profit
			requiredDocumentTypes.ToList().ForEach(rd =>
			{
				var document = nonProfit.Documents.Where(d => d.DocumentTypeId == rd.Id && d.IsDeleted == false).FirstOrDefault();
				if (document == null)
				{
					//has not uploaded the document. add to the list
					missingDocumentIds.Add(rd.Id);
				}
				else
				{
					//check if the document has been marked does not exist
					if (document.DoesNotExist)
					{
						//not uploaded the document. add to the list
						missingDocumentIds.Add(rd.Id);
					}
				}
			});

			//add to the missing list
			if (missingDocumentIds.Count > 0)
			{
				missingDocumentDtos.Add(new MissingDocumentDto
				{
					NonProfit = nonProfit,
					MissingDoucmentsIds = missingDocumentIds
				});
			}
		}

		//send the email
		//await SendEmailAsync(missingDocumentDtos);
		string apiKey = await _settingManager.GetSettingValueAsync(AppSettings.SendGridManagement.SendGridAPIKey);
		string adminEmailAddress = await _settingManager.GetSettingValueAsync(AppSettings.SendGridManagement.AdminEmailAddress);
		string subject = await _settingManager.GetSettingValueAsync(AppSettings.SendGridManagement.Subject);

		//get the email template
		string emailTemplate = GetEmailTemplate();

		//replace the body
		emailTemplate = emailTemplate.Replace("{EMAIL_TITLE}", subject)
			.Replace("{EMAIL_SUB_TITLE}", subject)
			.Replace("{EMAIL_BODY}", "test");

		SendGridMessage message = MailHelper.CreateSingleEmail(
			new EmailAddress(adminEmailAddress),
			new EmailAddress("[email protected]")
			, subject
			, "Email"
			, emailTemplate);

		var client = new SendGridClient(apiKey);
		**await client.SendEmailAsync(message);**

		await CurrentUnitOfWork.SaveChangesAsync();

	}
}

shared the code

Thanks. But the problem here is the error when reloading the page (by F5 or refresh icon click)

I figured it out. I havent set the isVisibleToClient parameter when adding the setting to the settings manager.

Answer

I found the below link which solved my problem,

https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1971

Hope it will help anyone who is facing my issue.

Answer

Is there a link to the hangfire url from the angular application?

Showing 21 to 30 of 47 entries