예제 #1
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"];


                PlayerReport player  = ConnectionClass.DisplayPlayerReport(reportId);
                RecruitClass recruit = ConnectionClass.DisplayRecruit(player.RecruitId);

                //pollute control with recruit information
                lblRecruitIDData.Text         = player.RecruitId.ToString();
                lblFirstNameData.Text         = recruit.FirstName;
                lblLastNameData.Text          = recruit.LastName;
                dropdownSkating.SelectedValue = player.Skating.ToString();
                dropdownIndividualOffesiveSkills.SelectedValue  = player.IndividualOffensiveSkills.ToString();
                dropdownIndividualDefensiveSkills.SelectedValue = player.IndividualDefensiveSkills.ToString();
                dropdownOffensiveTeamPlay.SelectedValue         = player.OffensiveTeamPlay.ToString();
                dropdownDefensiveTeamPlay.SelectedValue         = player.DefensiveTeamPlay.ToString();
                dropdownHockeySense.SelectedValue    = player.HockeySense.ToString();
                dropdownStrengthPower.SelectedValue  = player.StrengthPower.ToString();
                dropdownWorkEthic.SelectedValue      = player.WorkEthic.ToString();
                dropdownOverallRanking.SelectedValue = player.OverallRanking.ToString();
                txtNotes.Text = player.Notes;
            }
        }
예제 #2
0
        protected void BtnCancel_Click(object sender, EventArgs e)
        {
            PlayerReport player = ConnectionClass.DisplayPlayerReport(Request.QueryString["id"]);
            string       url    = "ViewRecruit.aspx?id=" + player.RecruitId;

            Response.Redirect(url);
        }
        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"];

            PlayerReport player  = ConnectionClass.DisplayPlayerReport(reportId);
            RecruitClass recruit = ConnectionClass.DisplayRecruit(player.RecruitId);

            lblRecruitIDData.Text = player.RecruitId.ToString();
            lblFirstNameData.Text = recruit.FirstName;
            lblLastNameData.Text  = recruit.LastName;
            lblSkatingData.Text   = player.Skating.ToString();
            lblIndividualOffesiveSkillsData.Text  = player.IndividualOffensiveSkills.ToString();
            lblIndividualDefensiveSkillsData.Text = player.IndividualDefensiveSkills.ToString();
            lblOffensiveTeamPlayData.Text         = player.OffensiveTeamPlay.ToString();
            lblDefensiveTeamPlay.Text             = player.DefensiveTeamPlay.ToString();
            lblHockeySenseData.Text    = player.HockeySense.ToString();
            lblStrengthPowerData.Text  = player.StrengthPower.ToString();
            lblWorkEthicData.Text      = player.WorkEthic.ToString();
            lblOverallRankingData.Text = player.OverallRanking.ToString();
            lblNotesData.Text          = player.Notes;
            lblCreateDateData.Text     = player.ScoutingReportDate.ToShortDateString() + " " + player.ScoutingReportDate.ToShortTimeString();
        }
예제 #4
0
        // 11/25/18_Yayun Yang (Kim)
        //DisplayGoalieReport takes one argument - the player report id, and connects to the database, retrieves 1 row  of PlayerScoutingReport table,
        //returns an GoalieReport obejct
        public static PlayerReport DisplayPlayerReport(string reportId)
        {
            PlayerReport player = new PlayerReport();

            string query = "SELECT * FROM PlayerScoutingReport WHERE PlayerScoutingReportID=@id";

            cmd = new SqlCommand(query, cn);

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

                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    player.RecruitId = Convert.ToInt32(reader[1]);
                    player.AccountId = Convert.ToInt32(reader[2]);
                    player.Skating   = Convert.ToInt32(reader[3]);
                    player.IndividualOffensiveSkills = Convert.ToInt32(reader[4]);
                    player.IndividualDefensiveSkills = Convert.ToInt32(reader[5]);
                    player.OffensiveTeamPlay         = Convert.ToInt32(reader[6]);
                    player.DefensiveTeamPlay         = Convert.ToInt32(reader[7]);
                    player.HockeySense        = Convert.ToInt32(reader[8]);
                    player.StrengthPower      = Convert.ToInt32(reader[9]);
                    player.WorkEthic          = Convert.ToInt32(reader[10]);
                    player.OverallRanking     = Convert.ToInt32(reader[11]);
                    player.Notes              = reader[12].ToString();
                    player.ScoutingReportDate = Convert.ToDateTime(reader[13]);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                cn.Close();
            }

            return(player);
        }