コード例 #1
0
        public async Task <IReminderResponse> RemoveReminder(int userId, int applicationId, int activityId)
        {
            logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  userId : {userId} UserIPAddress: { _userIPAddress.GetUserIP().Result }");

            try
            {
                var reminderData = await _appDbContext.Reminders.Where(x => x.UserID == userId && x.ActivityId == activityId && x.ApplicationId == applicationId).FirstOrDefaultAsync();

                var data = false;
                if (reminderData != null)
                {
                    _appDbContext.Reminders.Remove(reminderData);
                    await _appDbContext.SaveChangesAsync();

                    data = true;
                }

                return(new ReminderResponse(data));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw ex;
            }
        }
コード例 #2
0
        public async Task <EmailView> SendProgramSubmissionEmailAsync(string toEmail, string programName, string userName)
        {
            EmailView emailResponse = new EmailView();

            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  EmailTo: {toEmail} UserName: {userName} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var emailSetting = await _appDbContext.ApplicationSettings.ToListAsync();

                var appSetting = new AppSettings()
                {
                    SmtpHost     = emailSetting.FirstOrDefault(k => k.Key == "smtpHostName")?.Value,
                    SmtpPassword = emailSetting.FirstOrDefault(k => k.Key == "smtpPassword")?.Value,
                    SmtpPort     = emailSetting.FirstOrDefault(k => k.Key == "smtpPortNumber")?.Value,
                    SmtpUsername = emailSetting.FirstOrDefault(k => k.Key == "smtpUserName")?.Value
                };
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  SMTP_PasswordEncrypt: {appSetting.SmtpPassword}");

                appSetting.SmtpPassword = _encryptor.Decrypt(appSetting.SmtpPassword);

                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  SMTP_PasswordDecrypt: {appSetting.SmtpPassword}");

                var email = new MailMessage(appSetting.SmtpUsername, toEmail);

                var templateInfo = await _appDbContext.TemplateInfos.Include(k => k.EmailHeaderAndFooterTemplate).FirstOrDefaultAsync(k => k.Id == 3);

                //var otp = GenerateOtp();

                var body = GetProgramSubmissionEnglishContent(userName, programName, templateInfo, email);


                email.Body       = body;
                email.IsBodyHtml = true;
                using (var smtp = new SmtpClient())
                {
                    smtp.Host      = appSetting.SmtpHost;
                    smtp.EnableSsl = true;
                    NetworkCredential networkCred = new NetworkCredential(appSetting.SmtpUsername, appSetting.SmtpPassword);
                    smtp.UseDefaultCredentials = true;
                    smtp.Credentials           = networkCred;
                    smtp.Port = int.Parse(appSetting.SmtpPort);
                    smtp.Send(email);
                }
                emailResponse.ID      = Guid.NewGuid();
                emailResponse.Result  = true;
                emailResponse.Message = "Email Sent";
                //emailResponse.OTP = otp;

                return(emailResponse);
            }
            catch (Exception e)
            {
                logger.Error(e);
                emailResponse.ID      = Guid.NewGuid();
                emailResponse.Result  = false;
                emailResponse.Message = "Email Not Sent";
                logger.Info(emailResponse);
                return(emailResponse);
            }
        }
コード例 #3
0
        public async Task <IFileResponse> GetFileAsync(string fileId)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  FileID: {fileId} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");

                var fileDb = await _fileDbContext.FileDB.FirstOrDefaultAsync(k => k.Id == new Guid(fileId));

                if (fileDb == null)
                {
                    return(new FileResponse(ClientMessageConstant.FileNotFound, HttpStatusCode.NotFound));
                }

                var file = await _appDbContext.Files.FirstOrDefaultAsync(k => k.IdGuid == fileDb.Id);

                var model = new FileView()
                {
                    Id            = file.Id,
                    IdGuid        = file.IdGuid,
                    FileBytes     = fileDb.Bytes,
                    Name          = file.Name,
                    CorrelationId = file.CorrelationId,
                    MimeType      = file.MimeType,
                    SizeMb        = file.SizeMb,
                    ExtraParams   = file.ExtraParams
                };

                return(new FileResponse(model));
            }
            catch (Exception e)
            {
                logger.Error(e);
                return(new FileResponse(e));
            }
        }
コード例 #4
0
        public static void ProcessSeed()
        {
            var connectionString = Configuration.GetConnectionString("DefaultConnection");

            //Configuration["ConnectionStrings:DefaultConnection"];
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                var sqlPath        = ExtensionUtility.MapPath("~/App_Data/install/seedItem.sql");
                var customCommands = new List <string>();
                customCommands.AddRange(ExtensionUtility.ParseCommands(sqlPath));
                using (var cmd = connection.CreateCommand())
                {
                    connection.Open();
                    if (customCommands != null)
                    {
                        foreach (var strcommand in customCommands)
                        {
                            cmd.CommandText = strcommand;
                        }
                        cmd.Connection  = connection;
                        cmd.CommandType = CommandType.Text;
                        cmd.ExecuteNonQuery();
                    }
                }
            }
        }
コード例 #5
0
        private async Task <File> SaveFileAsync(IFormFile file, int userId, int fileType)
        {
            logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  AnswerFileType : {fileType} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
            var userInfo = await _appDbContext.UserInfos.Include(k => k.User).FirstOrDefaultAsync(k => k.Id == userId);

            var data = new File()
            {
                IdGuid       = Guid.NewGuid(),
                SizeMb       = file.Length.ToFileMB(),
                Name         = file.FileName,
                ProviderName = "SqlProvider",
                ExtraParams  = "",
                Created      = DateTime.UtcNow,
                MimeType     = file.ContentType,
                Modified     = DateTime.UtcNow,
                CreatedBy    = userInfo.Email,
                ModifiedBy   = userInfo.Email
            };

            var savedEntity = (await _appDbContext.Files.AddAsync(data)).Entity;

            if (fileType == (int)ApplicationQuestionType.File)
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  DocFile : {fileType}");
                await UploadIntoFileDbAsync(savedEntity.IdGuid, file);
            }
            else if (fileType == (int)ApplicationQuestionType.VideoAttachment)
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  VideoFile : {fileType}");
                minioAudioVideoUpload(file, savedEntity.IdGuid);
            }
            await _appDbContext.SaveChangesAsync();

            return(savedEntity);
        }
