Esempio n. 1
0
        protected void Fetch_Click(object sender, EventArgs e)
        {
            if (List01.SelectedIndex == 0)
            {
                MessageLabel.Text = "Select a category to view its products";
            }
            else
            {
                try
                {
                    PlayerController sysmgr = new PlayerController();
                    List <Player>    info   = null;
                    info = sysmgr.Player_GetByTeam(int.Parse(List01.SelectedValue));
                    info.Sort((x, y) => x.LastName.CompareTo(y.LastName));
                    PlayerList.DataSource = info;
                    PlayerList.DataBind();

                    PlayerList.DataSource = info;
                    PlayerList.DataBind();
                }
                catch (Exception ex)
                {
                    MessageLabel.Text = ex.Message;
                }
            }
        }
Esempio n. 2
0
        private void loadAllPlayersDDL()
        {
            DTO_Player[]  players     = WebSiteManager.GetAllPlayers();
            List <string> playerNames = new List <string>();

            playerNames.Add("Select Player");
            Session["AllPlayers"] = players;

            foreach (DTO_Player pl in players)
            {
                playerNames.Add(pl.FirstName + " " + pl.LastName);
            }

            PlayerList.DataSource = playerNames;
            PlayerList.DataBind();
        }
        // get current logged in account player names for and load them into drop drop-down-list
        private void loadLoggedInUserPlayers()
        {
            DTO_ACCOUNT loggedInAccount = (DTO_ACCOUNT)(Session[WebSiteManager.LOGGEDIN_ACCOUNT_SESSION]);

            DTO_Player[] loggedInAccountPlayers = loggedInAccount.players;

            List <ListItem> loggedInAccountPlayersNames = new List <ListItem>();

            for (int i = 0; i < loggedInAccountPlayers.Length; i++)
            {
                loggedInAccountPlayersNames.Add(new ListItem(loggedInAccountPlayers[i].FirstName + " " + loggedInAccountPlayers[i].LastName));
            }

            PlayerList.DataSource = loggedInAccountPlayersNames;
            PlayerList.DataBind();

            PlayerList2.DataSource = loggedInAccountPlayersNames;
            PlayerList2.DataBind();
        }
Esempio n. 4
0
        protected void BindPlayerList()
        {
            try
            {
                PlayerController sysmgr = new PlayerController();
                List <Player>    info   = sysmgr.Player_List();

                info.Sort((x, y) => x.FullName.CompareTo(y.FullName));
                PlayerList.DataSource     = info;
                PlayerList.DataTextField  = "FullName";
                PlayerList.DataValueField = "PlayerID";
                PlayerList.DataBind();
                PlayerList.Items.Insert(0, "Select a player");
            }
            catch (Exception ex)
            {
                errormsgs.Add(GetInnerException(ex).ToString());
                LoadMessageDisplay(errormsgs, "alert alert-danger");
            }
        }
Esempio n. 5
0
 protected void BindPlayerList()
 {
     try
     {
         // Here this will be similar to using the ObjectDataSource except now we're doing this more in the code behind instead of the web form
         // This is considered better for bigger projects
         PlayerController playerController = new PlayerController();
         List<Player> playerInfo = null;
         playerInfo = playerController.Player_List();
         playerInfo.Sort((x, y) => x.FullName.CompareTo(y.FullName));
         PlayerList.DataSource = playerInfo;
         PlayerList.DataTextField = nameof(Player.FullName);
         PlayerList.DataValueField = nameof(Player.PlayerID);
         PlayerList.DataBind();
         PlayerList.Items.Insert(0, "Select a player...");
     }
     catch (Exception ex)
     {
         Message.Visible = true;
         Message.Text = ex.Message;
     }
 }
Esempio n. 6
0
    private void BindPlayers()
    {
        int        clubId  = (int)Session["ClubDetailsId"];
        SqlCommand command = new SqlCommand();

        command.CommandText = "SelectPlayers";
        command.CommandType = CommandType.StoredProcedure;
        command.Parameters.Add("RegID", SqlDbType.Int);
        command.Parameters["RegID"].Value = clubId;
        DataConnection myConnection = new DataConnection();

        try
        {
            PlayerList.DataSource   = myConnection.ExecuteCommand(command);
            PlayerList.DataKeyNames = new string[] { "PlayerName" };
            PlayerList.DataBind();
        }
        finally
        {
            myConnection.CloseConection();
        }
    }
        protected void Fetch_Click(object sender, EventArgs e)
        {
            if (TeamList.SelectedIndex == 0)
            {
                MessageLabel.Text   = "Select a team to view its players.";
                Coach.Text          = "";
                AssistantCoach.Text = "";
                Wins.Text           = "";
                Losses.Text         = "";
            }
            else
            {
                try
                {
                    PlayerController playerController = new PlayerController();
                    List <Players>   listOfPlayers    = null;
                    listOfPlayers = playerController.FindByID(int.Parse(TeamList.SelectedValue));
                    listOfPlayers.Sort((x, y) => x.PlayerName.CompareTo(y.PlayerName));
                    PlayerList.DataSource = listOfPlayers;
                    PlayerList.DataBind();


                    TeamController teamController = new TeamController();
                    Teams          teamInfo       = null;
                    teamInfo            = teamController.Teams_FindByID(int.Parse(TeamList.SelectedValue));
                    Coach.Text          = teamInfo.Coach;
                    AssistantCoach.Text = teamInfo.AssistantCoach;
                    Wins.Text           = teamInfo.Wins.ToString();
                    Losses.Text         = teamInfo.Losses.ToString();
                }
                catch (Exception ex)
                {
                    MessageLabel.Text = ex.Message;
                }
            }
        }
        protected void Fetch_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TeamList.Text))
            {
                MessageLabel.Text = "No team selected";
            }
            else
            {
                int teamid = 0;
                if (int.TryParse(TeamList.Text, out teamid))
                {
                    if (teamid > 0)
                    {
                        TeamController sysmgr = new TeamController();
                        Team           info   = null;
                        info = sysmgr.Teams_FindByID(teamid);
                        if (info == null)
                        {
                            MessageLabel.Text   = "Team not found.";
                            Coach.Text          = "";
                            AssistantCoach.Text = "";
                            Wins.Text           = "";
                            Losses.Text         = "";
                        }
                        else
                        {
                            Coach.Text          = info.Coach.ToString();
                            AssistantCoach.Text = info.AssistantCoach.ToString();
                            if (info.Wins == null)
                            {
                                Wins.Text = "0";
                            }
                            else
                            {
                                Wins.Text = info.Wins.ToString();
                            }
                            if (info.Losses == null)
                            {
                                Losses.Text = "0";
                            }
                            else
                            {
                                Losses.Text = info.Losses.ToString();
                            }
                        }

                        //}
                        //catch(Exception ex)
                        //{
                        //    MessageLabel.Text = ex.Message;
                        //}
                    }
                    else
                    {
                        MessageLabel.Text = "Team id must be greater than 0";
                    }
                }
                else
                {
                    MessageLabel.Text = "Team id must be a number.";
                }
            }
            if (TeamList.SelectedIndex == 0)
            {
                MessageLabel.Text = "Please select a team";
            }
            else
            {
                try
                {
                    PlayerController sysmgr = new PlayerController();
                    List <Player>    info   = null;
                    info = sysmgr.Player_GetByTeam(int.Parse(TeamList.SelectedValue));
                    info.Sort((x, y) => x.FullName.CompareTo(y.FullName));
                    PlayerList.DataSource = info;
                    PlayerList.DataBind();
                }
                catch (Exception ex)
                {
                    MessageLabel.Text = ex.Message;
                }
            }
        }