Beispiel #1
0
    protected void btnSaveNewPwd_Click(object sender, ImageClickEventArgs e)
    {
        RegisterUserBLL objUser = new RegisterUserBLL();
        Property objProp = new Property();

        objProp.UserID = txtUserID.Text;
        objProp.OldPassword = txtOldPwd.Text;
        objProp.Password = txtNewPassword.Text;

        string user = (string)Session["User"];

        try
        {
            if (objUser.ChangePassword(objProp, user))
            {
                string str = "alert('Password Changed Successfully...');";
                ScriptManager.RegisterStartupScript(btnSaveNewPwd, typeof(Page), "alert", str, true);
            }
            else
            {
                string str = "alert('Failed to Change Password, Please try again...');";
                ScriptManager.RegisterStartupScript(btnSaveNewPwd, typeof(Page), "alert", str, true);
            }
            ClearControls();
        }
        catch(Exception ex)
        {
            objNLog.Error("Error: " + ex.Message);
        }
    }
Beispiel #2
0
 private void RetrievePendingEmailVerifications()
 {
     if (!IsViewDataLoaded)
     {
         //IsPostback won't help - the ObjectContainerDataSource_Selecting is called twice and the second time, it says 'IsPostBack = false'
         ViewData         = RegisterUserBLL.GetPendingEmailChangeVerifications(this.AccountInfo);
         IsViewDataLoaded = true;
     }
 }
        protected void ResetPasswordCommand(object sender, EventArgs e)
        {
            //if(valid)
            Page.Validate("ResetPassword");

            if (!IsFormValid())
            {
                DisplayMessage("Please fix the error(s) displayed in red and submit again", true);
                return;
            }

            DisplayMessage("Thank You! Your request has been submitted. If the email address you entered is in our system you will receive an email shortly. If you do not receive an email after a while, please verify that you entered the registered email associated with your SHIP NPR account. Please check your Junk mail folder as well. If you have additional questions, please contact the SHIP NPR Help Desk at 1-800-253-7154, option 1.", false);

            EmailAddress = Email.Text.Trim();

            if (!RegisterUserBLL.DoesUserNameExist(EmailAddress))
            {
                DisplayMessage("Thank You! Your request has been submitted. If the email address you entered is in our system you will receive an email shortly. If you do not receive an email after a while, please verify that you entered the registered email associated with your SHIP NPR account. Please check your Junk mail folder as well. If you have additional questions, please contact the SHIP NPR Help Desk at 1-800-253-7154, option 1.", false);
                return;
            }
            else
            {
                //sammit: Check if the user exist and Is he trying to change the password in the sameday
                // if he is trying to do so Send an e-mail with the warning message
                int?UserId = UserBLL.GetUserIdForUserName(EmailAddress);
                if (UserId.HasValue)
                {
                    UserProfile userProf = UserBLL.GetUserProfile((int)UserId);
                    if (userProf.LastPasswordChangeDate != null && ((DateTime)userProf.LastPasswordChangeDate).Date == System.DateTime.Today)
                    {
                        //Send Email to User with warning.
                        if (SendPasswordCanNotBeChangedEmail())
                        {
                            DisplayMessage("Thank You! Your request has been submitted. If the email address you entered is in our system you will receive an email shortly. If you do not receive an email after a while, please verify that you entered the registered email associated with your SHIP NPR account. Please check your Junk mail folder as well. If you have additional questions, please contact the SHIP NPR Help Desk at 1-800-253-7154, option 1.", false);
                        }
                        else
                        {
                            DisplayMessage("Sorry. We were unable to send password reset instructions to your mail. Please contact help desk if the problem persists.", true);
                        }

                        return;
                    }
                }

                //Send Email to User for verification.
                if (SendPasswordResetEmail())
                {
                    DisplayMessage("Thank You! Your request has been submitted. If the email address you entered is in our system you will receive an email shortly. If you do not receive an email after a while, please verify that you entered the registered email associated with your SHIP NPR account. Please check your Junk mail folder as well. If you have additional questions, please contact the SHIP NPR Help Desk at 1-800-253-7154, option 1.", false);
                }
                else
                {
                    DisplayMessage("Sorry. We were unable to send password reset instructions to your mail. Please contact help desk if the problem persists.", true);
                }
            }
        }
 private void RetrievePendingUserRegistrations()
 {
     if (!IsViewDataLoaded)
     {
         //We need the InfercurrentShowCommand call here. When page change occurs,
         //we need to know if we need to retrieve all pending email verifications or not.
         //IsPostback won't help - the ObjectContainerDataSource_Selecting is called twice and the second time, it says 'IsPostBack = false'
         ViewData         = RegisterUserBLL.GetPendingUserRegistrationsForApprover(this.AccountInfo, IncludeAllPendingEmailVerifications);
         IsViewDataLoaded = true;
     }
 }