コード例 #6
0
        public async Task <IRecommendLeaderResponse> GetRecommendFitListAsync()
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() } UserIPAddress: { _userIPAddress.GetUserIP().Result }");

                var RecommendFitList = await _appDbContext.LookupItems.Where(k => k.LookupId == (int)LookupType.Recommendation).OrderBy(k => k.NameEn).ToListAsync();

                var RecommendSourceItemList = await _appDbContext.LookupItems.Where(k => k.LookupId == (int)LookupType.SourceItem).OrderBy(k => k.NameEn).ToListAsync();

                var RecommendStatusItem = await _appDbContext.LookupItems.Where(k => k.LookupId == (int)LookupType.StatusItem).OrderBy(k => k.NameEn).ToListAsync();

                var data = new RecommendationFitDetailsView()
                {
                    RecommendLeaderFitList        = _mapper.Map <List <LookupItemView> >(RecommendFitList),
                    RecommendLeaderSourceItemList = _mapper.Map <List <LookupItemView> >(RecommendSourceItemList),
                    RecommendLeaderStatusItem     = _mapper.Map <List <LookupItemView> >(RecommendStatusItem)
                };

                return(new RecommendLeaderResponse(data));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw ex;
            }
        }
コード例 #7
0
        public async Task <IPeopleNearByResponse> HideUserLocation(int userId, bool isHideLocation)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  input: {userId} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");

                var data = await _appDbContext.UserLocations.FirstOrDefaultAsync(x => x.ProfileID == userId);

                if (data == null)
                {
                    return(new PeopleNearByResponse(ClientMessageConstant.UserNotFound, HttpStatusCode.NotFound));
                }

                if (data != null)
                {
                    data.isHideLocation = isHideLocation;
                    await _appDbContext.SaveChangesAsync();
                }

                var userLocation = _mapper.Map <UserLocationModelView>(data);
                return(new PeopleNearByResponse(userLocation));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw ex;
            }
        }
コード例 #8
0
        /// <summary>
        /// This actions returns FundSourceManagement view
        /// with required data
        /// </summary>
        /// <returns></returns>
        public ActionResult FundingSourceManagement()
        {
            try
            {
                if (SessionManagement.UserInfo != null)
                {
                    var model = new FundingSourceModel();
                    ViewData["ReceivingBankInfo"] = new SelectList(receivingBankInfoBO.GetReceivingBankInfo((int)SessionManagement.OrganizationID), "PK_RecievingBankID", "RecievingBankName");
                    ViewData["Country"]           = new SelectList(countryBO.GetCountries(), "PK_CountryID", "CountryName");
                    ViewData["Currency"]          = new SelectList(currencyBO.GetCurrencies(), "PK_CurrencyValueID", "CurrencyValue");
                    ViewData["SourceType"]        = new SelectList(ExtensionUtility.GetAllSourceTypes(), "ID", "Value");

                    return(View(model));
                }
                else
                {
                    return(RedirectToAction("Login", "Account", new { Area = "" }));
                }
            }
            catch (Exception ex)
            {
                CurrentDeskLog.Error(ex.Message, ex);
                return(View("ErrorMessage"));
            }
        }
コード例 #9
0
        public async Task <IActivityAndChallengesResponse> GetActivityAsync(int profileId, int categoryId, int activityId)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  ProfileId: {profileId} CategoryId: {categoryId} ActivityId: {activityId} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var userActivity = await _appDbContext.InitiativeProfiles.Include(k => k.Initiative)
                                   .Include(m => m.StatusItem).Where(k => k.ProfileId == profileId).ToListAsync();

                if (categoryId == (int)InitiativeType.MyActivity)
                {
                    var userInitiative = userActivity.Select(k =>
                    {
                        var ini = _mapper.Map <InitiativeViewModel>(k.Initiative);
                        ini.InitiativeStatus = _mapper.Map <LookupItemView>(k.StatusItem);
                        return(ini);
                    }).ToList().FirstOrDefault(c => c.Id == activityId);
                    if (userInitiative != null)
                    {
                        return(new ActivityAndChallengesResponse(userInitiative));
                    }
                    else
                    {
                        return(new ActivityAndChallengesResponse(ClientMessageConstant.Deeplink, HttpStatusCode.NotFound));
                    }
                }

                var initiative = await _appDbContext.Initiatives.FirstOrDefaultAsync(k => (k.CategoryId == categoryId || k.InitiativeTypeItemId == categoryId) && k.Id == activityId);

                var initiativeViewModel = _mapper.Map <InitiativeViewModel>(initiative);

                if (initiativeViewModel != null)
                {
                    var reminder = await _appDbContext.Reminders.Where(x => x.UserID == profileId && x.ActivityId == initiativeViewModel.Id && x.ApplicationId == 2).FirstOrDefaultAsync();

                    initiativeViewModel.isReminderSet = reminder != null ? true : false;

                    initiativeViewModel.InitiativeStatus =
                        _mapper.Map <LookupItemView>(userActivity.FirstOrDefault(c => c.InitiativeId == initiativeViewModel.Id)
                                                     ?.StatusItem);
                    if (initiativeViewModel.FileId != new Guid())
                    {
                        var fileDb = await _fileDbContext.FileDB.FirstOrDefaultAsync(k => k.Id == initiativeViewModel.FileId);

                        if (fileDb != null)
                        {
                            var file = await _appDbContext.Files.FirstOrDefaultAsync(k => k.IdGuid == fileDb.Id);

                            initiativeViewModel.FileName = file.Name;
                        }
                    }
                }
                return(new ActivityAndChallengesResponse(initiativeViewModel));
            }
            catch (Exception e)
            {
                logger.Error(e);
                return(new ActivityAndChallengesResponse(e));
            }
        }
