protected void Page_Load(object sender, EventArgs e)
        {
            // get recruitId from url param
            string reportId = Request.QueryString["id"];

            // check username, reportId and accountType valid
            if (Session["username"] == null || String.IsNullOrEmpty(reportId))
            {
                Response.Redirect("Recruits.aspx");
            }

            lblLoggedInUser.Text = "Welcome, " + Session["username"];

            GoalieReport goalie  = ConnectionClass.DisplayGoalieReport(reportId);
            RecruitClass recruit = ConnectionClass.DisplayRecruit(goalie.RecruitId);

            lblRecruitIDData.Text             = goalie.RecruitId.ToString();
            lblFirstNameData.Text             = recruit.FirstName;
            lblLastNameData.Text              = recruit.LastName;
            lblSkatingData.Text               = goalie.Skating.ToString();
            lblAgilitySpeedData.Text          = goalie.AgilitySpeed.ToString();
            lblTrafficReboundControlData.Text = goalie.TrafficReboundControl.ToString();
            lblHockeySenseData.Text           = goalie.HockeySense.ToString();
            lblStrengthFitnessData.Text       = goalie.StrengthFitness.ToString();
            lblMentalToughnessData.Text       = goalie.MentalToughness.ToString();
            lblBattleMentalityData.Text       = goalie.BattleMentality.ToString();
            lblOverallRankingData.Text        = goalie.OverallRanking.ToString();
            lblNotesData.Text      = goalie.Notes;
            lblCreateDateData.Text = goalie.ScoutingReportDate.ToShortDateString() + " " + goalie.ScoutingReportDate.ToShortTimeString();
        }
Пример #2
0
        protected void BtnCancel_Click(object sender, EventArgs e)
        {
            GoalieReport goalie = ConnectionClass.DisplayGoalieReport(Request.QueryString["id"]);
            string       url    = "ViewRecruit.aspx?id=" + goalie.RecruitId;

            Response.Redirect(url);
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Only work when the page is initialized
            if (!IsPostBack)
            {
                if (Session["username"] == null)
                {
                    Response.Redirect("Default.aspx");
                }

                lblLoggedInUser.Text = "Welcome, " + Session["username"];

                lblEditReportError.Visible  = false;
                lblEditReportError.CssClass = "alert alert-danger small font-weight-bold text-center";
                string reportId = Request.QueryString["id"];


                GoalieReport goalie  = ConnectionClass.DisplayGoalieReport(reportId);
                RecruitClass recruit = ConnectionClass.DisplayRecruit(goalie.RecruitId);

                //pollute control with recruit information
                lblRecruitIDData.Text                       = goalie.RecruitId.ToString();
                lblFirstNameData.Text                       = recruit.FirstName;
                lblLastNameData.Text                        = recruit.LastName;
                dropdownSkating.SelectedValue               = goalie.Skating.ToString();
                dropdownAgilitySpeed.SelectedValue          = goalie.AgilitySpeed.ToString();
                dropdownTrafficReboundControl.SelectedValue = goalie.TrafficReboundControl.ToString();
                dropdownHockeySense.SelectedValue           = goalie.HockeySense.ToString();
                dropdownStrengthFitness.SelectedValue       = goalie.StrengthFitness.ToString();
                dropdownMentalToughness.SelectedValue       = goalie.MentalToughness.ToString();
                dropdownBattleMentality.SelectedValue       = goalie.BattleMentality.ToString();
                dropdownOverallRanking.SelectedValue        = goalie.OverallRanking.ToString();
                txtNotes.Text = goalie.Notes;
            }
        }
Пример #4
0
        // 11/25/18_Yayun Yang (Kim)
        //DisplayGoalieReport takes one argument - the goalie report id, and connects to the database, retrieves 1 row  of GoalieScoutingReport table,
        //returns an GoalieReport obejct
        public static GoalieReport DisplayGoalieReport(string reportId)
        {
            GoalieReport goalieReport = new GoalieReport();
            string       query        = "SELECT * FROM GoalieScoutingReport WHERE GoalieScoutingReportID=@id";

            cmd = new SqlCommand(query, cn);

            try
            {
                cmd.Parameters.AddWithValue("@id", reportId);
                cn.Open();

                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    goalieReport.RecruitId             = Convert.ToInt32(reader[1]);
                    goalieReport.AccountId             = Convert.ToInt32(reader[2]);
                    goalieReport.Skating               = Convert.ToInt32(reader[3]);
                    goalieReport.AgilitySpeed          = Convert.ToInt32(reader[4]);
                    goalieReport.TrafficReboundControl = Convert.ToInt32(reader[5]);
                    goalieReport.HockeySense           = Convert.ToInt32(reader[6]);
                    goalieReport.StrengthFitness       = Convert.ToInt32(reader[7]);
                    goalieReport.MentalToughness       = Convert.ToInt32(reader[8]);
                    goalieReport.BattleMentality       = Convert.ToInt32(reader[9]);
                    goalieReport.OverallRanking        = Convert.ToInt32(reader[10]);
                    goalieReport.Notes = reader[11].ToString();
                    goalieReport.ScoutingReportDate = Convert.ToDateTime(reader[12]);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                cn.Close();
            }

            return(goalieReport);
        }