Beispiel #5
0
        private void Action_DenyUser()
        {
            string ErrorMessage;

            if (RegisterUserBLL.DenyUser(ViewData, this.AccountInfo.UserId, out ErrorMessage))
            {
                DisplayMessage("You have denied account for the registered User. Please note that the registration information has been deleted. An email confirmation has been sent to the User about your decision.", false);
            }
            else
            {
                DisplayMessage("An error occured while deleting User registration information. Error info:" + ErrorMessage, true);
            }
        }
Beispiel #6
0
        private void Action_ApproveUser()
        {
            string ErrorMessage;

            ViewData.DescriptorIds = GetDescriptorsSelectedByApprover();

            if (RegisterUserBLL.ApproveUser(ViewData, this.AccountInfo.UserId, out ErrorMessage))
            {
                DisplayMessage("The User Approval was successful. An approval notification email has been sent to the User.", false);
            }
            else
            {
                DisplayMessage("The approval process failed with the following error message:" + "<br />" + ErrorMessage, true);
            }
        }
Beispiel #7
0
        protected void RegisterUserCommand(object sender, EventArgs e)
        {
            //if(valid)
            Page.Validate("RegisterForm");

            if (!IsFormValid())
            {
                DisplayMessage("Please fix the error(s) displayed in red and submit again", true);
                return;
            }

            UserName = Email.Text.Trim();

            if (RegisterUserBLL.DoesUserNameExist(UserName))
            {
                DisplayMessage("The Primary Email address is already registered. Duplicates are not allowed.", true);
                return;
            }
            else
            {
                //TODO: Add transaction scope, email verification logic and appropriate error messages.
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))
                {
                    int?newUserId;
                    if (!UserBLL.CreateUser(CreateRegistrationObject(), null, false, this.AccountInfo.UserId, out newUserId))
                    {
                        DisplayMessage("Unable to add user. Please contact support if the issue persists.", true);
                        return;
                    }
                    else
                    {
                        if (!SendVerificationEmail(newUserId.Value))
                        {
                            return;
                        }
                        else
                        {
                            scope.Complete();
                            ShowSuccess();
                            ClearForm();
                        }
                    }
                }
            }
        }
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     //TODO: Validation to be replaced with ProxyValidator
     Page.Validate("ChangePasswordGroup");
     if (Page.IsValid)
     {
         OldShipUserInfo oldinfo = RegisterUserBLL.GetOldShipUserInfo(UserName, Password);
         if (oldinfo != null)
         {
             Session["OldShipUserInfo"] = oldinfo;
             Response.Redirect("~/UserRegistration.aspx");
         }
         else
         {
             DisplayMessage("The Username and Password does not match a valid account.", true);
         }
     }
 }
