Ejemplo n.º 1
0
        private RegistrationObject CreateRegistrationObject()
        {
            //Fill personal profile info here...
            RegistrationObject regObj = new RegistrationObject();

            regObj.FirstName    = UserViewData.FirstName;
            regObj.MiddleName   = UserViewData.MiddleName;
            regObj.LastName     = UserViewData.LastName;
            regObj.NickName     = UserViewData.NickName;
            regObj.PrimaryEmail = UserViewData.PrimaryEmail;
            regObj.PrimaryPhone = UserViewData.PrimaryPhone;


            regObj.Password = GenerateTempPassword();

            regObj.ClearPassword = regObj.Password; //sammit

            // regObj.RoleRequested = LookupBLL.Roles.Where(r => (!r.IsAdmin && r.scope == Scope.State)).First();

            regObj.RoleRequested = LookupBLL.Roles.Where(r => (!r.IsAdmin && r.scope == Scope.Agency)).First();

            regObj.StateFIPS = PresentorState.Code;
            regObj.UserRegionalAccessProfile.RegionId = PresentorAgencyId;

            regObj.UserRegionalAccessProfile.DescriptorIDList.Add(Descriptor.PresentationAndMediaStaff.EnumValue <int>());
            regObj.IsRegistrationRequest = false;
            regObj.RegisteredByUserId    = this.AccountInfo.UserId;
            return(regObj);
        }
Ejemplo n.º 2
0
        private RegistrationObject CreateRegistrationObject()
        {
            //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.Password      = Password.Text.Trim();
            regObj.RoleRequested = _selectedRole;

            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 = GetAgencyIdForNewUser();
                PopulateAgencyUserDescriptors(ref regObj, regObj.UserRegionalAccessProfile.RegionId);
                break;

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

            //Populate User Descriptors for the Regions other than Agencies
            if (regObj.RoleRequested.Compare(Scope.Agency, ComparisonCriteria.IsHigher))
            {
                PopulateNonAgencyUserDescriptors(ref regObj);
            }

            return(regObj);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Populate descriptors for State Users, Sub State Users etc who are not directly related to an Agency
        /// </summary>
        /// <param name="regObj"></param>
        //private void PopulateNonAgencyUserDescriptors(ref ShiptalkLogic.BusinessObjects.UserRegistration regObj)
        //{
        //    if(regObj.RoleRequested.scope.IsEqual(Scope.SubStateRegion))
        //        PopulateAgencyUserDescriptors(ref regObj);
        //    else
        //        PopulateAgencyUserDescriptors(ref regObj);
        //}

        /// <summary>
        /// Populate descriptors for Agency Users whose role is tied to an agency.
        /// </summary>
        /// <param name="regObj"></param>
        /// <param name="AgencyId"></param>
        private void PopulateUserDescriptors(ref ShiptalkLogic.BusinessObjects.UserRegistration regObj)
        {
            //UserDescriptor descr;
            if (cblDescriptors.Items != null && cblDescriptors.Items.Count > 0)
            {
                for (int i = 0; i < cblDescriptors.Items.Count; i++)
                {
                    if (cblDescriptors.Items[i].Selected)
                    {
                        regObj.UserRegionalAccessProfile.DescriptorIDList.Add(int.Parse(cblDescriptors.Items[i].Value));
                    }
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Populate descriptors for Agency Users whose role is tied to an agency.
 /// </summary>
 /// <param name="regObj"></param>
 /// <param name="AgencyId"></param>
 private void PopulateAgencyUserDescriptors(ref ShiptalkLogic.BusinessObjects.UserRegistration regObj, int AgencyId)
 {
     //UserDescriptor descr;
     for (int i = 0; i < cblDescriptors.Items.Count; i++)
     {
         if (cblDescriptors.Items[i].Selected)
         {
             regObj.UserRegionalAccessProfile.DescriptorIDList.Add(int.Parse(cblDescriptors.Items[i].Value));
             //descr = new UserDescriptor();
             //descr.DescriptorId = int.Parse(cblDescriptors.Items[i].Value);
             //descr.AgencyId = AgencyId;
             //regObj.UserDescriptorList.Add(descr);
         }
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Populate descriptors for State Users, Sub State Users etc who are not directly related to an Agency
 /// </summary>
 /// <param name="regObj"></param>
 private void PopulateNonAgencyUserDescriptors(ref ShiptalkLogic.BusinessObjects.UserRegistration regObj)
 {
     PopulateAgencyUserDescriptors(ref regObj, ShiptalkLogic.Constants.Defaults.DefaultValues.AgencyIdForNonAgencyUsers);
 }
Ejemplo n.º 6
0
        private RegistrationObject CreateRegistrationObject()
        {
            //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.Password      = Password.Text.Trim();
            regObj.ClearPassword = Password.Text.Trim(); //sammit

            regObj.RoleRequested = _selectedRole;

            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());
                regObj.UserRegionalAccessProfile.IsApproverDesignate = IsApproverDesignateRequested;
                regObj.UserRegionalAccessProfile.IsSuperDataEditor   = IsSuperEditorRequested;
                break;

            case Scope.Agency:
                regObj.UserRegionalAccessProfile.RegionId            = GetAgencyIdForNewUser();
                regObj.UserRegionalAccessProfile.IsApproverDesignate = IsApproverDesignateRequested;
                regObj.UserRegionalAccessProfile.IsSuperDataEditor   = IsSuperEditorRequested;
                break;

            case Scope.State:
                regObj.IsShipDirector      = chBoxIsShipDirector.Checked;
                regObj.IsApproverDesignate = IsApproverDesignateRequested;
                regObj.IsStateSuperEditor  = IsStateLevelRole;
                break;

            case Scope.CMS:
                regObj.IsApproverDesignate = IsApproverDesignateRequested;
                break;
            }

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

            regObj.IsRegistrationRequest = false;
            regObj.RegisteredByUserId    = this.AccountInfo.UserId;
            return(regObj);
        }
Ejemplo n.º 7
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);
                }
            }
        }