|
@@ -18,6 +18,7 @@ using System.Web;
|
|
using System.Data;
|
|
using System.Data;
|
|
using MTWorkHR.Core.IDto;
|
|
using MTWorkHR.Core.IDto;
|
|
using System.Linq.Dynamic.Core;
|
|
using System.Linq.Dynamic.Core;
|
|
|
|
+using MTWorkHR.Core.Entities.Base;
|
|
|
|
|
|
namespace MTWorkHR.Application.Services
|
|
namespace MTWorkHR.Application.Services
|
|
{
|
|
{
|
|
@@ -164,7 +165,28 @@ namespace MTWorkHR.Application.Services
|
|
throw new AppException(ExceptionEnum.RecordAlreadyExist);
|
|
throw new AppException(ExceptionEnum.RecordAlreadyExist);
|
|
//loop for given list of attachment, and move each file from Temp path to Actual path
|
|
//loop for given list of attachment, and move each file from Temp path to Actual path
|
|
// _fileService.UploadFiles(files);
|
|
// _fileService.UploadFiles(files);
|
|
-
|
|
|
|
|
|
+ if (input.UserAttachments == null )
|
|
|
|
+ input.UserAttachments = new List<AttachmentDto>();
|
|
|
|
+ if(input.CVAttach != null)
|
|
|
|
+ {
|
|
|
|
+ input.UserAttachments.Add(new AttachmentDto { FileData = input.CVAttach, OriginalName = input.CVAttach?.Name,FileName = input.CVAttach?.FileName, AttachmentTypeId = 1 });
|
|
|
|
+ }
|
|
|
|
+ if (input.PassportAttach != null)
|
|
|
|
+ {
|
|
|
|
+ input.UserAttachments.Add(new AttachmentDto { FileData = input.PassportAttach, OriginalName = input.PassportAttach?.Name, FileName = input.PassportAttach?.FileName, AttachmentTypeId = 2 });
|
|
|
|
+ }
|
|
|
|
+ if (input.EduCertificateAttach != null)
|
|
|
|
+ {
|
|
|
|
+ input.UserAttachments.Add(new AttachmentDto { FileData = input.EduCertificateAttach, OriginalName = input.EduCertificateAttach?.Name, FileName = input.EduCertificateAttach?.FileName, AttachmentTypeId = 3 });
|
|
|
|
+ }
|
|
|
|
+ if (input.ExperienceCertificateAttach != null)
|
|
|
|
+ {
|
|
|
|
+ input.UserAttachments.Add(new AttachmentDto { FileData = input.ExperienceCertificateAttach, OriginalName = input.ExperienceCertificateAttach?.Name, FileName = input.ExperienceCertificateAttach?.FileName, AttachmentTypeId = 4 });
|
|
|
|
+ }
|
|
|
|
+ if (input.ProfCertificateAttach != null)
|
|
|
|
+ {
|
|
|
|
+ input.UserAttachments.Add(new AttachmentDto { FileData = input.ProfCertificateAttach, OriginalName = input.ProfCertificateAttach?.Name, FileName = input.ProfCertificateAttach?.FileName, AttachmentTypeId = 5 });
|
|
|
|
+ }
|
|
if (!await _fileService.CopyFileToActualFolder(input.UserAttachments.ToList()))
|
|
if (!await _fileService.CopyFileToActualFolder(input.UserAttachments.ToList()))
|
|
throw new AppException(ExceptionEnum.CouldNotMoveFiles);
|
|
throw new AppException(ExceptionEnum.CouldNotMoveFiles);
|
|
var user = MapperObject.Mapper.Map<ApplicationUser>(input);
|
|
var user = MapperObject.Mapper.Map<ApplicationUser>(input);
|
|
@@ -360,19 +382,27 @@ namespace MTWorkHR.Application.Services
|
|
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- public async Task ForgetPasswordMail(string userId)
|
|
|
|
|
|
+ public async Task ForgetPasswordMail(string email)
|
|
{
|
|
{
|
|
- var resultPassReset = await GetResetPasswordURL(userId);
|
|
|
|
|
|
|
|
- await _emailSender.SendEmail(new EmailMessage
|
|
|
|
|
|
+ var foundUser = await _userManager.FindByEmailAsync(email);
|
|
|
|
+ if (foundUser != null)
|
|
{
|
|
{
|
|
- Subject = "Register Confirmation",
|
|
|
|
- To = resultPassReset.Item2,
|
|
|
|
- Body = "Forget Your Password, link will expired after 24 hours",
|
|
|
|
- url = resultPassReset.Item1,
|
|
|
|
- userId = userId
|
|
|
|
- });
|
|
|
|
|
|
+ var resultPassReset = await GetResetPasswordURL(foundUser.Id);
|
|
|
|
|
|
|
|
+ await _emailSender.SendEmail(new EmailMessage
|
|
|
|
+ {
|
|
|
|
+ Subject = "Register Confirmation",
|
|
|
|
+ To = resultPassReset.Item2,
|
|
|
|
+ Body = "Forget Your Password, link will expired after 24 hours",
|
|
|
|
+ url = resultPassReset.Item1,
|
|
|
|
+ userId = foundUser.Id
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ throw new AppException(ExceptionEnum.RecordNotExist);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public async Task StopUser(string userId)
|
|
public async Task StopUser(string userId)
|