Beispiel #9
0
        protected void ChangeEmailCommand(object sender, EventArgs e)
        {
            //TODO: Validation to be replaced with ProxyValidator
            Page.Validate("ChangeEmail");
            if (Page.IsValid)
            {
                //using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))
                //{
                bool   DoCommit = false;
                string ErrorMessage;
                string NewEmail = Email.Text.Trim();

                //Check if the Username already exists
                if (RegisterUserBLL.DoesUserNameExist(NewEmail))
                {
                    DisplayMessage("The Primary Email address is already registered. Duplicates are not allowed.", true);
                    return;
                }
                else
                {
                    if (UserBLL.ChangeEmail(ShiptalkPrincipal.UserId, ShiptalkPrincipal.Username, NewEmail, ShiptalkPrincipal.UserId, out ErrorMessage))
                    {
                        if (VerifyEmail.SendEmailVerificationNotificationforEmailChange(false, ShiptalkPrincipal.UserId, ShiptalkPrincipal.UserId, NewEmail, out ErrorMessage))
                        {
                            DoCommit = true;
                        }
                    }

                    if (DoCommit)
                    {
                        //scope.Complete();
                        DisplayMessage("Your request has been submitted. You will receive this Change Email request information email at your old Email address and  'Email verification' email at your new Email address shortly. Please follow the instruction to complete the Email verification process . If you do not receive an email after a while, please contact the help desk.", false);
                    }
                    else
                    {
                        DisplayMessage("Sorry. Unable to change your email. Please contact support for assistance.", false);
                    }
                    //}
                }
            }
        }
        private IEnumerable <UserSummaryViewData> FetchData(ViewType viewType)
        {
            if (viewType == ViewType.ShowAll)
            {
                return(RegisterUserBLL.GetAllPendingUniqueIdRequestsByState(this.AccountInfo.StateFIPS));
            }

            else if (viewType == ViewType.Pending)
            {
                return(RegisterUserBLL.GetPendingUniqueIdRequestsForState(this.AccountInfo.StateFIPS));
            }

            else if (viewType == ViewType.Revoked)
            {
                return(RegisterUserBLL.GetRevokedPendingUniqueIdRequestsByState(this.AccountInfo.StateFIPS));
            }

            else
            {
                return(null);
            }
        }
