Exemple #1
0
        void CreateNewPlayerBtn_Click(object sender, ImageClickEventArgs e)
        {
            String playerName = this.NewPlayerTb.Text.Trim();

            if (String.IsNullOrEmpty(playerName))
            {
                return;
            }
            String operatorId = Request.Cookies[Constants.PRIMARY_USER][Constants.USER_ID];
            Player player     = Manager.FindPlayerByName(playerName);

            if (player != null)
            {
                if (!CurrentPool.Dropins.Exists(player.Id))
                {
                    CurrentPool.AddDropin(player);
                    player.AuthorizedUsers.Add(operatorId);
                    DataAccess.Save(Manager);
                }
                this.AddDropinPopup.Hide();
                Response.Redirect(Request.RawUrl);
                return;
            }
            player = new Player(playerName, null, false);
            player.AuthorizedUsers.Add(operatorId);
            Manager.Players.Add(player);
            CurrentPool.AddDropin(player);
            DataAccess.Save(Manager);
            this.AddDropinPopup.Hide();
            Response.Redirect(Request.RawUrl);
        }
Exemple #2
0
 void AddDropinImageBtn_Click(object sender, ImageClickEventArgs e)
 {
     if (this.AddDropinLb.SelectedIndex >= 0 && !CurrentPool.Dropins.Exists(this.AddDropinLb.SelectedValue))
     {
         Player player = Manager.FindPlayerById(this.AddDropinLb.SelectedValue);
         CurrentPool.AddDropin(player);
         DataAccess.Save(Manager);
         this.AddDropinPopup.Hide();
         Response.Redirect(Request.RawUrl);
     }
 }