using System;
using System.Web.UI.WebControls;

namespace SLPersonProject {
    public partial class Complete : System.Web.UI.Page {
        public string Name { get; set; }
        public string Hurts { get; set; }
        
        protected void Page_Load(object sender, EventArgs e) {
            Name = ((TextBox)PreviousPage.FindControl("FirstName")).Text + " " +
                ((TextBox)PreviousPage.FindControl("LastName")).Text;

            AddHurts("head");
            AddHurts("leftarm");
            AddHurts("rightarm");
            AddHurts("torso");
            AddHurts("leftleg");
            AddHurts("rightleg");
        }

        private void AddHurts(string region) {
            CheckBox cb = (CheckBox)PreviousPage.FindControl(region + "CheckBox");
            if (cb.Checked) {
                if (Hurts != null) {
                    Hurts += ", " + cb.Text;
                }
                else {
                    Hurts = cb.Text;
                }
            }
        }
    }
}