Beispiel #11
0
        protected void dataSourceUserView_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e)
        {
            if (UserViewData != null)
            {
                if (RegisterUserBLL.DoesUserNameExist(UserViewData.PrimaryEmail))
                {
                    DisplayMessage("The Primary Email address is already registered. Duplicates are not allowed.", true);
                    //formView.ChangeMode(FormViewMode.Edit);
                }
                else
                {
                    IRegisterUser regBLL = RegisterUserBLL.CreateRegistrationProviderObject(CreateRegistrationObject());
                    regBLL.ValidateData();
                    if (regBLL.IsValid)
                    {
                        if (regBLL.Save())
                        {
                            AddPresentorStatus = 1;
                            DisplayMessage("The Presenter has been added successfully. You may add another presenter or close this window.", false);
                            UserViewData = new UserViewData();
                        }
                        else
                        {
                            DisplayMessage("Unable to add presenter. Please contact support if the issue persists. Error: " + regBLL.ErrorMessage, true);
                        }
                    }
                    else
                    {
                        DisplayMessage("Validation error occured while adding new User. Error: " + regBLL.ErrorMessage, true);
                    }
                }
            }


            Page.DataBind();
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Retreive Query String parameter using QueryStringUtil
            //The Query string must be split prior to the Guid.
            //First piece is Username or PrimaryEmail(both same), the rest of the string is VerificationToken (36 length)

            //Call SP. SP will return true or false indicating the validity of the VerificationToken for the User.
            //The SP will do the following:
            //  The EmailVerificationTimeStamp will be recorded in the Users table, only if the Usename and EmailVerification match.
            //  The EmailVerificationToken column will be set to null by SP in the Users table.
            //If the EmailVerificationToken/Username is not found, then manipulated QueryString var. Ignore the call.
            if (!IsPostBack)
            {
                EmailVerificationValueString = QueryStringHelper.EmailVerificationTokenString;
                if (EmailVerificationValueString == string.Empty)
                {
                    //If EmailVerificationValue is blank, indicate that a bad link was clicked.
                    DisplayMessage("Error", "You selected a bad hyperlink. Please contact support if you need assistance");
                }
                else
                {
                    //if this email verification is for Registration
                    if (String.IsNullOrEmpty(QueryStringHelper.EmailVerificationTypeString))
                    {
                        if (RegisterUserBLL.VerifyEmailToken(GetVerificationToken(), GetUserName()))
                        {
                            //LOGIC: If User was added, then we need not notify Approver.
                            //However, if the User was registered and then is verifying the email address, then we must notify admin about it.
                            bool IsRegisteredAccount = UserBLL.IsAccountCreatedViaUserRegistration(GetUserName());
                            if (IsRegisteredAccount)
                            {
                                if (RegisterUserBLL.NotifyDesignatedRegistrationNotificationRecipientForUser(GetUserName()))
                                {
                                    DisplayMessage("Thank you!", "You have successfully verified your email address. Your account is now waiting for approval. You will receive an email notification when a decision is made.");
                                }
                                else
                                {
                                    DisplayMessage("Unable to notify approver", "You have successfully verified your email address. However, please note that we encountered a problem while notifying the approver about your registration. Please contact support center about this problem.");
                                }
                            }
                            else
                            {
                                DisplayMessage("Thank you!", "You have successfully verified your email address. Your account is now active. You may login any time.");
                            }

                            ////TODO: Get designated email and dispatch it.
                            //if (IsRegisteredAccount && !RegisterUserBLL.NotifyDesignatedRegistrationNotificationRecipientForUser(GetUserName()))
                            //{
                            //    DisplayMessage("Unable to notify approver", "You have successfully verified your email address. However, please note that we encountered a problem while notifying the approver about your registration. Please contact support center about this problem.");
                            //}
                            //else
                            //    DisplayMessage("Thank you!", "You have successfully verified your email address. Your account is now waiting for approval. You will receive an email notification when a decision is made.");
                        }
                        else
                        {
                            DisplayMessage("Email confirmation", string.Format("New email verification requirement was not found for {0}. Either the email address was already verified, or you followed a bad link. Please contact the SHIP NPR Help Desk at 1-800-253-7154, option 1 or [email protected] if you need further assistance.", GetUserName()));
                        }
                    }
                    // if this email verification is for email change
                    else
                    if (QueryStringHelper.EmailVerificationTypeString != null && QueryStringHelper.EmailVerificationTypeString != string.Empty)
                    {
                        //if it is for 'Email change Accept'
                        if (QueryStringHelper.EmailVerificationTypeString == "eca")
                        {
                            // EMail verification link is valid only for 24 hours. otherwise it should be expired.
                            if (UserBLL.IsEmailVerificationTokenValid(GetVerificationToken(), GetUserName()))
                            {
                                //if the Email verification link is valid, change the user email.
                                if (RegisterUserBLL.AcceptOrRejectEmailChange(GetVerificationToken(), GetUserName(), "Accept"))
                                {
                                    if (!RegisterUserBLL.SendEmailToUserAboutEmailChangeEmailVerification(GetUserName()))
                                    {
                                        DisplayMessage("Unable to notify user", "You have successfully verified your email address. However, please note that we encountered a problem while notifying you about your Email change. Please contact support center about this problem.");
                                        return;
                                    }

                                    else
                                    {
                                        DisplayMessage("Thank you!", "You have successfully verified your email address. You can login using your new email any time.");
                                    }
                                }
                                else
                                {
                                    DisplayMessage("Sorry", string.Format("New email verification requirement was not found for {0}. Either the email address was already verified, or you followed a bad link. Please contact the SHIP NPR Help Desk at 1-800-253-7154, option 1 or [email protected] if you need further assistance.", GetUserName()));
                                }
                            }

                            else
                            {
                                DisplayMessage("Sorry,", "The Email Verification link is only valid for 24 hours. You either followed an old email or used a bad link to get to this page. Please contact support center for further assistance.");
                            }
                        }

                        else       //if it is for 'Email change Reject'
                        if (QueryStringHelper.EmailVerificationTypeString == "ecr")
                        {
                            // EMail verification link is valid only for 24 hours. otherwise it should be expired.
                            if (UserBLL.IsEmailVerificationTokenValid(GetVerificationToken(), GetUserName()))
                            {
                                //if the Email verification link is valid and the request is 'Reject', dont change the email
                                if (RegisterUserBLL.AcceptOrRejectEmailChange(GetVerificationToken(), GetUserName(), "Reject"))
                                {
                                    DisplayMessage("Thank you!", "We have cancelled your email change request.");
                                }
                                else
                                {
                                    DisplayMessage("Sorry", "We could not complete you request. Either this request has already been completed, or you followed a bad link. Please contact the SHIP NPR Help Desk at 1-800-253-7154, option 1 or [email protected] if you need further assistance.");
                                }
                            }
                            else
                            {
                                DisplayMessage("Sorry,", "The Reject link is only valid for 24 hours. You either followed an old email or used a bad link to get to this page. Please contact support center for further assistance.");
                            }
                        }
                    }
                }
            }
        }
        public ActionResult CheckLogin(string username, string password)
        {
            LogEntity logEntity = new LogEntity();


            logEntity.CategoryId     = 1;
            logEntity.OperateTypeId  = ((int)OperationType.Login).ToString();
            logEntity.OperateType    = EnumAttribute.GetDescription(OperationType.Login);
            logEntity.OperateAccount = username;
            logEntity.OperateUserId  = username;
            logEntity.Module         = Config.GetValue("SoftName");

            try
            {
                #region 账户验证
                RegisterUserEntity userEntity = new RegisterUserBLL().CheckLogin(username, password);
                if (userEntity != null)
                {
                    AuthorizeBLL authorizeBLL = new AuthorizeBLL();
                    Operator     operators    = new Operator();
                    operators.UserId        = userEntity.UserId;
                    operators.Code          = userEntity.EnCode;
                    operators.Account       = userEntity.Account;
                    operators.UserName      = userEntity.RealName;
                    operators.Password      = userEntity.Password;
                    operators.Secretkey     = userEntity.Secretkey;
                    operators.CompanyId     = userEntity.OrganizeId;
                    operators.DepartmentId  = userEntity.DepartmentId;
                    operators.IPAddress     = Net.Ip;
                    operators.IPAddressName = IPLocation.GetLocation(Net.Ip);
                    operators.HeadIcon      = userEntity.HeadIcon;
                    operators.Post          = userEntity.Post;
                    operators.Position      = userEntity.Position;
                    operators.PositionName  = dataItemCache.GetDataItemList("PositionCategory").Where(t => t.ItemValue == userEntity.Position).FirstOrDefault().ItemName;;
                    operators.WorkUnit      = userEntity.WorkUnit;
                    //operators.ObjectId = new PermissionBLL().GetObjectStr(userEntity.UserId);
                    operators.LogTime = DateTime.Now;
                    operators.Token   = DESEncrypt.Encrypt(Guid.NewGuid().ToString());
                    //判断是否系统管理员
                    if (userEntity.Account == "System")
                    {
                        operators.IsSystem = true;
                    }
                    else
                    {
                        operators.IsSystem = false;
                    }
                    OperatorProvider.Provider.AddCurrent(operators);
                    //登录限制
                    //LoginLimit(username, operators.IPAddress, operators.IPAddressName);
                    //写入日志
                    logEntity.ExecuteResult     = 1;
                    logEntity.ExecuteResultJson = "登录成功";
                    logEntity.WriteLog();
                }
                return(Content(new AjaxResult {
                    type = ResultType.success, message = "登录成功"
                }.ToJson()));

                #endregion
            }
            catch (Exception ex)
            {
                WebHelper.RemoveCookie("sys_autologin");                  //清除自动登录
                logEntity.ExecuteResult     = -1;
                logEntity.ExecuteResultJson = ex.Message;
                logEntity.WriteLog();
                return(Content(new AjaxResult {
                    type = ResultType.error, message = ex.Message
                }.ToJson()));
            }
        }
