예제 #1
0
 /// <summary>
 /// Sets the user account for the session. Also sets the candidate for the session to the one affiliated with the user.
 /// </summary>
 /// <param name="user">The <see cref="MembershipUser"/> to set.</param>
 protected void SetUser(MembershipUser user)
 {
     Page.Session[_userCacheKey] = _user = user;
     if (user != null)
     {
         SetCandidate(Cfis.GetCandidate(UserManagement.GetCfisId(user.UserName)));
     }
 }
예제 #2
0
        /// <summary>
        /// Handles candidate selection changes by showing a list of contacts for that candidate within the current election cycle.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        void SelectedCandidateChanged(object sender, EventArgs e)
        {
            Candidate selection = Cfis.GetCandidate(_candidatesList.SelectedValue);
            string    ec        = _electionCycle.Value;

            base.SetCandidate(selection);
            if (!string.IsNullOrEmpty(_candidatesList.SelectedValue) && (selection != null) && !string.IsNullOrEmpty(ec))
            {
                FillEligibleContacts(_contactsList, ec);
                SetView(RenderContactSelection);
            }
            else
            {
                SetView(RenderCandidateSelection);
            }
        }
예제 #3
0
        /// <summary>
        /// Occurs when the top-level account selection changes.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        void SelectedAccountChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(_accountList.SelectedValue))
            {
                SetView(RenderSelectView);
                return;
            }
            if (_mode == ManagerMode.Create)
            {
                SetMode(ManagerMode.CreateByCandidate);
            }
            switch (_mode)
            {
            case ManagerMode.CreateByCandidate:
                // show creator for creating an account for the selected candidate
                Candidate selection = Cfis.GetCandidate(_accountList.SelectedValue);
                if (selection != null)
                {
                    _creator.SetCandidate(selection);
                    SetView(RenderCreatorView);
                }
                else
                {
                    this.ErrorMessage = "Unable to successfully retrieve information for the selected candidate.";
                }
                break;

            case ManagerMode.View:
                // display the selected account in viewer
                MembershipUser user = Membership.GetUser(_accountList.SelectedValue);
                if (user != null)
                {
                    _viewer.SetUser(user);
                    SetView(RenderViewerView);
                }
                else
                {
                    this.ErrorMessage = "Unable to successfully retrieve information for the selected account.";
                }
                break;
            }
        }
예제 #4
0
        /// <summary>
        /// Loads the <see cref="Candidate"/> specified in the current request.
        /// </summary>
        protected void LoadCandidate()
        {
            string cid = Page.Request[_candidateCacheKey];

            _candidate = !string.IsNullOrWhiteSpace(cid) ? Cfis.GetCandidate(cid) : null;
        }