示例#1
0
        private void FillDropinTable(Pool pool, DateTime gameDate)
        {
            //Calcuate stats for dropins
            List <Player> players    = GetDropinPlayers(pool, gameDate);
            Game          game       = pool.FindGameByDate(gameDate);
            Dropin        nextIntern = null;

            if (!pool.IsLowPool && pool.AutoCoopReserve)
            {
                Game lowPoolGame = Manager.FindSameDayPool(pool).FindGameByDate(gameDate);
                nextIntern = Handler.FindNextCoopCandidateToMoveHighPool(CurrentPool, game, lowPoolGame);
            }
            foreach (Player player in players)
            {
                Attendee attdenee = game.Dropins.FindByPlayerId(player.Id);
                if (attdenee.Status != InOutNoshow.Out)
                {
                    TableRow row = CreateDropinTableRow(player, attdenee, game.WaitingList.Exists(player.Id));
                    this.DropinTable.Rows.Add(row);
                    this.DropinTable.Visible = true;
                }
                else if (!game.WaitingList.Exists(player.Id))// if (dropinSpotAvailable)
                {
                    Dropin dropin = CurrentPool.Dropins.FindByPlayerId(player.Id);
                    if (dropin != null)
                    {
                        if (!Manager.ActionPermitted(Actions.Power_Reserve, CurrentUser.Role) && dropin.IsCoop && pool.AutoCoopReserve && (nextIntern == null || nextIntern.PlayerId != dropin.PlayerId))
                        {
                            continue;
                        }
                        TableRow row = CreateDropinTableRow(player, attdenee, game.WaitingList.Exists(player.Id));
                        this.DropinCandidateTable.Rows.Add(row);
                        if (DropinCandidateTable.Rows.Count % 2 == 1)
                        {
                            row.BackColor = DropinCandidateTable.BorderColor;
                        }
                        if (player.Id == GetOperatorId())
                        {
                            row.BorderStyle = BorderStyle.Double;
                            row.BackColor   = System.Drawing.Color.DarkOrange;
                        }
                        if (nextIntern != null && nextIntern.PlayerId == dropin.PlayerId)
                        {
                            row.BorderStyle = BorderStyle.Double;
                            row.BackColor   = System.Drawing.Color.Beige;
                        }
                    }
                }
            }

            // List<Player> waitingList = Manager.FindPlayersByIds(game.WaitingList.getPlayerIds());
            foreach (Waiting waiting in game.WaitingList.Items)
            {
                Player   player = Manager.FindPlayerById(waiting.PlayerId);
                TableRow row    = CreateDropinTableRow(player, game.Dropins.FindByPlayerId(player.Id), game.WaitingList.Exists(player.Id));
                this.DropinWaitingTable.Rows.Add(row);
                this.DropinWaitingTable.Visible = true;
            }

            if (pool.AllowAddNewDropinName && Manager.ActionPermitted(Actions.Add_New_Player, CurrentUser.Role))
            {
                TableRow  addRow      = new TableRow();
                TableCell addNameCell = new TableCell();
                // TextBox nameTb = new TextBox();
                //nameTb.ID = "DropinNameTb";
                //this.DropinNameTb.Visible = true;
                addNameCell.Controls.Add(DropinNameTb);
                // addNameCell.Controls.Add(RequiredFieldValidator);
                addRow.Cells.Add(addNameCell);
                TableCell addCell = new TableCell();
                addCell.HorizontalAlign = HorizontalAlign.Right;
                ImageButton addImageBtn = new ImageButton();
                addImageBtn.ImageUrl = "~/Icons/Add.png";
                addImageBtn.Width    = new Unit(Constants.IMAGE_BUTTON_SIZE);
                addImageBtn.Height   = new Unit(Constants.IMAGE_BUTTON_SIZE);
                addImageBtn.Click   += new ImageClickEventHandler(AddNewDropin_Click);
                addCell.Controls.Add(addImageBtn);
                addRow.Cells.Add(addCell);
                this.DropinCandidateTable.Rows.Add(addRow);
            }
            else
            {
                this.DropinNameTb.Visible = false;
            }
        }