Beispiel #14
0
        protected void RegisterUserCommand(object sender, EventArgs e)
        {
            //if(valid)
            Page.Validate("RegisterForm");

            bool FormIsValid = IsFormValid();

            //For some reason, CaptchaText EnableViewState=false isn't working. So doing this...
            CaptchaText.Text = string.Empty;

            if (!FormIsValid)
            {
                DisplayMessage("Please fix the error(s) displayed in red and submit again", true);
                return;
            }

            //sammit-start
            if (PasswordValidation.DoesTextContainsWord(Password.Text.Trim().ToLower()))
            {
                DisplayMessage("The entered password contains a dictionary word and is not allowed.", true);
                return;
            }

            if (PasswordValidation.DoesTextContainsFirstLastName(Password.Text.Trim().ToLower(), FirstName.Text.Trim().ToLower(), LastName.Text.Trim().ToLower(), MiddleName.Text.Trim().ToLower()))
            {
                DisplayMessage("The entered password contains either FirstName/MiddleName/LastName and is not allowed.", true);
                return;
            }

            if (PasswordValidation.DoesPassWordContainsEmail(Email.Text.Trim().ToLower(), Password.Text.Trim().ToLower()))
            {
                DisplayMessage("The entered password contains your email-id and is not allowed.", true);
                return;
            }

            if (PasswordValidation.DoesContainFourConsecutive(Password.Text.Trim().ToLower()))
            {
                DisplayMessage("The entered password contains 4 consecutive letter/number and is not allowed.", true);
                return;
            }
            //sammit-end

            string UserName = Email.Text.Trim();

            if (RegisterUserBLL.DoesUserNameExist(UserName))
            {
                DisplayMessage("The Primary Email address is already registered. Duplicates are not allowed.", true);
                return;
            }
            else
            {
                //If Role selected is SHIP Admin, Check if a Ship Director already exists for the Chosen state
                if (_selectedRole.IsStateAdmin && chBoxIsShipDirector.Checked)
                {
                    if (LookupBLL.GetShipDirectorForState(ddlStates.SelectedValue.Trim()).HasValue)
                    {
                        DisplayMessage(string.Format("A SHIP Director already exists for state of {0}", State.GetStateName(StateFIPSSelected)), true);
                        return;
                    }
                }

                //Fill personal profile info here...
                RegistrationObject regObj = new RegistrationObject();
                regObj.FirstName      = FirstName.Text.Trim();
                regObj.MiddleName     = MiddleName.Text.Trim();
                regObj.LastName       = LastName.Text.Trim();
                regObj.NickName       = NickName.Text.Trim();
                regObj.Suffix         = Suffix.Text.Trim();
                regObj.Honorifics     = Honorifics.Text.Trim();
                regObj.SecondaryEmail = SecondaryEmail.Text.Trim();
                regObj.PrimaryPhone   = PrimaryPhone.Text.Trim();
                regObj.SecondaryPhone = SecondaryPhone.Text.Trim();

                //Fill login info and Role
                regObj.PrimaryEmail  = UserName;
                regObj.ClearPassword = Password.Text.Trim(); //sammit
                regObj.Password      = Password.Text.Trim();
                regObj.RoleRequested = _selectedRole;

                regObj.OldShipUserId         = OldShipUserId;
                regObj.IsRegistrationRequest = true;

                //GetStateFIPS (including CMS User)
                regObj.StateFIPS = GetStateFIPSForNewUser();

                //Get regional IDs (AgencyID, Sub State Regional ID etc)
                switch (regObj.RoleRequested.scope)
                {
                case Scope.CMSRegional:
                    regObj.UserRegionalAccessProfile.RegionId = int.Parse(ddlCMSRegion.SelectedValue.Trim());
                    break;

                case Scope.SubStateRegion:
                    regObj.UserRegionalAccessProfile.RegionId = int.Parse(ddlSubStateRegion.SelectedValue.Trim());
                    break;

                case Scope.Agency:
                    regObj.UserRegionalAccessProfile.RegionId = int.Parse(ddlAgency.SelectedValue.Trim());
                    break;

                case Scope.State:
                    regObj.IsShipDirector = chBoxIsShipDirector.Checked;
                    break;
                }

                //Populate User Descriptors for the Regions other than Agencies
                PopulateUserDescriptors(ref regObj);


                //Register
                IRegisterUser regBLL = RegisterUserBLL.CreateRegistrationProviderObject(regObj);
                regBLL.ValidateData();
                if (regBLL.IsValid)
                {
                    if (!regBLL.Save())
                    {
                        DisplayMessage("Unable to complete registration. " + regBLL.ErrorMessage, true);
                    }
                    else
                    {
                        ShowSuccess();
                        ClearForm();
                    }
                }
                else
                {
                    DisplayMessage("Error. Validation error occured during registration. " + regBLL.ErrorMessage, true);
                }
            }
        }
