/*
     * CREATED:     H. Conant		MAR 17 2018
     *
     * ProcessRequestButton_Click()
     * This method processes a contact request and displays the new status to the user
     *
     * PARAMETERS:
     * object sender - object on the page that is being targeted
     * EventArgs e - event that has triggered the method
     *
     * RETURNS:
     * void
     *
     * ODEV METHOD CALLS:
     * SurveyController.ProcessContactRequest()
     * MessageUserControl.ShowErrorMessage()
     * MessageUserControl.ShowSuccessMessage()
     */
    protected void ProcessRequestButton_Click(object sender, EventArgs e)
    {
        try
        {
            surveyController.ProcessContactRequest(int.Parse(SurveyIDLabel.Text));
            ProcessedStatus.Text = "Processed";
        }
        catch (Exception ex)
        {
            MessageUserControl.ShowErrorMessage("Could not process contact request. Please try again. If error persists, please contact your administrator.", ex);
        }


        if (ProcessedStatus.Text == "Processed")
        {
            ProcessedStatus.ForeColor    = System.Drawing.Color.Green;
            ProcessRequestButton.Enabled = false;
            ProcessRequestButton.Visible = false;
            MessageUserControl.ShowSuccessMessage("Contact Request was processed. This change may not be reflected on other pages until page results are refreshed.");
        }
        else
        {
            MessageUserControl.ShowErrorMessage("Could not process contact request. Please try again. If error persists, please contact your administrator.");
        }
    }