Exemplo n.º 1
0
    private void UpdateEvalData()
    {
        CodeCampEvalsODS cceODS = new CodeCampEvalsODS();
        cceODS.UpdateAllCodeCampEvals(new Guid(GuidString),
            ConvertSelectedValueToInt32(RBLMetExpectations.SelectedValue),
            ConvertSelectedValueToInt32(RBLWillAttendAgain.SelectedValue),
            ConvertSelectedValueToInt32(RBLEnjoyedFreeFood.SelectedValue),
            ConvertSelectedValueToInt32(RBLSessionsVariedEnough.SelectedValue),
            ConvertSelectedValueToInt32(RBLEnoughSessionsMyLevel.SelectedValue),
            ConvertSelectedValueToInt32(RBLFoothillGoodVenue.SelectedValue),
            ConvertSelectedValueToInt32(RBLWishToldMoreFriends.SelectedValue),
            ConvertSelectedValueToInt32(RBLEventWellPlanned.SelectedValue),
            ConvertSelectedValueToInt32(RBLWirelessInternetImportant.SelectedValue),
            ConvertSelectedValueToInt32(RBLWiredInternetImportant.SelectedValue),
            ConvertSelectedValueToInt32(RBLLikedEmailUpdates.SelectedValue),
            ConvertSelectedValueToInt32(RBLLikedRSSUpdates.SelectedValue),
            ConvertSelectedValueToInt32(RadioButtonListSponsorship.SelectedValue),
            CheckBoxVistaFairOnly.Checked,
            CheckBoxCodeCampAndVistaFair.Checked,
            CheckBoxCodeCampOnly.Checked,
            TextBoxWhatEnjoyMost.Text,
            TextBoxWhatChanges.Text,
            TextBoxIfNotSatisfiedWhy.Text,
            TextBoxWhatFoothillCoursesAdded.Text,
            CheckBoxLongTermPlanning.Checked,
            CheckBoxWebSiteBackEnd.Checked,
            CheckBoxWebSiteCss.Checked,
            CheckBoxSessionReview.Checked,
            CheckBoxContributorSolicitation.Checked,
            CheckBoxActAsContributor.Checked,
            CheckBoxPreEventVolunteer.Checked,
            CheckBoxDayOfEventVolunteer.Checked,
            CheckBoxEventTearDown.Checked,
            CheckBoxAfterEventVolunteer.Checked,
            TextBoxContactEmail.Text,
            TextBoxPhoneNumber.Text,
            DateTime.Now);

        Label1.Text = "Evaluation Submitted.  Thank you";
        Label2.Text = "Evaluation Submitted.  Thank you";

        // ~/CodeCampEval.aspx?Return=MyEvals
        if (Request.QueryString["Return"] != null &&
            Request.QueryString["Return"].Equals("MyEvals"))
        {
            Response.Redirect("~/MyEvals.aspx");
        }
        else
        {
            Response.Redirect("~/CodeCampEvalsSuccess.aspx");
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Context.User.Identity.IsAuthenticated)
        {
            Response.Redirect("~/Default.aspx", true);
        }

        if (!IsPostBack)
        {
            this.AddRadioButtonChoices(RBLMetExpectations);
            this.AddRadioButtonChoices(RBLWillAttendAgain);
            this.AddRadioButtonChoices(RBLEnjoyedFreeFood);
            this.AddRadioButtonChoices(RBLSessionsVariedEnough);
            this.AddRadioButtonChoices(RBLFoothillGoodVenue);
            this.AddRadioButtonChoices(RBLWishToldMoreFriends);
            this.AddRadioButtonChoices(RBLEventWellPlanned);
            this.AddRadioButtonChoices(RBLWirelessInternetImportant);
            this.AddRadioButtonChoices(RBLWiredInternetImportant);
            this.AddRadioButtonChoices(RBLLikedEmailUpdates);
            this.AddRadioButtonChoices(RBLLikedRSSUpdates);
            this.AddRadioButtonChoices(RBLEnoughSessionsMyLevel);

            if (Request.Params["PKID"] != null)
            {
                GuidString = Request.Params["PKID"];
                string username = CodeCampSV.Utils.GetAttendeeUsernameByGUID(GuidString);
                if (!System.Web.Security.Roles.IsUserInRole(username, CodeCampSV.Utils.GetAdminRoleName()))
                {
                    if (!string.IsNullOrEmpty(username))
                    {
                        if (User.Identity.IsAuthenticated)
                        {
                            FormsAuthentication.SignOut();
                        }
                        FormsAuthentication.SetAuthCookie(username, true);
                        Response.Redirect("~/CodeCampEval.aspx", true);
                    }
                }
                else
                {
                    // user is admin so toss them out
                    Response.Redirect("~/Default.aspx", true);
                }
            }
            else if (Context.User.Identity.IsAuthenticated)
            {
                GuidString = CodeCampSV.Utils.GetAttendeePKIDByUsername(User.Identity.Name);
            }

            if (!String.IsNullOrEmpty(GuidString))
            {
                // Figure out if eval exists for this person.  If not, add one.
                int num = 0;
                try
                {
                    using (var sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["CodeCampSV06"].ConnectionString))
                    {
                        sqlConnection.Open();

                        const string sqlSelect = "SELECT COUNT(*) FROM CodeCampEvals WHERE AttendeePKID=@AttendeePKID AND CodeCampYearId = @CodeCampYearId";
                        using (var sqlCommand = new SqlCommand(sqlSelect, sqlConnection))
                        {
                            sqlCommand.Parameters.Add("@AttendeePKID", SqlDbType.UniqueIdentifier).Value = new Guid(GuidString);
                            sqlCommand.Parameters.Add("@CodeCampYearId", SqlDbType.Int).Value = Utils.GetCurrentCodeCampYear();
                            num = (int)sqlCommand.ExecuteScalar();
                        }

                        if (num == 0)
                        {
                            const string sqlInsert = "INSERT INTO CodeCampEvals (AttendeePKID,DateSubmitted,CodeCampYearId) Values (@AttendeePKID,@DateSubmitted,@CodeCampYearId)";
                            using (var sqlCommandInsert = new SqlCommand(sqlInsert, sqlConnection))
                            {
                                sqlCommandInsert.Parameters.Add("@AttendeePKID", SqlDbType.UniqueIdentifier).Value = new Guid(GuidString);
                                sqlCommandInsert.Parameters.Add("@DateSubmitted", SqlDbType.DateTime).Value = DateTime.Now;
                                sqlCommandInsert.Parameters.Add("@CodeCampYearId", SqlDbType.Int).Value =
                                    Utils.GetCurrentCodeCampYear();
                                sqlCommandInsert.ExecuteScalar();
                            }
                        }
                    }
                }
                catch (Exception ee)
                {
                    throw new ApplicationException(ee.ToString());
                }
            }

            // Now, if we still don't have a guidString, then bail
            if (!String.IsNullOrEmpty(GuidString))
            {
                ButtonUpdate1.Enabled = true;
                ButtonUpdate2.Enabled = true;

                CodeCampEvalsODS cceODS = new CodeCampEvalsODS();
                List<CodeCampEvalsODS.DataObjectCodeCampEvals> li = cceODS.GetByPKID(new Guid(GuidString));
                if (li.Count == 1)
                {
                    CodeCampEvalsODS.DataObjectCodeCampEvals eval = li[0];
                    CheckBoxCodeCampOnly.Checked = eval.Attendedcconly;
                    CheckBoxCodeCampAndVistaFair.Checked = eval.Attendedvistafairandcc;
                    CheckBoxVistaFairOnly.Checked = eval.Attendedvistafaironly;

                    RadioButtonListSponsorship.SelectedValue = eval.Rathernosponsorandnofreefood.ToString();

                    //CheckBoxNoCorpSponsors.Checked = eval.Rathernosponsorandnofreefood;
                    CheckBoxVistaFairOnly.Checked = eval.Attendedvistafaironly;
                    CheckBoxCodeCampAndVistaFair.Checked = eval.Attendedvistafairandcc;
                    CheckBoxCodeCampOnly.Checked = eval.Attendedcconly;
                    TextBoxWhatEnjoyMost.Text = eval.Bestpartofevent;
                    TextBoxWhatChanges.Text = eval.Whatwouldyouchange;
                    TextBoxIfNotSatisfiedWhy.Text = eval.Notsatisfiedwhy;
                    TextBoxWhatFoothillCoursesAdded.Text = eval.Whatfoothillclassestoadd;
                    CheckBoxLongTermPlanning.Checked = eval.Interesteinlongtermplanning;
                    CheckBoxWebSiteBackEnd.Checked = eval.Interesteinwebbackend;
                    CheckBoxWebSiteCss.Checked = eval.Interestedinwebfrontend;
                    CheckBoxSessionReview.Checked = eval.Interesteinlongsessionreviewpanel;
                    CheckBoxContributorSolicitation.Checked = eval.Interesteincontributorsolicitation;
                    CheckBoxActAsContributor.Checked = eval.Interesteinbeingcontributor;
                    CheckBoxPreEventVolunteer.Checked = eval.Interesteinbeforeevent;
                    CheckBoxDayOfEventVolunteer.Checked = eval.Interesteindayofevent;
                    CheckBoxEventTearDown.Checked = eval.Interesteineventteardown;
                    CheckBoxAfterEventVolunteer.Checked = eval.Interesteinafterevent;

                    this.SetSelectedValue(RBLMetExpectations, eval.Metexpectations);

                    this.SetSelectedValue(RBLMetExpectations, eval.Metexpectations);
                    this.SetSelectedValue(RBLWillAttendAgain, eval.Plantoattendagain);
                    this.SetSelectedValue(RBLEnjoyedFreeFood, eval.Enjoyedfreefood);
                    this.SetSelectedValue(RBLSessionsVariedEnough, eval.Sessionsvariedenough);
                    this.SetSelectedValue(RBLEnoughSessionsMyLevel, eval.Enoughsessionsatmylevel);
                    this.SetSelectedValue(RBLFoothillGoodVenue, eval.Foothillgoodvenue);
                    this.SetSelectedValue(RBLWishToldMoreFriends, eval.Wishtoldmorefriends);
                    this.SetSelectedValue(RBLEventWellPlanned, eval.Eventwellplanned);
                    this.SetSelectedValue(RBLWirelessInternetImportant, eval.Wirelessaccessimportant);
                    this.SetSelectedValue(RBLWiredInternetImportant, eval.Wiredaccessimportant);
                    this.SetSelectedValue(RBLLikedEmailUpdates, eval.Likereceivingupdatebyemail);
                    this.SetSelectedValue(RBLLikedRSSUpdates, eval.Likereceivingupdatebybyrssfeed);

                    TextBoxContactEmail.Text = eval.Forvolunteeringbestwaytocontactemail;
                    TextBoxPhoneNumber.Text = eval.Forvolunteeringbestwaytocontactphone;
                }
            }
            else
            {
                Response.Redirect("~/Default.aspx");
            }
        }
    }