Beispiel #15
0
        protected void dataSourceUserView_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e)
        {
            Page.Validate("UserProfile");
            if (!Page.IsValid)
            {
                return;
            }

            UserViewData ChangedUserData = (UserViewData)e.Instance;

            try
            {
                if (IsCMSOrStateScope)
                {
                    UserBLL.UpdateIsAdminStatus(ChangedUserData.UserId, ChangedUserData.IsAdmin);
                }
            }
            catch (Exception UpdateAccountEx)
            {
                DisplayMessage("Failed while saving administrator status. Please try later or contact support for assistance.", true);
                return;
            }

            //Update IsActive of UserData with what we got from Updating method.
            //ChangedUserData.IsActive = IsActiveUser;
            //using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
            //{
            if (UserBLL.UpdateUserProfile(CreateUserProfile(ChangedUserData), this.AccountInfo.UserId))
            {
                if (!UserData.IsShipDirector && UserData.IsUserStateScope)
                {
                    string ErrorMessage;
                    if (!UserBLL.SaveDescriptors(ChangedUserData.UserId, GetDescriptorsSelectedByAdmin(), ShiptalkLogic.Constants.Defaults.DefaultValues.AgencyIdForNonAgencyUsers, this.AccountInfo.UserId, out ErrorMessage))
                    {
                        DisplayMessage(ErrorMessage, true);
                        return;
                    }

                    if (!UserBLL.UpdateStateSuperDataEditor(ChangedUserData.UserId, ChangedUserData.IsStateSuperDataEditor, this.AccountInfo.UserId))
                    {
                        DisplayMessage("An error occured while updating the super data editor status", true);
                        return;
                    }
                }

                //Update the Is Approver Designate status for CMS/State scope Admins alone.
                //Ignore Ship directors and CMS Admins.
                if (UserData.IsAdmin)
                {
                    if ((!UserData.IsCMSAdmin && UserData.IsUserCMSScope) || (!UserData.IsShipDirector && UserData.IsUserStateScope))
                    {
                        if (!UserBLL.UpdateApproverDesignate(UserData.UserId, GetApproverDesignateSelection(), this.AccountInfo.UserId))
                        {
                            DisplayMessage("Failed while updating approver designate status. Please try later or contact support for assistance.", true);
                            return;
                        }
                    }
                }

                bool ReviewerUpdateFailed = false;
                if (ScopeIdOfUser == Scope.State.EnumValue <int>())
                {
                    if (NewSupervisorId == -1)
                    {
                        NewSupervisorId = 0;
                    }

                    if (NewSupervisorId != UserIdOfOldReviewer)
                    {
                        //Save the new ReviewerID as Supervisor
                        if (!UserBLL.SaveSupervisorForUser(ChangedUserData.UserId, NewSupervisorId, null, this.AccountInfo.UserId))
                        {
                            //If update failed, then
                            ReviewerUpdateFailed = true;
                        }
                    }
                }
                //Lavnaya: Included Change Email process : 09/02/2012
                //If Primary Email is changed, then the email should be sent to user's old email id and as well as to new email id to notify them.
                // Email verification link will be sen to the user's new email id. Users can login using their old email id till they vefy the new email. this process is same as "Edit my Email" functionality.
                //If the Primary EMail id is not changed, then we dont change it in database.

                bool   DoCommit = false;
                string ErrorMsg;
                string NewEmail = string.Empty;

                TextBox Email = formView.FindControl("Email") as TextBox;

                NewEmail = Email.Text;

                if (NewEmail != UserData.PrimaryEmail)
                {
                    if (NewEmail != "" && NewEmail != null)
                    {
                        //Check if the Username already exists
                        if (RegisterUserBLL.DoesUserNameExist(NewEmail))
                        {
                            DisplayMessage("The Primary Email address is already registered. Duplicates are not allowed.", true);
                            return;
                        }
                        else
                        {
                            if (UserBLL.ChangeEmail(ChangedUserData.UserId, UserData.PrimaryEmail, NewEmail, this.AccountInfo.UserId, out ErrorMsg))
                            {
                                if (VerifyEmail.SendEmailVerificationNotificationforEmailChange(false, ChangedUserData.UserId, ChangedUserData.UserId, NewEmail, out ErrorMsg))
                                {
                                    DoCommit = true;
                                }
                            }

                            //if (DoCommit)
                            //{
                            //    //scope.Complete();
                            //    DisplayMessage("Your request has been submitted. You will receive this Change Email request information email at your old Email address and  'Email verification' email at your new Email address shortly. Please follow the instruction to complete the Email verification process . If you do not receive an email after a while, please contact the help desk.", false);
                            //}

                            //}
                        }
                    }
                }


                //Lavnaya: Included Change Email process : 09/02/2012 -- End

                if (ReviewerUpdateFailed)
                {
                    DisplayMessage("Unable to save new supervisor. Please try later or contact support for assistance.", true);
                }


                //else if (!DoCommit)Pbattineni: If (!DoCommit) & and New email is not equal to Primary email then Throw error Message- 10/08/12
                else if (!DoCommit && NewEmail != UserData.PrimaryEmail)
                {
                    DisplayMessage("Sorry. Unable to change your email. Please contact support for assistance.", true);
                }
                else
                {
                    //scope.Complete();
                    DisplayMessage("The submitted information has been saved successfully.", false);
                }
                //formView.DataBind();
                //listViewUserRegionalProfiles.DataBind();
                //Page.DataBind();
            }
            else
            {
                DisplayMessage("Sorry. We were unable to save the information. Please contact support for assistance.", true);
            }
            //}

            //Get Fresh data for rebind.
            FetchUserData();
        }