コード例 #10
0
        public async Task <EmailView> SendReportProblemEmailAsync(string reportText, string fromEmail, string userName)
        {
            EmailView emailResponse = new EmailView();

            try
            {
                var emailSetting = await _appDbContext.ApplicationSettings.ToListAsync();

                var appSetting = new AppSettings()
                {
                    SmtpHost     = emailSetting.FirstOrDefault(k => k.Key == "smtpHostName")?.Value,
                    SmtpPassword = emailSetting.FirstOrDefault(k => k.Key == "smtpPassword")?.Value,
                    SmtpPort     = emailSetting.FirstOrDefault(k => k.Key == "smtpPortNumber")?.Value,
                    SmtpUsername = emailSetting.FirstOrDefault(k => k.Key == "emailUs")?.Value
                };
                //logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  SMTP_PasswordEncrypt: {appSetting.SmtpPassword}");

                appSetting.SmtpPassword = _encryptor.Decrypt(appSetting.SmtpPassword);
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  ToEmail: {appSetting.SmtpUsername}");
                //logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  SMTP_PasswordDecrypt: {appSetting.SmtpPassword}");


                fromEmail = fromEmail != null ? fromEmail : appSetting.SmtpUsername;
                var email    = new MailMessage(fromEmail, appSetting.SmtpUsername);
                var template = await _appDbContext.Templates.Where(x => x.SysName == "ProfileCompletenessTemplate").FirstOrDefaultAsync();

                var templateInfo = await _appDbContext.TemplateInfos.Include(k => k.EmailHeaderAndFooterTemplate).Where(x => x.TemplateId == template.Id).FirstOrDefaultAsync();

                var body = GetReportProblemContent(templateInfo, reportText, email, userName);


                email.Body       = body;
                email.IsBodyHtml = true;
                using (var smtp = new SmtpClient())
                {
                    smtp.Host      = appSetting.SmtpHost;
                    smtp.EnableSsl = true;
                    NetworkCredential networkCred = new NetworkCredential(appSetting.SmtpUsername, appSetting.SmtpPassword);
                    smtp.UseDefaultCredentials = true;
                    smtp.Credentials           = networkCred;
                    smtp.Port = int.Parse(appSetting.SmtpPort);
                    smtp.Send(email);
                }
                emailResponse.ID      = Guid.NewGuid();
                emailResponse.Result  = true;
                emailResponse.Message = "Email Sent";

                return(emailResponse);
            }
            catch (Exception e)
            {
                logger.Error(e);
                emailResponse.ID      = Guid.NewGuid();
                emailResponse.Result  = false;
                emailResponse.Message = "Email Not Sent";
                logger.Info(emailResponse);
                return(emailResponse);
            }
        }
コード例 #11
0
        public async Task <IUserRecommendationResponse> AddNotificationAsync(int recipientUserID, ActionType actionId, int recommendId, ParentType parentTypeId, int senderUserId, string notifyText)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  userId: {senderUserId} UserIPAddress: { _userIPAddress.GetUserIP().Result }");

                //var profileId = userId != senderUserId ? senderUserId : userId;
                var notificationGenericObject = await _mongoDbContext.NotificationGenericObjects.Find(x => x.UserID == recipientUserID).FirstOrDefaultAsync() ??
                                                await AddNotificationObjectAsync(recipientUserID);

                var notificationObj = new Notification
                {
                    ID           = ObjectId.GenerateNewId(),
                    ActionID     = (int)actionId,
                    IsRead       = false,
                    ParentID     = recommendId.ToString(),
                    ParentTypeID = (int)parentTypeId,
                    SenderID     = senderUserId
                };

                notificationGenericObject.Notifications.Add(notificationObj);

                //if (userId != senderUserId)
                //{
                notificationGenericObject.UnseenNotificationCounter += 1;
                var notificationView = _mapper.Map <NotificationView>(notificationObj);
                await FillNotificationUserDetailsAsync(recipientUserID, new List <NotificationView>() { notificationView });

                var deviceIds = await _appDbContext.UserDeviceInfos.Where(k => k.UserId == recipientUserID).Select(k => k.DeviceId).ToListAsync();

                foreach (var deviceId in deviceIds)
                {
                    await _pushNotificationService.SendRecommendPushNotificationAsync(notificationView, notifyText, deviceId);
                }

                logger.Info("Notification sent");
                //}

                await _mongoDbContext.NotificationGenericObjects.ReplaceOneAsync(x => x.UserID == recipientUserID, notificationGenericObject);



                var notificationGenericObjectView = new NotificationGenericObjectView
                {
                    ID     = notificationGenericObject.ID.ToString(),
                    UserID = notificationGenericObject.UserID,
                    UnseenNotificationCounter = notificationGenericObject.UnseenNotificationCounter,
                    NotificationsList         = _mapper.Map <List <NotificationView> >(notificationGenericObject.Notifications)
                };

                return(new UserRecommendationResponse(notificationGenericObjectView));
            }
            catch (Exception e)
            {
                return(new UserRecommendationResponse(e));
            }
        }
コード例 #12
0
        public void InitializeParticle(RewardType rewardType, Vector3 position)
        {
            var particleSystem       = particleComponents.First(x => x.ParticleType == rewardType).ParticleSystem;
            var instantiatedParticle =
                Instantiate(particleSystem, position, Quaternion.identity, transform);

            StartCoroutine(ExtensionUtility.StartWithDelay(instantiatedParticle.main.duration,
                                                           () => Destroy(instantiatedParticle)));
        }