示例#2
0
        private TableRow CreateDropinTableRow(Player player, Attendee attendee, bool isWaiting)
        {
            TableRow   row      = new TableRow();
            TableCell  nameCell = new TableCell();
            LinkButton nameLink = new LinkButton();

            nameLink.Text      = player.Name;
            nameLink.Font.Bold = true;
            nameLink.Font.Size = new FontUnit(Constants.LINKBUTTON_FONTSIZE);
            nameLink.ID        = player.Id + ", DROPIN";
            nameCell.Controls.Add(nameLink);
            foreach (Fee fee in player.Fees)
            {
                if (!fee.IsPaid && fee.Amount > 0)
                {
                    Image image = new Image();
                    image.ImageUrl = "~/Icons/dollar.png";
                    nameCell.Controls.Add(image);
                }
            }
            row.Cells.Add(nameCell);
            row.Cells.Add(nameCell);
            TableCell actionCell = new TableCell();

            actionCell.HorizontalAlign = HorizontalAlign.Right;
            ImageButton imageBtn = new ImageButton();

            imageBtn.ID = player.Id;
            if (isWaiting)
            {
                imageBtn.ImageUrl = "~/Icons/Remove.png";
                imageBtn.Click   += new ImageClickEventHandler(Cancel_Waiting_Click);
            }
            else if (attendee.Status == InOutNoshow.In)
            {
                imageBtn.ImageUrl = "~/Icons/Remove.png";
                imageBtn.Click   += new ImageClickEventHandler(Cancel_Click);
            }
            else if (attendee.Status == InOutNoshow.NoShow)
            {
                imageBtn.ImageUrl = "~/Icons/noShow.png";
                imageBtn.Click   += new ImageClickEventHandler(Cancel_Click);
            }
            else
            {
                imageBtn.ImageUrl = "~/Icons/Add.png";
                imageBtn.Click   += new ImageClickEventHandler(Reserve_Click);
            }
            if (isWaiting || attendee.Status == InOutNoshow.In)
            {
                if (CurrentPool.IsLowPool && Manager.ActionPermitted(Actions.Move_To_High_Pool, CurrentUser.Role))
                {
                    ImageButton moveBtn = new ImageButton();
                    moveBtn.ID       = player.Id + ",move";
                    moveBtn.Width    = new Unit(Constants.IMAGE_BUTTON_SIZE);
                    moveBtn.Height   = new Unit(Constants.IMAGE_BUTTON_SIZE);
                    moveBtn.ImageUrl = "~/Icons/Move.png";
                    moveBtn.Click   += MoveFromCurrentPool_Click;
                    actionCell.Controls.Add(moveBtn);
                }
            }

            imageBtn.Width  = new Unit(Constants.IMAGE_BUTTON_SIZE);
            imageBtn.Height = new Unit(Constants.IMAGE_BUTTON_SIZE);
            actionCell.Controls.Add(imageBtn);
            row.Cells.Add(actionCell);
            if (Handler.IsPermitted(Actions.View_Player_Details, player))
            {
                nameLink.Click += new EventHandler(Username_Click);
            }
            if (!Handler.IsPermitted(Actions.Reserve_Player, player))
            {
                imageBtn.Enabled = false;
            }
            return(row);
        }