Beispiel #16
0
        //download the ApprovedUniquIdUserLists
        protected void DownloadApprovedUniquIdUserList_Click(object sender, EventArgs e)
        {
            IEnumerable <UserSummaryViewData> approvedList = RegisterUserBLL.GetApprovedUniqueIdRequestsByStateFIPS(this.AccountInfo.StateFIPS);

            WriteToStream(approvedList);
        }
Beispiel #17
0
        protected void AddUserCommand(object sender, EventArgs e)
        {
            //if(valid)
            Page.Validate("RegisterForm");

            bool FormIsValid = IsFormValid();

            //For some reason, CaptchaText EnableViewState=false isn't working. So doing this...
            //CaptchaText.Text = string.Empty;

            if (!FormIsValid)
            {
                DisplayMessage("Please fix the error(s) displayed in red and submit again", true);
                return;
            }

            //sammit-start
            if (PasswordValidation.DoesTextContainsWord(Password.Text.Trim().ToLower()))
            {
                DisplayMessage("The entered password contains a dictionary word and is not allowed.", true);
                return;
            }

            if (PasswordValidation.DoesTextContainsFirstLastName(Password.Text.Trim().ToLower(), FirstName.Text.Trim().ToLower(), LastName.Text.Trim().ToLower(), MiddleName.Text.Trim().ToLower()))
            {
                DisplayMessage("The entered password contains either FirstName/MiddleName/LastName and is not allowed.", true);
                return;
            }

            if (PasswordValidation.DoesPassWordContainsEmail(Email.Text.Trim().ToLower(), Password.Text.Trim().ToLower()))
            {
                DisplayMessage("The entered password contains your email-id and is not allowed.", true);
                return;
            }

            if (PasswordValidation.DoesContainFourConsecutive(Password.Text.Trim().ToLower()))
            {
                DisplayMessage("The entered password contains 4 consecutive letter/number and is not allowed.", true);
                return;
            }
            //sammit-end

            UserName = Email.Text.Trim();

            if (RegisterUserBLL.DoesUserNameExist(UserName))
            {
                DisplayMessage("The Primary Email address is already registered. Duplicates are not allowed.", true);
                return;
            }
            else
            {
                //if (!UserBLL.CreateUser(CreateRegistrationObject(), false, this.AccountInfo.UserId, out newUserId))
                IRegisterUser regBLL = RegisterUserBLL.CreateRegistrationProviderObject(CreateRegistrationObject());
                regBLL.ValidateData();
                if (regBLL.IsValid)
                {
                    if (regBLL.Save())
                    {
                        ShowSuccess();
                        ClearForm();
                    }
                    else
                    {
                        DisplayMessage("Unable to add user. Please contact support if the issue persists. Error: " + regBLL.ErrorMessage, true);
                        return;
                    }
                }
                else
                {
                    DisplayMessage("Validation error occured while adding new User. Error: " + regBLL.ErrorMessage, true);
                }
            }
        }