コード例 #13
0
        public async Task <IAccountResponse> ForgotPass(ForgotPassword view)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  input : {view.ToJsonString()} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var userInfo = await _appDbContext.UserInfos.Include(k => k.User).FirstOrDefaultAsync(x => x.Email == view.Email);

                ViewModels.ValidateOtp validateOtp = new ViewModels.ValidateOtp();
                if (userInfo == null)
                {
                    return(new AccountResponse(new ViewModels.UserRegistration
                    {
                        Success = false,
                        CustomStatusCode = CustomStatusCode.NotRegisteredEmailID,
                        Message = ClientMessageConstant.NotRegisteredEmailId
                    }));
                }
                else
                {
                    var profileInfo = await _appDbContext.Profiles.FirstOrDefaultAsync(x => x.Id == userInfo.Id);

                    var userName = view.LanguageType == LanguageType.EN ? userInfo.User.NameEn : userInfo.User.NameAr;

                    var emailResult = await _emailService.SendResetPasswordEmailAsync(userInfo.Email, userName, view.LanguageType);

                    validateOtp.UserId = userInfo.UserId;
                    validateOtp.Otp    = userInfo.OTP;
                    userInfo.OTP       = emailResult.OTP;
                    userInfo.Modified  = DateTime.Now;
                    _appDbContext.UserInfos.Update(userInfo);
                    await _appDbContext.SaveChangesAsync();



                    return(new AccountResponse(new ViewModels.UserRegistration
                    {
                        Id = userInfo.UserId,
                        FirstName = profileInfo.FirstNameEn,
                        LastName = profileInfo.LastNameEn,
                        Success = true,
                        CustomStatusCode = CustomStatusCode.Success,
                        Message = ClientMessageConstant.Success
                    }));
                }
            }
            catch (System.Exception ex)
            {
                //Message = $"An error occurred when resetting password: {ex.Message}";
                return(new AccountResponse(new ViewModels.UserRegistration
                {
                    Success = false,
                    CustomStatusCode = CustomStatusCode.FunctionalError,
                    Message = ClientMessageConstant.WeAreUnableToProcessYourRequest
                }, ex));
            }
        }
コード例 #14
0
        public async Task <EmailView> SendReminderEmailAsync(string toEmail, string content, string userName, int daysLeft, DateTime?registrationEndDate)
        {
            EmailView emailResponse = new EmailView();

            try
            {
                var emailSetting = await _appDbContext.ApplicationSettings.ToListAsync();

                var appSetting = new AppSettings()
                {
                    SmtpHost     = emailSetting.FirstOrDefault(k => k.Key == "smtpHostName")?.Value,
                    SmtpPassword = emailSetting.FirstOrDefault(k => k.Key == "smtpPassword")?.Value,
                    SmtpPort     = emailSetting.FirstOrDefault(k => k.Key == "smtpPortNumber")?.Value,
                    SmtpUsername = emailSetting.FirstOrDefault(k => k.Key == "smtpUserName")?.Value
                };
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  SMTP_PasswordEncrypt: {appSetting.SmtpPassword}");

                appSetting.SmtpPassword = _encryptor.Decrypt(appSetting.SmtpPassword);

                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  SMTP_PasswordDecrypt: {appSetting.SmtpPassword}");

                var email = new MailMessage(appSetting.SmtpUsername, toEmail);

                var templateInfo = await _appDbContext.TemplateInfos.Include(k => k.EmailHeaderAndFooterTemplate).FirstOrDefaultAsync(k => k.Id == 13001);

                var body = GetReminderContent(content, templateInfo, email, userName, daysLeft, registrationEndDate);


                email.Body       = body;
                email.IsBodyHtml = true;
                using (var smtp = new SmtpClient())
                {
                    smtp.Host      = appSetting.SmtpHost;
                    smtp.EnableSsl = true;
                    NetworkCredential networkCred = new NetworkCredential(appSetting.SmtpUsername, appSetting.SmtpPassword);
                    smtp.UseDefaultCredentials = true;
                    smtp.Credentials           = networkCred;
                    smtp.Port = int.Parse(appSetting.SmtpPort);
                    smtp.Send(email);
                }
                emailResponse.ID      = Guid.NewGuid();
                emailResponse.Result  = true;
                emailResponse.Message = "Email Sent";

                return(emailResponse);
            }
            catch (Exception e)
            {
                logger.Error(e);
                emailResponse.ID      = Guid.NewGuid();
                emailResponse.Result  = false;
                emailResponse.Message = "Email Not Sent";
                logger.Info(emailResponse);
                return(emailResponse);
            }
        }
コード例 #15
0
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  DBConnectionString : {_appSettings}");
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                //optionsBuilder.UseSqlServer("Data Source=10.200.2.116;Initial Catalog=GLP_LOPA;Persist Security Info=True;User ID=Sa;Password=Sw0rd@2020");
                optionsBuilder.UseSqlServer(_appSettings);
            }
        }
