Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            client = new ServiceReference1.Service1Client();
            try
            {
                if (!Page.IsPostBack)
                {
                    this.DropDownListPlayers.SelectedIndexChanged -= new System.EventHandler(DropDownListPlayers_SelectedIndexChanged);
                    this.DropDownListGames.SelectedIndexChanged   -= new System.EventHandler(DropDownListGames_SelectedIndexChanged);

                    List <string> nList = client.getAllPlayersNames().ToList <string>();

                    DropDownListPlayers.DataSource = nList;
                    DropDownListPlayers.DataBind();


                    List <string> gList = client.getAllGamesForCombo().ToList <string>();

                    DropDownListGames.DataSource = gList;
                    DropDownListGames.DataBind();

                    this.DropDownListPlayers.SelectedIndexChanged += new System.EventHandler(DropDownListPlayers_SelectedIndexChanged);
                    this.DropDownListGames.SelectedIndexChanged   += new System.EventHandler(DropDownListGames_SelectedIndexChanged);
                }
            }
            catch (Exception ex)
            {
                Panel2.Visible = false;
                Response.Write(ex.ToString());
            }
        }
Exemplo n.º 2
0
        protected void UpdatePlayer_Click(object sender, EventArgs e)
        {
            string name  = UpdateName.Text;
            string email = UpdateEmail.Text;
            string pName = DropDownListPlayers.SelectedItem.ToString();

            List <string> nList = client.UpdatePlayer(name + " " + email + " " + pName).Split('*').ToList <string>();


            DropDownListPlayers.DataSource = nList;
            DropDownListPlayers.DataBind();
        }
Exemplo n.º 3
0
        protected void DeletePlayer_Click(object sender, EventArgs e)
        {
            try
            {
                string        pName = DropDownListPlayers.SelectedItem.ToString();
                List <string> nList = client.DeletePlayer(pName).Split('*').ToList <string>();


                DropDownListPlayers.DataSource = nList;
                DropDownListPlayers.DataBind();
            }
            catch (Exception ex)
            {
                Panel2.Visible = false;
                Response.Write(ex.ToString());
            }
        }