Пример #1
0
        /// <summary>
        /// Approve a user's request for submitter status.
        /// </summary>
        /// <param name="username">The username of the user to approve.</param>
        public static void approveFaculty(string username)
        {
            UserAccounts.UserInfo user = new UserAccounts.UserInfo();

            user.Username = username;
            user.Role     = UserRole.Faculty;

            UserAccounts.updateUserRole(user);
            FacultyRequestInfo fri = FacultyRequests.getFacultyRequest(username);

            FacultyRequests.remove(username);
        }
Пример #2
0
        /// <summary>
        /// Add a request for faculty privileges.
        /// Notify Editors of the faculty request.
        /// </summary>
        /// <param name="sri">
        /// The information about the request.
        /// </param>
        public static void addFacultyRequest(FacultyRequestInfo fri)
        {
            FacultyRequests.addFacultyRequest(fri);

            Email email = Emails.getEmail(EmailType.ConfirmFaculty);

            Emails.formatEmail(email, fri.UserName);
            Emails.formatEmailBody(email, fri.Proof);
            MailMessage msg = Emails.constructEditorsMail(email, Globals.AdminsEmail);

            SmtpMail.SmtpServer = AspNetForums.Components.Globals.SmtpServer;
            SmtpMail.Send(msg);
        }
Пример #3
0
        /// <summary>
        /// Initialize the request controls.
        /// </summary>
        private void initRequestInfo()
        {
            // Check to see if user entered faculty request.
            FacultyRequestInfo fri = UsersControl.getFacultyRequestInfo(Context.User.Identity.Name);

            // If no submitter request, display instructions
            // (input controls are visible by default).
            // Otherwise display request acknowledgement and date.
            if (fri != null)
            {
                FormPanel.Visible = false;
                ConfirmLbl.Text   = "Your registration for faculty user status was received on "
                                    + fri.Date.ToShortDateString() + ".  You will be notified by email when your "
                                    + "request has been evaluated.";
            }
        }
Пример #4
0
        /// <summary>
        /// Handle the apply button click event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ApplyBtn_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (NameValidator.IsValid && AffiliationValidator.IsValid)
                {
                    FacultyRequestInfo fri = new FacultyRequestInfo();

                    fri.Date        = DateTime.Now;
                    fri.UserName    = Context.User.Identity.Name;
                    fri.Proof       = Globals.parseTextInput(ProofTxt.Text);
                    fri.Affiliation = AffiliationTxt.Text;
                    fri.Name        = NameBox.Text;

                    UsersControl.addFacultyRequest(fri);
                    initRequestInfo();
                }
            }
            catch (Exception ex)
            {
                ConfirmLbl.Text = ex.Message + ex.InnerException.Message;
            }
        }