コード例 #16
0
        public async Task <IProgramResponse> GetReferenceAsync(int profileId, int batchId)
        {
            try
            {
                var userInfo = await _appDbContext.UserInfos.FirstOrDefaultAsync(k => k.Id == profileId);

                if (userInfo == null)
                {
                    return(new ProgramResponse(ClientMessageConstant.ProfileNotExist, HttpStatusCode.NotFound));
                }

                var application = await
                                  _appDbContext.Applications.FirstOrDefaultAsync(k => k.ProfileId == profileId && k.BatchId == batchId);

                if (application == null)
                {
                    return(new ProgramResponse(ClientMessageConstant.FileNotFound,
                                               HttpStatusCode.NotFound));
                }
                var parti = await _appDbContext.ParticipationReferences.FirstOrDefaultAsync(k => k.ApplicationID == application.Id && k.ProfileID == profileId);

                if (parti == null)
                {
                    parti = await GetReferenceAsync(application.Id, batchId, userInfo);

                    application.ParticipationReferenceID = parti.Id;
                    await _appDbContext.SaveChangesAsync();
                }


                application.StatusItemId = (int)ApplicationProgressStatus.Submitted;

                await _appDbContext.SaveChangesAsync();

                var toEmail = await _appDbContext.UserInfos.Where(x => x.UserId == profileId).Select(x => x.Email).FirstOrDefaultAsync();

                var firstName = await _appDbContext.Profiles.Where(k => k.Id == profileId).Select(k => k.FirstNameEn).FirstOrDefaultAsync();

                var lastName = await _appDbContext.Profiles.Where(k => k.Id == profileId).Select(k => k.LastNameEn).FirstOrDefaultAsync();

                var userName = firstName + " " + lastName;
                var batch    = await _appDbContext.Batches.Where(x => x.Id == batchId).FirstOrDefaultAsync();

                var programName = await _appDbContext.Programmes.Where(x => x.Id == batch.ProgrammeId).Select(x => x.TitleEn).FirstOrDefaultAsync();

                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  Sending Program Submission mail to : {toEmail} Program Name : {programName} UserName : {userName} ");
                await _emailService.SendProgramSubmissionEmailAsync(toEmail, programName, userName);

                return(new ProgramResponse(parti.ReferenceNumber));
            }
            catch (Exception e)
            {
                return(new ProgramResponse(e.Message, HttpStatusCode.InternalServerError));
            }
        }
コード例 #17
0
ファイル: CodeExporterHelper.cs プロジェクト: srxqds/ByteCode
    //int[][] Int2
    //List<int[]> ListInt1
    //Dictionary<int,string> DictionaryInt1String1
    //Dictionary<int,Dictionary<int,string>>
    //Dictionary<List<Dictionary<int,string>>,int>
    //Not support: int[,]
    private static string GetFunctionNameCode(string type)
    {
        Debug.LogError(type);
        List <object> nestArray = StringUtility.NestStringArrayParse(type, '<', '>', ',', true) as List <object>;

        Debug.LogError(ExtensionUtility.ToString(nestArray));
        string functionName = NestArray2FunctionName(Language.CSharp, nestArray, CodeMode.Encode);

        Debug.LogError(GenerateFunctionCode(Language.CSharp, type, CodeMode.Encode));
        return(functionName);
    }
コード例 #18
0
        public async Task <IAccountResponse> ForgotEmailID(ViewModels.ForgotEmail view)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  input : {view.ToJsonString()} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var profileInfo = await _appDbContext.Profiles.FirstOrDefaultAsync(x => x.Eid == view.EmirateID);

                ViewModels.ValidateOtp Votp = new ViewModels.ValidateOtp();
                if (profileInfo == null)
                {
                    return(new AccountResponse(new ViewModels.UserRegistration
                    {
                        Success = false,
                        CustomStatusCode = CustomStatusCode.NotRegisteredEmiratesID,
                        Message = ClientMessageConstant.NotRegisteredEmiratesId
                    }));
                }
                else
                {
                    var userInfo = await _appDbContext.UserInfos.FirstOrDefaultAsync(x => x.UserId == profileInfo.Id);

                    //EMailProvider emailSet = new EMailProvider(_settings.SmtpUsername, _settings.SmtpPassword, _settings.SmtpHost, _settings.SmtpPort);
                    //SendOtpEmail(emailSet, _settings.SmtpUsername, userInfo.Email, userInfo.otp);


                    //Votp.UserId = userInfo.UserId;
                    //Votp.Otp = userInfo.otp;

                    //Message = _settings.Success;
                    return(new AccountResponse(new ViewModels.UserRegistration
                    {
                        Id = userInfo.UserId,
                        FirstName = profileInfo.FirstNameEn,
                        LastName = profileInfo.LastNameEn,
                        Email = userInfo.Email,
                        //UserId = userInfo.UserId,
                        //Otp = userInfo.otp,
                        Success = true,
                        CustomStatusCode = CustomStatusCode.Success,
                        Message = ClientMessageConstant.Success
                    }));
                }
            }
            catch (System.Exception ex)
            {
                //Message = $"An error occurred when resetting password: {ex.Message}";
                return(new AccountResponse(new ViewModels.UserRegistration
                {
                    Success = false,
                    CustomStatusCode = CustomStatusCode.FunctionalError,
                    Message = ClientMessageConstant.WeAreUnableToProcessYourRequest
                }, ex));
            }
        }
コード例 #19
0
        public async Task <IAccountResponse> ResetPassword(ResetPassword view)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  input : {view.ToJsonString()} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");

                var userInfo = await _appDbContext.UserInfos.FirstOrDefaultAsync(x => x.UserId == view.UserId);

                if (userInfo == null)
                {
                    return(new AccountResponse(new ViewModels.UserRegistration
                    {
                        Id = view.UserId,
                        Success = false,
                        CustomStatusCode = CustomStatusCode.UserNotExist,
                        Message = ClientMessageConstant.UserNotFound
                    }));
                }

                var passresult = _hashing.ValidatePassword(view.OldPassword, userInfo.Password);
                if (!passresult)
                {
                    return(new AccountResponse(new ViewModels.UserRegistration
                    {
                        Id = userInfo.UserId,
                        Success = false,
                        CustomStatusCode = CustomStatusCode.PasswordIsWrong,
                        Message = ClientMessageConstant.PasswordIsWrong
                    }));
                }

                userInfo.Password = _hashing.CreateHash(view.NewPassword);
                await _appDbContext.SaveChangesAsync();


                return(new AccountResponse(new ViewModels.UserRegistration
                {
                    Id = userInfo.UserId,
                    Success = true,
                    CustomStatusCode = CustomStatusCode.Success,
                    Message = ClientMessageConstant.PasswordUpdatedSuccessfully
                }));
            }
            catch (System.Exception ex)
            {
                return(new AccountResponse(new ViewModels.UserRegistration
                {
                    Success = false,
                    CustomStatusCode = CustomStatusCode.FunctionalError,
                    Message = ClientMessageConstant.WeAreUnableToProcessYourRequest
                }, ex));
            }
        }
