Пример #1
0
        public CommonResponse SendReactivationLink(InstaHangouts.Models.UserModel user)
        {
            CommonResponse commonResponse = new CommonResponse();

            try
            {
                commonResponse = this.unitOfWork.UserRepository.UpdateEmail(user);
                ////Mail sending function
                this.SendMail(user, Messages.ResendActivation);
                commonResponse.IsSuccess     = true;
                commonResponse.StatusMessage = Messages.UserResendMessage;
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace.ToString());
                commonResponse.IsSuccess     = false;
                commonResponse.StatusMessage = Messages.Exception;
            }

            return(commonResponse);
        }
Пример #2
0
        public CommonResponse EditUser(InstaHangouts.Models.UserModel user)
        {
            CommonResponse commonResponse = new CommonResponse();

            try
            {
                commonResponse = this.CheckingValidations(user, "Edit");
                if (commonResponse.IsSuccess)
                {
                    string password = user.Password;
                    user.Password         = password;
                    user.IsActive         = true;
                    user.IsEmailValidated = true;
                    user.EventAttender    = false;
                    user.IsFirstLogin     = false;
                    commonResponse        = this.unitOfWork.UserRepository.EditUser(user);
                    if (commonResponse.IsSuccess)
                    {
                        commonResponse.UserId        = user.UserId.ToString();
                        commonResponse.IsSuccess     = true;
                        commonResponse.StatusMessage = Messages.EditUserUpdatedMessage;
                    }
                    else
                    {
                        commonResponse.UserId        = user.UserId.ToString();
                        commonResponse.IsSuccess     = false;
                        commonResponse.userInfo      = user;
                        commonResponse.StatusMessage = Messages.EditUserUpdatedFailed;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace.ToString());
                commonResponse.IsSuccess     = false;
                commonResponse.StatusMessage = Messages.UserAlreadyError;
            }
            return(commonResponse);
        }
Пример #3
0
        public CommonResponse AddUser(InstaHangouts.Models.UserModel user)
        {
            CommonResponse commonResponse = new CommonResponse();

            try
            {
                commonResponse = this.CheckingValidations(user, "Add");
                if (commonResponse.IsSuccess)
                {
                    user.IsActive = false;
                    string password = Membership.GeneratePassword(12, 3);
                    user.IsFirstLogin  = false;
                    user.Password      = password;
                    user.EventAttender = false;
                    var addResponse = this.unitOfWork.UserRepository.AddUser(user);
                    if (addResponse.IsSuccess)
                    {
                        user.UserId = Convert.ToInt32(addResponse.UserId);
                        ////Mail sending function
                        this.SendMail(user, Messages.NewUser);
                        commonResponse.IsSuccess = true;
                        commonResponse.UserId    = addResponse.UserId;
                        user.UserId = Convert.ToInt32(addResponse.UserId);
                        commonResponse.StatusMessage = Messages.AddUserUpdatedMessage;
                        commonResponse.userInfo      = user;
                        commonResponse.UserId        = addResponse.UserId;
                    }
                    else
                    {
                        commonResponse.IsSuccess     = false;
                        commonResponse.StatusMessage = Messages.ActiveUserFailed;
                        commonResponse.userInfo      = user;
                        commonResponse.UserId        = addResponse.UserId;
                    }
                }
                else if (commonResponse.IsSuccess == false && commonResponse.StatusMessage == Messages.UserexistsWithFalse)
                {
                    user.IsActive = false;
                    string password = Membership.GeneratePassword(12, 3);
                    user.IsFirstLogin  = false;
                    user.Password      = password;
                    user.EventAttender = false;
                    user.Message       = Messages.UserexistsWithFalse;
                    user.UserId        = Convert.ToInt32(commonResponse.userInfo.UserId);
                    var addResponse = this.unitOfWork.UserRepository.EditUser(user);
                    if (addResponse.IsSuccess)
                    {
                        user.UserId = Convert.ToInt32(addResponse.UserId);
                        ////Mail sending function
                        this.SendMail(user, Messages.NewUser);
                        commonResponse.IsSuccess = true;
                        commonResponse.UserId    = addResponse.UserId;
                        user.UserId = Convert.ToInt32(addResponse.UserId);
                        commonResponse.StatusMessage = Messages.AddUserUpdatedMessage;
                        commonResponse.userInfo      = user;
                    }
                    else
                    {
                        commonResponse.IsSuccess     = false;
                        commonResponse.StatusMessage = Messages.ActiveUserFailed;
                        commonResponse.userInfo      = user;
                        commonResponse.UserId        = addResponse.UserId;
                    }
                }

                return(commonResponse);
            }
            catch (Exception ex)
            {
                commonResponse.IsSuccess     = false;
                commonResponse.StatusMessage = Messages.Exception;
                commonResponse.userInfo      = user;
                logger.Error(ex.StackTrace.ToString());
                return(commonResponse);
            }
        }