示例#3
0
        private void FillMemberTable(Pool pool, DateTime date)
        {
            if (pool.Members.Count == 0)
            {
                this.MemberTable.Visible = false;
                return;
            }
            IEnumerable <Player> playerQuery = OrderMembersByName(pool, date);
            bool spotsFilledup  = !Handler.IsSpotAvailable(pool, date);
            bool alterbackcolor = false;

            foreach (Player player in playerQuery)
            {
                //If this player is on the waiting list, don't list it in member section
                Game comingGame = pool.FindGameByDate(date);
                if (comingGame.WaitingList.Exists(player.Id))
                {
                    continue;
                }
                //
                Member   member = pool.Members.FindByPlayerId(player.Id);
                TableRow row    = new TableRow();
                if (alterbackcolor)
                {
                    row.BackColor = MemberTable.BorderColor;
                }
                alterbackcolor = !alterbackcolor;
                if (player.Id == GetOperatorId())
                {
                    row.BackColor   = System.Drawing.Color.CadetBlue;
                    row.BorderStyle = BorderStyle.Outset;
                }
                TableCell  nameCell = new TableCell();
                LinkButton nameLink = new LinkButton();
                nameLink.Text      = player.Name;
                nameLink.Font.Bold = true;
                nameLink.Font.Size = new FontUnit(Constants.LINKBUTTON_FONTSIZE);
                nameLink.ID        = player.Id + ",MEMEBER";
                this.MemberTable.Rows.Add(row);
                nameCell.Controls.Add(nameLink);

                /* if (player.Marked)
                 * {
                 *   Image image = new Image();
                 *   image.ImageUrl = "~/Icons/Colorball.png";
                 *   //nameCell.Controls.Add(image);
                 * }*/
                foreach (Fee fee in player.Fees)
                {
                    if (!fee.IsPaid && fee.Amount > 0)
                    {
                        Image image = new Image();
                        image.ImageUrl = "~/Icons/dollar.png";
                        nameCell.Controls.Add(image);
                    }
                }
                row.Cells.Add(nameCell);
                TableCell statusCell = new TableCell();
                statusCell.HorizontalAlign = HorizontalAlign.Right;
                ImageButton imageBtn = new ImageButton();
                imageBtn.ID = player.Id;
                //If current user is not permit to reserve for this player, disable the image btn
                if (Handler.IsPermitted(Actions.View_Player_Details, player))
                {
                    nameLink.Click += new EventHandler(Username_Click);
                }
                if (!Handler.IsPermitted(Actions.Reserve_Player, player))
                {
                    imageBtn.Enabled = false;
                }
                Game     game     = pool.FindGameByDate(date);
                Attendee attdenee = game.Members.FindByPlayerId(player.Id);
                if (attdenee.Status == InOutNoshow.Out)
                {
                    imageBtn.ImageUrl = "~/Icons/Out.png";
                    imageBtn.Click   += new ImageClickEventHandler(Reserve_Click);
                }
                else if (attdenee.Status == InOutNoshow.In)
                {
                    if (attdenee.Confirmed)
                    {
                        imageBtn.ImageUrl = "~/Icons/In.png";
                        imageBtn.Click   += new ImageClickEventHandler(Cancel_Click);
                        if (CurrentPool.IsLowPool && Manager.ActionPermitted(Actions.Move_To_High_Pool, CurrentUser.Role))
                        {
                            ImageButton moveBtn = new ImageButton();
                            moveBtn.ID       = player.Id + ",move";
                            moveBtn.Width    = new Unit(Constants.IMAGE_BUTTON_SIZE);
                            moveBtn.Height   = new Unit(Constants.IMAGE_BUTTON_SIZE);
                            moveBtn.ImageUrl = "~/Icons/Move.png";
                            moveBtn.Click   += MoveFromCurrentPool_Click;
                            statusCell.Controls.Add(moveBtn);
                        }
                    }
                    else
                    {
                        imageBtn.ImageUrl = "~/Icons/toConfirm.png";
                        imageBtn.Click   += new ImageClickEventHandler(Confirm_Click);
                    }
                }
                else//No show
                {
                    imageBtn.ImageUrl = "~/Icons/noShow.png";
                    imageBtn.Click   += new ImageClickEventHandler(Cancel_Click);
                }
                //imageBtn.Click += new ImageClickEventHandler(MemberChangeAttendance_Click);
                imageBtn.Width  = new Unit(Constants.IMAGE_BUTTON_SIZE);
                imageBtn.Height = new Unit(Constants.IMAGE_BUTTON_SIZE);
                //  imageBtn.CssClass = "imageBtn";
                statusCell.Controls.Add(imageBtn);
                row.Cells.Add(statusCell);
            }
        }