Exemple #1
0
        protected void Fetch_Click(object sender, EventArgs e)
        {
            if (List01.SelectedIndex == 0)
            {
                MessageLabel.Text = "Select a team to view its details";
            }
            else
            {
                try
                {
                    TeamController sysmgr01 = new TeamController();
                    Team           info01   = null;
                    info01                     = sysmgr01.FindByID(int.Parse(List01.SelectedValue));
                    CoachLabel01.Text          = "Coach:";
                    CoachLabel02.Text          = info01.Coach;
                    AssistantCoachLabel01.Text = "Assistant Coach:";
                    AssistantCoachLabel02.Text = info01.AssistantCoach;
                    WinsLabel01.Text           = "Wins:";
                    WinsLabel02.Text           = info01.Wins.ToString();
                    LossesLabel01.Text         = "Losses";
                    LossesLabel02.Text         = info01.Losses.ToString();

                    PlayerController sysmgr02 = new PlayerController();
                    List <Player>    info02   = null;
                    info02 = sysmgr02.FindByID(int.Parse(List01.SelectedValue));
                    info02.Sort((x, y) => x.LastName.CompareTo(y.LastName));
                    List02.DataSource = info02;
                    List02.DataBind();
                }
                catch (Exception ex)
                {
                    MessageLabel.Text = ex.Message;
                }
            }
        }
 protected void Fetch_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TeamIDArg.Text))
     {
         MessageLabel.Text = "Enter a team id value.";
     }
     else
     {
         int regionid = 0;
         if (int.TryParse(TeamIDArg.Text, out regionid))
         {
             if (regionid > 0)
             {
                 TeamController sysmgr = new TeamController();
                 Team           info   = null;
                 info = sysmgr.FindByID(regionid); //BLL controller method
                 if (info == null)
                 {
                     MessageLabel.Text = "Team ID not found.";
                     TeamID.Text       = "";
                     TeamName.Text     = "";
                 }
                 else
                 {
                     TeamID.Text   = info.TeamID.ToString();
                     TeamName.Text = info.TeamName;
                 }
             }
             else
             {
                 MessageLabel.Text = "Team id must be greater than 0";
             }
         }
         else
         {
             MessageLabel.Text = "Team id must be a number.";
         }
     }
 }