Example #1
0
        public JsonResponse <UserProfileDTO> DisplayRaceUserProfile(long userID)
        {
            JsonResponse <UserProfileDTO> response = new JsonResponse <UserProfileDTO>();

            try
            {
                ExceptionEngine.AppExceptionManager.Process(() =>
                {
                    UserProfileDTO objUserProfileDTO = new UserProfileDTO();

                    UserProfileBO objUserProfileBO = UserBusinessInstance.DisplayUserProfile(userID);
                    EntityMapper.Map(objUserProfileBO, objUserProfileDTO);
                    if (objUserProfileDTO.UserID > 0)
                    {
                        response.IsSuccess    = true;
                        response.SingleResult = objUserProfileDTO;
                    }
                    else
                    {
                        response.IsSuccess = false;
                        response.Message   = Messages.InvalidUserID;
                    }
                }, AspectEnums.ExceptionPolicyName.ServiceExceptionPolicy.ToString());
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }
            return(response);
        }
Example #2
0
        private void WelcomeUserAccuITAdmin(int userID)
        {
            USERPROFILE        = UserBusinessInstance.DisplayUserProfile(userID);
            USERWEDDINGPROFILE = WeddingBusinessInstance.GetUserWeddingSubscriptions(userID);
            CreateFreshSession();

            int roleID = (int)USERPROFILE.RoleID;

            HttpContext.Session[PageConstants.SESSION_USER_ID]         = userID;
            HttpContext.Session[PageConstants.SESSION_PROFILE_KEY]     = USERPROFILE;
            HttpContext.Session[PageConstants.SESSION_WEDDING_PROFILE] = USERWEDDINGPROFILE;
            HttpContext.Session[PageConstants.SESSION_ROLE_ID]         = roleID;
            HttpContext.Session[PageConstants.SESSION_ADMIN]           = USERPROFILE.IsAdmin ? "1" : "0";
            var myWeddings = WeddingBusinessInstance.GetUserWeddingDetail(userID);

            SetUserModules(userID);
            ActivityLog.SetLog("Welcome to Accuit| Sessions created.", LogLoc.INFO);
        }
Example #3
0
        private bool SendOTPAndEmail(int UserId)
        {
            bool IsSuccess = false;

            #region Prepare OTP Data

            string UniqueString = AppUtil.GetUniqueGuidString();
            string OTPString    = AppUtil.GetUniqueRandomNumber(100000, 999999); // Generate a Six Digit OTP
            OTPBO  objOTP       = new OTPBO()
            {
                GUID = UniqueString, OTP = OTPString, CreatedDate = DateTime.Now, UserID = UserId, Attempts = 0
            };

            #endregion
            try
            {
                if (SecurityBusinessInstance.SaveOTP(objOTP))
                {
                    #region Send Email Servie and OTP
                    //string hostName = AppUtil.GetAppSettings(AspectEnums.ConfigKeys.HostName);
                    string resetUrl         = AppUtil.GetAppSettings(AspectEnums.ConfigKeys.ForgotPasswordURL);
                    string PasswordResetURL = resetUrl + UniqueString;
                    //string PasswordResetURL = Request.Url.AbsoluteUri.Split('/')[0] + Request.Url.AbsoluteUri.Split('/')[1]  + resetUrl + "?id=" + UniqueString;
                    EmailNotificationService eNotification = new EmailNotificationService();
                    var userProfile = UserBusinessInstance.DisplayUserProfile(UserId); // empBusinessInstance.DisplayEmpProfile(EmpId);
                    TemplateMasterBO            objEmailTemplate = EmailBusinessInstance.GetEmailTemplate((int)AspectEnums.EmailTemplateCode.ResetPassword);
                    List <TemplateMergeFieldBO> mergeFields      = EmailBusinessInstance.GetEmailMergeFields(objEmailTemplate.TemplateID);
                    foreach (var field in mergeFields)
                    {
                        if (field.SRC_FIELD == "{{PASSWORDRESETURL}}")
                        {
                            objEmailTemplate.TemplateContent = eNotification.FindReplace(objEmailTemplate.TemplateContent, "{{PASSWORDRESETURL}}", PasswordResetURL);
                        }

                        else if (field.SRC_FIELD == "{{TONAME}}")
                        {
                            objEmailTemplate.TemplateContent = eNotification.FindReplace(objEmailTemplate.TemplateContent, field.SRC_FIELD, userProfile.FirstName + " " + userProfile.LastName);
                        }
                    }
                    objEmailTemplate.TemplateContent = eNotification.FindReplace(objEmailTemplate.TemplateContent, "{{COMPANY}}", AppUtil.GetAppSettings(AspectEnums.ConfigKeys.CompanyName));


                    EmailServiceDTO emailService = new EmailServiceDTO();
                    emailService.Priority     = 1;
                    emailService.CreatedBy    = userProfile.UserID;
                    emailService.IsHtml       = true;
                    emailService.ToName       = userProfile.FirstName + " " + userProfile.LastName;
                    emailService.Body         = objEmailTemplate.TemplateContent;
                    emailService.Status       = (int)AspectEnums.EmailStatus.Pending;
                    emailService.ToEmail      = userProfile.Email;
                    emailService.FromName     = AppUtil.GetAppSettings(AspectEnums.ConfigKeys.FromName);
                    emailService.FromEmail    = AppUtil.GetAppSettings(AspectEnums.ConfigKeys.FromEmail);
                    emailService.Subject      = eNotification.FindReplace(objEmailTemplate.TemplateSubject, "{{COMPANY}}", AppUtil.GetAppSettings(AspectEnums.ConfigKeys.CompanyName));
                    emailService.IsAttachment = false;
                    emailService.TemplateID   = objEmailTemplate.TemplateID;
                    emailBusinessInstance.InsertEmailRecord(emailService);

                    eNotification.SendEmailNotification(emailService, objEmailTemplate);
                    IsSuccess = true;

                    #endregion
                }
            }
            catch (Exception ex)
            {
                IsSuccess = false;
            }


            return(IsSuccess);
        }