コード例 #20
0
        public async Task <IUserRecommendationResponse> ReceiveAllRecommendationAsync(int recipientUserId)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() } UserIPAddress: { _userIPAddress.GetUserIP().Result }");

                var data = await _appDbContext.UserRecommendations.Where(x => x.RecipientUserID == recipientUserId && x.isAccepted != true).ToListAsync();

                var recommendDetails = _mapper.Map <List <UserRecommendView> >(data);



                foreach (var item in recommendDetails)
                {
                    var profile = await _appDbContext.Profiles.FirstOrDefaultAsync(k => k.Id == item.SenderUserID);

                    var workExperience = await _appDbContext.ProfileWorkExperiences.Include(k => k.Title)
                                         .Where(k => k.ProfileId == item.SenderUserID).OrderByDescending(y => y.DateFrom).FirstOrDefaultAsync();

                    var user = await _appDbContext.Users.FirstOrDefaultAsync(k => k.Id == item.SenderUserID);

                    item.UserInfo = new PublicProfileView()
                    {
                        Id              = profile.Id,
                        FirstNameAr     = profile.FirstNameAr ?? "",
                        FirstNameEn     = profile.FirstNameEn ?? "",
                        LastNameAr      = profile.LastNameAr ?? "",
                        LastNameEn      = profile.LastNameEn ?? "",
                        SecondNameAr    = profile.SecondNameAr ?? "",
                        SecondNameEn    = profile.SecondNameEn ?? "",
                        ThirdNameAr     = profile.ThirdNameAr ?? "",
                        ThirdNameEn     = profile.ThirdNameEn ?? "",
                        Designation     = workExperience?.Title?.TitleEn ?? "",
                        DesignationAr   = workExperience?.Title?.TitleAr ?? "",
                        UserImageFileId = user?.OriginalImageFileId ?? 0,
                        About           = ""
                    };
                }
                var recommendInfo = new UserRecommendationDetails()
                {
                    RecommendationInfo = recommendDetails
                };


                return(new UserRecommendationResponse(recommendInfo));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                return(new UserRecommendationResponse(ex));
            }
        }
コード例 #21
0
        /// <summary>
        /// This method returns source type value from ID
        /// </summary>
        /// <param name="sourceTypeID">sourceTypeID</param>
        /// <returns></returns>
        public string GetSourceTypeValueFromID(int sourceTypeID)
        {
            var allSourceTypes = ExtensionUtility.GetAllSourceTypes();

            foreach (var source in allSourceTypes)
            {
                if (source.ID == sourceTypeID)
                {
                    return(source.Value);
                }
            }

            return(String.Empty);
        }
コード例 #22
0
ファイル: ExportConfigHelper.cs プロジェクト: srxqds/ByteCode
        public static void DoTest()
        {
            Debug.LogError(ExtensionUtility.ToString(String2Object("int", "0")));
            Debug.LogError(ExtensionUtility.ToString(String2Object("int[]", "[[1,2]]")));

            /*Debug.LogError(ExtensionUtility.ToString(String2Object("int[][]", "[[1,2],[3,4]]")));
             * Debug.LogError(ExtensionUtility.ToString(String2Object("List<int>", "[5,6]")));
             * Debug.LogError(ExtensionUtility.ToString(String2Object("List<int[]>[]", "[[[7,8],[9,10]]]")));
             * Debug.LogError(ExtensionUtility.ToString(String2Object("Dictionary<int,string>", "[1:test,2:string]")));
             * Debug.LogError(ExtensionUtility.ToString(String2Object("Dictionary<int,List<int>>", "[1:[1,2],2:[3,4]]")));
             * Debug.LogError(
             *  ExtensionUtility.ToString(String2Object("Dictionary<int,List<int>>[]",
             *      "[[1:[1,2],2:[3,4]],[1:[1,2],2:[3,4]]]")));*/
        }
コード例 #23
0
        public async Task <IReportProblemResponse> ReportProblemAsync(ReportProblemView view)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  input: {view.ToJsonString()} UserIPAddress: { _userIPAddress.GetUserIP().Result }");

                var email = await _appDbContext.UserInfos.Where(k => k.UserId == view.UserID).Select(k => k.Email).FirstOrDefaultAsync();

                if (email == null)
                {
                    return(new ReportProblemResponse(ClientMessageConstant.UserNotFound, HttpStatusCode.NotFound));
                }

                var firstName = await _appDbContext.Profiles.Where(k => k.Id == view.UserID).Select(k => k.FirstNameEn).FirstOrDefaultAsync();

                var lastName = await _appDbContext.Profiles.Where(k => k.Id == view.UserID).Select(k => k.LastNameEn).FirstOrDefaultAsync();

                var userName = firstName + " " + lastName;

                var data = new ReportProblem()
                {
                    UserID            = view.UserID,
                    ReportDescription = view.ReportDescription,
                    Created           = DateTime.Now,
                    Modified          = DateTime.Now,
                    CreatedBy         = userName,
                    ModifiedBy        = userName,
                };

                if (view.ReportFile != null)
                {
                    data.ReportFileID = (await SaveFileAsync(view.ReportFile, email)).Id;
                }

                await _appDbContext.ReportProblems.AddAsync(data);

                await _appDbContext.SaveChangesAsync();

                await _emailService.SendReportProblemEmailAsync(view.ReportDescription, email, userName);

                var reportProblem = _mapper.Map <ReportProblemModelView>(data);

                return(new ReportProblemResponse(reportProblem));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw ex;
            }
        }
コード例 #24
0
        public async Task <IPeopleNearByResponse> AddUpdateUserLocation(UserLocationModel view)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  input: {view.ToJsonString()} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");

                var firstName = await _appDbContext.Profiles.Where(k => k.Id == view.ProfileID).Select(k => k.FirstNameEn).FirstOrDefaultAsync();

                var lastName = await _appDbContext.Profiles.Where(k => k.Id == view.ProfileID).Select(k => k.LastNameEn).FirstOrDefaultAsync();

                var userName = firstName + " " + lastName;

                var data = await _appDbContext.UserLocations.FirstOrDefaultAsync(x => x.ProfileID == view.ProfileID);

                if (data == null)
                {
                    data = new UserLocation()
                    {
                        ProfileID      = view.ProfileID,
                        Latitude       = view.Latitude,
                        Longitude      = view.Longitude,
                        isHideLocation = true,
                        Created        = DateTime.Now,
                        LastUpdated    = DateTime.Now,
                        CreatedBy      = userName,
                        LastUpdatedBy  = userName
                    };

                    await _appDbContext.UserLocations.AddAsync(data);

                    await _appDbContext.SaveChangesAsync();
                }
                else
                {
                    data.Latitude    = view.Latitude;
                    data.Longitude   = view.Longitude;
                    data.LastUpdated = DateTime.Now;
                    await _appDbContext.SaveChangesAsync();
                }

                var userLocation = _mapper.Map <UserLocationModelView>(data);
                return(new PeopleNearByResponse(userLocation));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw ex;
            }
        }
コード例 #25
0
        public async Task <IResponse <ViewModels.ValidateOtp> > ValidateOtp(ViewModels.ValidateOtp view)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  input : {view.ToJsonString()} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var userInfo = await _appDbContext.UserInfos.FirstOrDefaultAsync
                               (
                    x => x.UserId == view.UserId &&
                    x.OTP == view.Otp);

                if (userInfo == null)
                {
                    return(new OTPResponce(new ViewModels.ValidateOtp
                    {
                        Success = false,
                        CustomStatusCode = CustomStatusCode.OTPExpiredOrInvalid,
                        Message = ClientMessageConstant.OTPExpiredOrInvalid
                    }));
                }

                //userInfo.TokenIsCompleted = true;
                userInfo.IsActive = true;
                userInfo.CanLogin = true;
                userInfo.Modified = DateTime.Now;
                _appDbContext.UserInfos.Update(userInfo);
                await _appDbContext.SaveChangesAsync();

                return(new OTPResponce(new ViewModels.ValidateOtp
                {
                    UserId = view.UserId,
                    Otp = view.Otp,
                    Success = true,
                    CustomStatusCode = CustomStatusCode.Success,
                    Message = ClientMessageConstant.Success
                }));
            }
            catch (System.Exception ex)
            {
                //Message = $"An error occurred when resetting password: {ex.Message}";
                return(new OTPResponce(new ViewModels.ValidateOtp
                {
                    UserId = view.UserId,
                    Otp = view.Otp,
                    Success = false,
                    CustomStatusCode = CustomStatusCode.FunctionalError,
                    Message = ClientMessageConstant.WeAreUnableToProcessYourRequest
                }));
            }
        }
コード例 #26
0
        public async Task <IResponse <ViewModels.ValidateOtp> > ResendOtp(ViewModels.ResendOTP view)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  input : {view.ToJsonString()} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var userInfo = await _appDbContext.UserInfos.Include(k => k.User).FirstOrDefaultAsync(x => x.UserId == view.UserId);

                if (userInfo == null)
                {
                    return(new OTPResponce(new ViewModels.ValidateOtp
                    {
                        UserId = view.UserId,
                        Success = false,
                        CustomStatusCode = CustomStatusCode.UserNotExist,
                        Message = ClientMessageConstant.UserNotFound
                    }));
                }
                var userName = view.LanguageType == LanguageType.EN ? userInfo.User.NameEn : userInfo.User.NameAr;

                var emailResult = view.ResendOtpType == ResendOtpType.ResetPassword
                    ? await _emailService.SendResetPasswordEmailAsync(userInfo.Email, userName, view.LanguageType)
                    : await _emailService.SendActivationEmailAsync(userInfo.Email, userName, view.LanguageType);

                userInfo.OTP      = emailResult.OTP;
                userInfo.Modified = DateTime.Now;
                _appDbContext.UserInfos.Update(userInfo);
                await _appDbContext.SaveChangesAsync();


                return(new OTPResponce(new ViewModels.ValidateOtp
                {
                    UserId = view.UserId,
                    Success = true,
                    CustomStatusCode = CustomStatusCode.Success,
                    Message = ClientMessageConstant.Success
                }));
            }
            catch (System.Exception ex)
            {
                //Message = $"An error occurred when resetting password: {ex.Message}";
                return(new OTPResponce(new ViewModels.ValidateOtp
                {
                    UserId = view.UserId,
                    Success = false,
                    CustomStatusCode = CustomStatusCode.FunctionalError,
                    Message = ClientMessageConstant.WeAreUnableToProcessYourRequest
                }));
            }
        }
コード例 #27
0
        public async Task <IProgramResponse> GetBatchQuestionsAsync(int profileId, int batchId)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  userId: {profileId} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var batchDetails = await _appDbContext.Batches.FirstOrDefaultAsync(k => k.Id == batchId && !k.IsClosed && k.DateRegFrom <= DateTime.Now && k.DateRegTo >= DateTime.Now);

                if (batchDetails == null)
                {
                    return(null);
                }

                var questionGroups = await _appDbContext.QuestionGroupsQuestions.Include(m => m.Group)
                                     .Include(k => k.Question).Include(k => k.Question.QuestionTypeItem).Include(k => k.Question.Options)
                                     .Where(k => k.GroupId == batchDetails.QuestionGroupId).ToListAsync();

                var questions = questionGroups.Select(k => k.Question).ToList();

                var questionViews = _mapper.Map <List <QuestionViewModel> >(questions);

                var application = await
                                  _appDbContext.Applications.FirstOrDefaultAsync(k => k.ProfileId == profileId && k.BatchId == batchId);

                if (application != null)
                {
                    var listdata = await _appDbContext.QuestionAnswers.Include(k => k.AnswerFile).Include(k => k.Questionansweroptions)
                                   .Where(k => k.ProfileId == profileId && k.ApplicationId == application.Id).ToListAsync();

                    var answers = _mapper.Map <List <QuestionAnswerViewModel> >(listdata);
                    foreach (var item in answers)
                    {
                        var options = listdata.FirstOrDefault(a => a.Id == item.Id).Questionansweroptions.ToList();
                        item.MultiSelectedOptionId = options.Select(a => new QuestionAnswerOptionViewModel()
                        {
                            optionID         = a.optionID,
                            QuestionanswerID = a.QuestionanswerID
                        }).ToList();
                    }
                    questionViews.ForEach(k => k.Answered = answers.FirstOrDefault(y => y.QuestionId == k.Id));
                }

                return(new ProgramResponse(questionViews));
            }
            catch (Exception e)
            {
                return(new ProgramResponse(e.Message, HttpStatusCode.InternalServerError));
            }
        }
コード例 #28
0
        public async Task <IProgramResponse> GetAllProgramAsync(int profileId)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  userId: {profileId} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var programs = await _appDbContext.Programmes.Include(m => m.ProgrammeTypeItem).Include(k => k.Batches).ToListAsync();

                var programViews = _mapper.Map <List <ProgramView> >(programs);

                var applications = _mapper.Map <List <ApplicationView> >(await _appDbContext.Applications
                                                                         .Include(k => k.StatusItem).Include(k => k.ReviewStatusItem).Include(k => k.AssessmentItem)
                                                                         .Include(k => k.SecurityItem).Include(k => k.VideoAssessmentStatus)
                                                                         .Where(k => k.ProfileId == profileId).ToListAsync());

                programViews.ForEach(k => k.Applications = applications);


                foreach (var programView in programViews)
                {
                    programView.CompletedUsersList =
                        await GetProgramCompletedUserDetailsAsync(profileId, programView.BatchId ?? 0);

                    var reminder = await _appDbContext.Reminders.Where(x => x.UserID == profileId && x.ActivityId == programView.BatchId && x.ApplicationId == 1).FirstOrDefaultAsync();

                    programView.isReminderSet = reminder != null ? true : false;

                    List <ApplicationReference> _ref = new List <ApplicationReference>();
                    foreach (var item in programView.Applications)
                    {
                        _ref.Add(new ApplicationReference()
                        {
                            ApplicationId   = item.Id,
                            ReferenceNumber = _appDbContext.ParticipationReferences.FirstOrDefault(a => a.ApplicationID != null && a.ApplicationID == item.Id && a.ProfileID == item.ProfileId)?.ReferenceNumber ?? ""
                        });
                        programView.Application_reference = _ref;
                        //item.ReferenceNumber = _appDbContext.ParticipationReferences.FirstOrDefault(a => a.ApplicationID != null && a.ApplicationID == item.Id && a.ProfileID == item.ProfileId).ReferenceNumber ?? "";
                    }
                }

                return(new ProgramResponse(programViews));
            }
            catch (Exception e)
            {
                logger.Error(e);
                return(new ProgramResponse(e.Message, HttpStatusCode.InternalServerError));
            }
        }
コード例 #29
0
        public async Task <IAccountResponse> SetNewPassword(ViewModels.SetNewPassword view)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  input : {view.ToJsonString()} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var userInfo = await _appDbContext.UserInfos.FirstOrDefaultAsync(x => x.UserId == view.UserId);

                if (userInfo == null)
                {
                    //Message = ClientMessageConstant.UserNotFound);
                    return(new AccountResponse(new ViewModels.UserRegistration
                    {
                        Id = view.UserId,
                        Success = false,
                        CustomStatusCode = CustomStatusCode.UserNotExist,
                        Message = ClientMessageConstant.UserNotFound
                    }));
                }
                ;

                userInfo.Password         = _hashing.CreateHash(view.NewPassword);
                userInfo.TokenIsCompleted = true;
                await _appDbContext.SaveChangesAsync();

                //Message = _settings.Success;
                return(new AccountResponse(new ViewModels.UserRegistration
                {
                    Id = userInfo.UserId,

                    Success = true,
                    CustomStatusCode = CustomStatusCode.Success,
                    Message = ClientMessageConstant.PasswordUpdatedSuccessfully
                }));
            }
            catch (System.Exception ex)
            {
                // TODO logging stuff
                //Message = $"An error occurred when resetting password: {ex.Message}";
                return(new AccountResponse(new ViewModels.UserRegistration
                {
                    Success = false,
                    CustomStatusCode = CustomStatusCode.FunctionalError,
                    Message = ClientMessageConstant.WeAreUnableToProcessYourRequest
                }, ex));
            }
        }
コード例 #30
0
        public async Task <IUserRecommendationResponse> ReceiveRecommendationAsync(int recipientUserId, int recommendID)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() } UserIPAddress: { _userIPAddress.GetUserIP().Result }");

                var data = await _appDbContext.UserRecommendations.Where(x => x.RecipientUserID == recipientUserId && x.ID == recommendID).FirstOrDefaultAsync();

                //var recommendDetails = _mapper.Map<UserRecommendationModelView>(data);
                var userRecommend = _mapper.Map <UserRecommendationModelView>(data);
                return(new UserRecommendationResponse(userRecommend));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                return(new UserRecommendationResponse(ex));
            }
        }