Beispiel #1
0
        protected void RemoveDropinBtn_Click(object sender, EventArgs e)
        {
            if (!IsSuperAdmin())
            {
                return;
            }
            String playerId = this.DropinListbox.SelectedValue;

            CurrentPool.RemoveDropin(playerId);
            foreach (Game game in CurrentPool.Games)
            {
                if (game.Date >= DateTime.Today)
                {
                    if (game.Dropins.Exists(playerId))
                    {
                        game.Dropins.Remove(playerId);
                    }
                    if (game.WaitingList.Exists(playerId))
                    {
                        game.WaitingList.Remove(playerId);
                    }
                }
            }
            //Save
            DataAccess.Save(Manager);
            this.DropinListbox.DataSource = GetPlayers(CurrentPool.Dropins);
            this.DropinListbox.DataBind();
            //Response.Redirect(Request.RawUrl);
        }
Beispiel #2
0
        protected void RemoveMemberBtn_Click(object sender, EventArgs e)
        {
            if (!IsSuperAdmin())
            {
                return;
            }
            String playerId = this.MemberListbox.SelectedValue;

            CurrentPool.RemoveMember(playerId);
            //Remove from reserved and absence list for the future games
            foreach (Game game in CurrentPool.Games)
            {
                if (game.Date >= DateTime.Today)
                {
                    if (game.Members.Exists(playerId))
                    {
                        game.Members.Remove(playerId);
                    }
                    if (game.WaitingList.Exists(playerId))
                    {
                        game.WaitingList.Remove(playerId);
                    }
                }
            }

            //Save
            DataAccess.Save(Manager);
            this.MemberListbox.DataSource = GetPlayers(CurrentPool.Members);
            this.MemberListbox.DataBind();
            this.MemberLb.Text = "Members(" + CurrentPool.Members.Count + ")";

            // Response.Redirect(Request.RawUrl);
        }
Beispiel #3
0
 protected void UpdateGameBtn_Click(object sender, EventArgs e)
 {
     if (!IsSuperAdmin() || this.GameDateTb.Text == "" || this.GameListbox.SelectedItem == null)// || this.GameListbox.SelectedItem.Text == this.GameDateTb.Text)
     {
         return;
     }
     try
     {
         DateTime gameDate = DateTime.Parse(GameDateTb.Text);
         if (this.GameListbox.SelectedItem.Text != this.GameDateTb.Text && CurrentPool.GameExists(gameDate))
         {
             ClientScript.RegisterStartupScript(Page.GetType(), "msgid", "alert('Game on " + gameDate.ToShortDateString() + " is already in system!')", true);
             return;
         }
         Game game = CurrentPool.FindGameByDate(DateTime.Parse(GameListbox.SelectedItem.Text));
         if (game != null)
         {
             game.Date             = gameDate;
             game.IsCancelled      = this.gameCancelledCb.Checked;
             game.DropinRestricted = this.DropinRestricted.Checked;
         }
     }
     catch (Exception)
     {
         ClientScript.RegisterStartupScript(Page.GetType(), "msgid", "alert('Wrong game date format!  Fix it and try again')", true);
         return;
     }
     this.GameListbox.DataSource = CurrentPool.Games;
     this.GameListbox.DataBind();
     DataAccess.Save(Manager);
     SetNextGameDate();
     // Response.Redirect(Request.RawUrl);
 }
Beispiel #4
0
 public T Get <T>(object id, string key)
 {
     try
     {
         var value = CurrentPool.GetClient().Channel.ПолучитьЗначениеПростое(id, key, Хранилище.Оперативное, Db);
         if (value is T)
         {
             return((T)value);
         }
         else if (value == null && typeof(T) == typeof(DateTime))
         {
             return((T)(object)DateTime.MinValue);
         }
         else
         {
             return((T)Convert.ChangeType(value, typeof(T)));
         }
     }
     catch (InvalidCastException)
     {
         return(default(T));
     }
     catch (FormatException)
     {
         return(default(T));
     }
     catch (OverflowException)
     {
         return(default(T));
     }
     catch (ArgumentNullException)
     {
         return(default(T));
     }
 }
Beispiel #5
0
        private void FillGameTable(Player member)
        {
            IEnumerable <Game> query          = CurrentPool.Games.OrderBy(game => game.Date);
            DateTime           comingGameDate = (DateTime)Session[Constants.GAME_DATE];

            if (comingGameDate == null)
            {
                return;
            }
            String admin = this.Request.Params[Constants.ADMIN];

            foreach (Game game in query)
            {
                if (admin == null && game.Date <= comingGameDate)
                {
                    continue;
                }
                TableRow  row      = new TableRow();
                TableCell dateCell = new TableCell();
                dateCell.Text = game.Date.ToString("ddd, MMM d, yyyy");
                row.Cells.Add(dateCell);
                TableCell statusCell = new TableCell();
                statusCell.HorizontalAlign = HorizontalAlign.Right;
                ImageButton imageBtn = new ImageButton();
                imageBtn.ID       = member.Id + "," + game.Date.ToShortDateString();
                imageBtn.ImageUrl = CurrentPool.GetMemberAttendance(member.Id, game.Date) ? "~/Icons/In.png" : "~/Icons/Out.png";
                imageBtn.Width    = new Unit(Constants.IMAGE_BUTTON_SIZE);
                imageBtn.Height   = new Unit(Constants.IMAGE_BUTTON_SIZE);
                imageBtn.Click   += new ImageClickEventHandler(MemberChangeAttendance_Click);
                //  imageBtn.CssClass = "imageBtn";
                statusCell.Controls.Add(imageBtn);
                row.Cells.Add(statusCell);
                this.GameTable.Rows.Add(row);
            }
        }
Beispiel #6
0
        protected void MemberChangeAttendance_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton btn      = (ImageButton)sender;
            String      playerId = btn.ID.Split(',')[0];

            DateTime date     = DateTime.Parse(btn.ID.Split(',')[1]);
            Player   player   = Manager.FindPlayerById(playerId);
            Game     game     = CurrentPool.FindGameByDate(date);
            Attendee attendee = game.Members.FindByPlayerId(playerId);

            if (attendee.Status == InOutNoshow.Out)
            {
                if (Handler.IsSpotAvailable(CurrentPool, game.Date))
                {
                    Handler.ReservePromarySpot(CurrentPool, game, player);
                    Manager.AddReservationNotifyWechatMessage(player.Id, CurrentUser.Id, Constants.RESERVED, CurrentPool, CurrentPool, game.Date);
                }
                else
                {
                    ShowMessage("Pool " + CurrentPool.Name + " is full. If you would like to add to waiting list, use the pool reservation page");
                    return;
                }
                return;
            }
            else if (attendee.Status == InOutNoshow.In)
            {
                Handler.CancelPromarySpot(CurrentPool, game, player);
                Manager.AddReservationNotifyWechatMessage(player.Id, CurrentUser.Id, Constants.CANCELLED, CurrentPool, CurrentPool, game.Date);
                Handler.AssignDropinSpotToWaiting(CurrentPool, game);
            }
            //Recalculate factor
            Manager.ReCalculateFactor(CurrentPool, date);
            DataAccess.Save(Manager);
            Response.Redirect(Request.RawUrl);
        }
Beispiel #7
0
 public T GetMemCache <T>(string key)
 {
     try
     {
         var value = CurrentPool.GetClient().Channel.ПолучитьКешЗначение(key, Db);
         if (value is T)
         {
             return((T)value);
         }
         else if (value == null && typeof(T) == typeof(DateTime))
         {
             return((T)(object)DateTime.MinValue);
         }
         else
         {
             return((T)Convert.ChangeType(value, typeof(T)));
         }
     }
     catch (InvalidCastException)
     {
         return(default(T));
     }
     catch (FormatException)
     {
         return(default(T));
     }
     catch (OverflowException)
     {
         return(default(T));
     }
     catch (ArgumentNullException)
     {
         return(default(T));
     }
 }
Beispiel #8
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);
        }
Beispiel #9
0
 protected void AddGameBtn_Click(object sender, EventArgs e)
 {
     if (!IsSuperAdmin() || this.GameDateTb.Text == "")
     {
         return;
     }
     String[] gameDates = GameDateTb.Text.Split(',');
     //Parse Date string
     foreach (String gameDate in gameDates)
     {
         try
         {
             DateTime date = DateTime.Parse(gameDate);
             if (CurrentPool.GameExists(date))
             {
                 ClientScript.RegisterStartupScript(Page.GetType(), "msgid", "alert('Game on " + date.ToShortDateString() + " is already added!')", true);
                 return;
             }
         }
         catch (Exception)
         {
             ClientScript.RegisterStartupScript(Page.GetType(), "msgid", "alert('Wrong game date format!  Fix it and try again')", true);
             return;
         }
     }
     foreach (String gameDate in gameDates)
     {
         DateTime date = DateTime.Parse(gameDate);
         if (date.Date < Manager.EastDateTimeToday.Date)
         {
             continue;
         }
         Game game = new Game(date);
         foreach (Member member in CurrentPool.Members.Items)
         {
             Attendee att = new Attendee(member.PlayerId, InOutNoshow.In);
             att.Confirmed = !member.NeedToConfirm;
             game.Members.Add(att);
         }
         foreach (Dropin dropin in CurrentPool.Dropins.Items)
         {
             Pickup attendee = new Pickup(dropin.PlayerId);
             attendee.IsCoop = dropin.IsCoop;
             if (IsMondayMember(dropin.PlayerId))
             {
                 attendee.Status = InOutNoshow.In;
             }
             game.Dropins.Add(attendee);
         }
         CurrentPool.Games.Add(game);
     }
     GameListbox.DataSource = CurrentPool.Games;
     GameListbox.DataBind();
     //GameList.SelectedIndex = -1;
     //GameDateTb.Text = "";
     DataAccess.Save(Manager);
     SetNextGameDate();
     //Response.Redirect(Request.RawUrl);
 }
Beispiel #10
0
        protected void GameList_SelectedIndexChanged(object sender, EventArgs e)
        {
            GameDateTb.Text = this.GameListbox.SelectedItem.Text;
            Game game = CurrentPool.FindGameByDate(DateTime.Parse(GameListbox.SelectedItem.Text));

            gameCancelledCb.Checked  = game.IsCancelled;
            DropinRestricted.Checked = game.DropinRestricted;
        }
Beispiel #11
0
 string GetCurrentPool()
 {
     if (currentPool == CurrentPool.Max)
     {
         currentPool = CurrentPool.Border;
     }
     return currentPool++.ToString();
 }
Beispiel #12
0
        public void SetAsync(object id, string key, object value)
        {
            var values = new Dictionary <string, Value>();

            values.Add(key, new Value()
            {
                Значение = value
            });
            CurrentPool.GetClient().Channel.СохранитьЗначениеАсинхронно(id, values, false, Хранилище.Оперативное, string.Empty, Db);
        }
Beispiel #13
0
        public byte[] Get(object id)
        {
            var file = CurrentPool.GetClient().Channel.ПолучитьФайлПолностью(new ПолучитьФайлПолностьюRequest(id, RosService.Files.Хранилище.Оперативное, Db));

            if (file != null)
            {
                return(file.ПолучитьФайлПолностьюResult);
            }

            return(new byte[0]);
        }
Beispiel #14
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);
     }
 }
Beispiel #15
0
        protected void Reserve_Confirm_Click(object sender, EventArgs e)
        {
            String playerId = Session[Constants.CURRENT_PLAYER_ID].ToString();
            Player player   = Manager.FindPlayerById(playerId);
            Game   game     = CurrentPool.FindGameByDate(TargetGameDate);

            if (Handler.ReserveSpot(CurrentPool, game, player))
            {
                Manager.ReCalculateFactor(CurrentPool, TargetGameDate);
                Manager.AddReservationNotifyWechatMessage(player.Id, CurrentUser.Id, Constants.RESERVED, CurrentPool, CurrentPool, TargetGameDate);
                LogHistory log = Handler.CreateLog(Manager.EastDateTimeNow, game.Date, Handler.GetUserIP(), CurrentPool.Name, Manager.FindPlayerById(playerId).Name, "Reserved", CurrentUser.Name);
                Manager.Logs.Add(log);
                Handler.AutoMoveCoopPlayers(CurrentPool.DayOfWeek, game.Date);
                DataAccess.Save(Manager);
            }
            Response.Redirect(Constants.RESERVE_PAGE);
        }
Beispiel #16
0
        private void No_Show_Confirm_Click(object sender, EventArgs e)
        {
            String playerId = Session[Constants.CURRENT_PLAYER_ID].ToString();
            Game   game     = CurrentPool.FindGameByDate(TargetGameDate);
            Player player   = Manager.FindPlayerById(playerId);

            Handler.MarkNoShow(CurrentPool, game, player);
            String message = String.Format("[System Info] Hi, {0}. Admin marked you as no-show on the reservation of {1}. If you have any question, contact the admin", player.Name, game.Date.ToString("MM/dd/yyyy"));

            Manager.WechatNotifier.AddNotifyWechatMessage(player, message);
            LogHistory log = Handler.CreateLog(Manager.EastDateTimeNow, game.Date, Handler.GetUserIP(), CurrentPool.Name, Manager.FindPlayerById(playerId).Name, "Marked no-show", CurrentUser.Name);

            Manager.Logs.Add(log);
            Manager.ReCalculateFactor(CurrentPool, TargetGameDate);
            DataAccess.Save(Manager);
            Response.Redirect(Constants.RESERVE_PAGE);
        }
Beispiel #17
0
        protected void Move_Confirm_Click(object sender, EventArgs e)
        {
            Game   game     = CurrentPool.FindGameByDate(TargetGameDate);
            String playerId = Session[Constants.CURRENT_PLAYER_ID].ToString();
            Player player   = Manager.FindPlayerById(playerId);

            if (game.Members.Items.Exists(member => member.PlayerId == playerId && member.Status == InOutNoshow.In) ||
                game.Dropins.Items.Exists(dropin => dropin.PlayerId == playerId && dropin.Status == InOutNoshow.In) ||
                game.WaitingList.Exists(playerId))
            {
                Pool sameDayPool = Manager.Pools.Find(p => p.DayOfWeek == CurrentPool.DayOfWeek && p.Name != CurrentPool.Name);
                game = sameDayPool.FindGameByDate(TargetGameDate);
                MoveSpot(sameDayPool, game, player);
                return;
            }

            MoveSpot(CurrentPool, game, player);
        }
Beispiel #18
0
        //Cancel waiting
        protected void Cancel_Waiting_Click(object sender, EventArgs e)
        {
            if (Handler.IsReservationLocked(TargetGameDate) && !Manager.ActionPermitted(Actions.Change_After_Locked, CurrentUser.Role))
            {
                ShowMessage(appLockedMessage);
                return;
            }
            ImageButton lbtn     = (ImageButton)sender;
            String      playerId = lbtn.ID;
            Game        game     = CurrentPool.FindGameByDate(TargetGameDate);

            game.WaitingList.Remove(playerId);
            LogHistory log = Handler.CreateLog(Manager.EastDateTimeNow, game.Date, Handler.GetUserIP(), CurrentPool.Name, Manager.FindPlayerById(playerId).Name, "Cancel waitinglist", CurrentUser.Name);

            Manager.Logs.Add(log);
            DataAccess.Save(Manager);
            this.PopupModal.Hide();
            Response.Redirect(Constants.RESERVE_PAGE);
        }
Beispiel #19
0
        public decimal Set(object id, string filename, byte[] stream, string ИдентификаторОбъекта)
        {
            RosService.Files.СохранитьФайлПолностьюRequest inValue = new RosService.Files.СохранитьФайлПолностьюRequest();
            inValue.id_node            = id;
            inValue.ИдентификаторФайла = ИдентификаторОбъекта;
            inValue.ИмяФайла           = filename;
            inValue.Описание           = string.Empty;
            inValue.stream             = stream;
            inValue.хранилище          = RosService.Files.Хранилище.Оперативное;
            inValue.user   = String.Empty;
            inValue.domain = Db;

            RosService.Files.СохранитьФайлПолностьюResponse retVal = CurrentPool.GetClient().Channel.СохранитьФайлПолностью(inValue);
            return(retVal.СохранитьФайлПолностьюResult);

            //var file = CurrentPool.GetClient().Channel.СохранитьФайлПолностью(new СохранитьФайлПолностьюRequest(id, ИдентификаторОбъекта, filename, string.Empty, stream, RosService.Files.Хранилище.Оперативное, "", Db));
            //if (file != null)
            //    return file.СохранитьФайлПолностьюResult;
            //return 0;
        }
Beispiel #20
0
        protected void DeleteGameBtn_Click(object sender, EventArgs e)
        {
            if (!IsSuperAdmin() || this.GameListbox.SelectedIndex == -1)
            {
                return;
            }
            Game game = CurrentPool.FindGameByDate(DateTime.Parse(GameListbox.SelectedItem.Text));

            if (game != null)
            {
                CurrentPool.Games.Remove(game);
                // this.GameDateTb.Text = "";
                //  this.GameList.SelectedIndex = -1;
                this.GameListbox.DataSource = CurrentPool.Games;
                this.GameListbox.DataBind();
                DataAccess.Save(Manager);
                SetNextGameDate();
                //Response.Redirect(Request.RawUrl);
            }
        }
Beispiel #21
0
        }
        /// <summary>
        /// Использовать для возвращения в пул
        /// </summary>
        public void ReturnToPool()
        {
            if (InPool)
                return;

            if (CurrentPool != null)
            {
                PrepareReturnToPool();
                InPool = true;
                CurrentPool.ReturnObject(this);
            }
            else
            {
                Destroy(this.gameObject);
                return;
            }

            if (OnToPoolReturned != null)
                OnToPoolReturned();
            OnToPoolReturned = null;            
Beispiel #22
0
        protected void Confirm_Click(object sender, EventArgs e)
        {
            if (Handler.IsReservationLocked(TargetGameDate) && !Manager.ActionPermitted(Actions.Change_After_Locked, CurrentUser.Role))
            {
                ShowMessage(appLockedMessage);
                return;
            }
            ImageButton lbtn     = (ImageButton)sender;
            String      playerId = lbtn.ID;
            Game        game     = CurrentPool.FindGameByDate(TargetGameDate);
            Attendee    member   = game.Members.FindByPlayerId(playerId);

            member.Confirmed = true;
            LogHistory log = Handler.CreateLog(Manager.EastDateTimeNow, game.Date, Handler.GetUserIP(), CurrentPool.Name, Manager.FindPlayerById(playerId).Name, "Confirmed", CurrentUser.Name);

            Manager.Logs.Add(log);
            String message = String.Format("You confirmed your reservation for the volleyball game on {0}. If you change your mind, please cancel it. Thanks", game.Date.ToString("MM/dd/yyyy"));

            Manager.WechatNotifier.AddNotifyWechatMessage(Manager.FindPlayerById(playerId), message);
            DataAccess.Save(Manager);
            ShowMessage("Your reservation is confirmed !");
            //Response.Redirect(Constants.RESERVE_PAGE);
        }
Beispiel #23
0
        protected void AddWaitingList_Confirm_Click(object sender, ImageClickEventArgs e)
        {
            String playerId = Session[Constants.CURRENT_PLAYER_ID].ToString();
            Game   game     = CurrentPool.FindGameByDate(TargetGameDate);

            if (game.WaitingList.Exists(playerId))
            {
                return;
            }
            Pool otherPool = Manager.Pools.Find(p => p.Name != CurrentPool.Name && p.DayOfWeek == CurrentPool.DayOfWeek);

            if (otherPool != null && otherPool.Members.Exists(playerId) && !otherPool.FindGameByDate(TargetGameDate).Members.Items.Exists(member => member.PlayerId == playerId && member.Status == InOutNoshow.In))
            {
                //Changed to allow holding a member spot in another pool when putting into waiting list
                // ShowMessage("Sorry, But you have aleady reserved a spot in pool " + pool.Name + " on the same day. Cancel that spot before adding onto the waiting list");
                //return;
            }
            if (otherPool != null && otherPool.Dropins.Exists(playerId) && otherPool.FindGameByDate(TargetGameDate).Dropins.Items.Exists(dropin => dropin.PlayerId == playerId && dropin.Status == InOutNoshow.In))
            {
                ShowMessage("Sorry, But you have aleady reserved a dropin spot in pool " + otherPool.Name + " on the same day. Cancel that spot beforeadding onto the waiting list");
                return;
            }
            else if (otherPool.FindGameByDate(TargetGameDate).WaitingList.Exists(playerId))
            {
                ShowMessage("Sorry, But you are on waiting list in pool " + otherPool.Name + " on the same day. Cancel that before adding onto the waiting list");
                return;
            }
            Handler.AddToWaitingList(CurrentPool, game, Manager.FindPlayerById(playerId));
            Manager.AddReservationNotifyWechatMessage(playerId, CurrentUser.Id, Constants.WAITING, CurrentPool, CurrentPool, TargetGameDate);
            LogHistory log = Handler.CreateLog(Manager.EastDateTimeNow, game.Date, Handler.GetUserIP(), CurrentPool.Name, Manager.FindPlayerById(playerId).Name, "Added to waiting list", CurrentUser.Name);

            Manager.Logs.Add(log);
            Handler.AutoMoveCoopPlayers(CurrentPool.DayOfWeek, game.Date);
            DataAccess.Save(Manager);
            Response.Redirect(Constants.RESERVE_PAGE);
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //ReloadManager();
            this.PopupModal.Hide();
            if (Manager.CookieAuthRequired && Request.Cookies[Constants.PRIMARY_USER] == null)
            {
                Response.Redirect(Constants.REQUEST_REGISTER_LINK_PAGE);
                return;
            }
            Player currentUser = Manager.FindPlayerById(Request.Cookies[Constants.PRIMARY_USER][Constants.USER_ID]);

            if (currentUser == null || !currentUser.IsActive)
            {
                ShowMessage("Sorry, but your device is no longer linked to any account, Please contact admin for advice");
                return;
            }
            Session[Constants.CURRENT_USER] = currentUser;
            String operatorId = Request.Cookies[Constants.PRIMARY_USER][Constants.USER_ID];

            String poolId   = this.Request.Params[Constants.POOL_ID];
            String poolName = this.Request.Params[Constants.POOL];

            if (poolId != null)
            {
                poolName = Manager.FindPoolById(poolId).Name;
                Session[Constants.POOL]      = poolName;
                this.ToReadmeBtn.Visible     = false;
                Session[Constants.GAME_DATE] = null;
            }
            else if (poolName != null)
            {
                Session[Constants.POOL]      = poolName;
                Session[Constants.GAME_DATE] = null;
            }
            if (CurrentPool == null)
            {
                Response.Redirect(Constants.POOL_LINK_LIST_PAGE);
                return;
            }
            //
            DateTime gameDate       = Manager.EastDateTimeToday;
            String   gameDateString = this.Request.Params[Constants.GAME_DATE];

            if (gameDateString != null)
            {
                gameDate = DateTime.Parse(gameDateString);
            }
            else if (Session[Constants.GAME_DATE] != null)
            {
                gameDate = DateTime.Parse(Session[Constants.GAME_DATE].ToString());
            }
            Session[Constants.GAME_DATE] = null;
            List <Game> games      = CurrentPool.Games;
            Game        targetGame = games.OrderBy(game => game.Date).ToList <Game>().Find(game => game.Date >= gameDate);

            if (targetGame != null)
            {
                Session[Constants.GAME_DATE] = targetGame.Date;
            }
            //Check to see if user is quilified to view current pool
            if ((!Manager.ActionPermitted(Actions.View_All_Pools, currentUser.Role) && !CurrentPool.Members.Exists(currentUser.Id) &&//
                 !CurrentPool.Dropins.Exists(currentUser.Id) && !targetGame.Dropins.Exists(currentUser.Id)) ||
                (CurrentPool.AutoCoopReserve && targetGame.Dropins.Items.Exists(c => c.PlayerId == currentUser.Id && c.IsCoop && c.Status == InOutNoshow.Out)))
            {
                Response.Redirect(Constants.POOL_LINK_LIST_PAGE);
                return;
            }
            if (!Manager.ActionPermitted(Actions.Admin_Management, currentUser.Role) && Manager.InMaintenance)
            {
                GameInfoTable.Caption             = "Under Maintenance!";
                this.RateBtn.Visible              = false;
                this.ToReadmeBtn.Visible          = false;
                this.MemberTable.Visible          = false;
                this.DropinCandidateTable.Visible = false;
                return;
            }
            //Initialize processor
            InitializeActionHandler();
            //Fill message board
            if (!String.IsNullOrEmpty(CurrentPool.MessageBoard))
            {
                ShowBoardMessage(CurrentPool.MessageBoard);
            }
            else if (TargetGameDate.DayOfWeek == DayOfWeek.Thursday)
            {
                ShowBoardMessage(Constants.THURSDAY_NOTIFY_MESSAGE);
            }
            else
            {
                this.MessageTextTable.Visible = false;
            }
            if (Session[Constants.GAME_DATE] == null)
            {
                if (String.IsNullOrEmpty(CurrentPool.MessageBoard))
                {
                    GameInfoTable.Caption = "No volleyball in pool " + CurrentPool.Name + " !";
                }
                //Fill member table
                FillMemberTable(CurrentPool);

                //Fill dropin table
                this.DropinCandidateTable.Caption = "Dropins";
                FillDropinTable(CurrentPool);
                return;
            }
            //Check if there is dropin spots available for the players on waiting list
            Game comingGame = CurrentPool.FindGameByDate(TargetGameDate);

            while (!Handler.IsReservationLocked(TargetGameDate) && Handler.IsSpotAvailable(CurrentPool, TargetGameDate) && comingGame.WaitingList.Count > 0)
            {
                Handler.AssignDropinSpotToWaiting(CurrentPool, comingGame);
            }
            //Cancel unconfirmed reservation
            Handler.AutoCancelUnconfirmedReservations();
            //Auto move intern
            Handler.AutoMoveCoop();
            //Fill game information
            FillGameInfoTable(CurrentPool, TargetGameDate);

            //Fill member table
            FillMemberTable(CurrentPool, TargetGameDate);

            //Fill dropin table
            FillDropinTable(CurrentPool, TargetGameDate);

            SetConfirmButtonHandlder();
            this.AddDropinImageBtn.Click  += new ImageClickEventHandler(AddDropinImageBtn_Click);
            this.CreateNewPlayerBtn.Click += new ImageClickEventHandler(CreateNewPlayerBtn_Click);
            //this.PopupModal.Hide();
        }
Beispiel #25
0
 public void AddJornal(string Message, string StackTrace)
 {
     CurrentPool.GetClient().Channel.ЖурналСобытийДобавитьОшибку(Message, StackTrace, string.Empty, Db);
 }
Beispiel #26
0
 public void AddAttribute(string Type, string Attribute)
 {
     CurrentPool.GetClient().Channel.ДобавитьАтрибут(Type, Attribute, true, string.Empty, Db);
 }
Beispiel #27
0
 public void AddType(string Name, string Description, string Namespace, string BaseType)
 {
     CurrentPool.GetClient().Channel.ДобавитьТип(0, Name, Description, Namespace, BaseType, false, true, string.Empty, Db);
 }
Beispiel #28
0
 /// <summary>
 /// Копировать тип данных
 /// </summary>
 /// <param name="ТипДанных"></param>
 /// <param name="ИзДомена"></param>
 /// <param name="КопироватьВ"></param>
 /// <param name="КопироватьВДомен"></param>
 /// <param name="УсловияКопирования"></param>
 public void CopyType(string ТипДанных, string ИзДомена, string КопироватьВ, string КопироватьВДомен, УсловияКопирования УсловияКопирования)
 {
     CurrentPool.GetClient().Channel.КопироватьТипДанных(ТипДанных, ИзДомена, КопироватьВ, КопироватьВДомен, УсловияКопирования, string.Empty, Db);
 }
Beispiel #29
0
 /// <summary>
 /// Получить список данных
 /// </summary>
 /// <returns></returns>
 public RosService.Configuration.Type[] GetTypes()
 {
     return(CurrentPool.GetClient().Channel.СписокТипов(new string[0], Db));
 }
Beispiel #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String poolName = this.Request.Params[Constants.POOL];

            if (poolName != null)
            {
                Session[Constants.POOL] = poolName;
                if (CurrentPool == null)
                {
                    return;
                }
            }
            else
            {
                return;
            }
            //  Calculate attendence statistics for games;
            int         less12            = 0;
            int         less12WithoutCoop = 0;
            int         less14            = 0;
            int         less14WithoutCoop = 0;
            int         full                      = 0;
            int         fullWithoutCoop           = 0;
            int         fullAndWaiting            = 0;
            int         fullAndWaitingWithoutCoop = 0;
            List <Game> fullGames                 = new List <Game>();

            foreach (Game game in CurrentPool.Games)
            {
                if (CurrentPool.GetNumberOfAvaliableMembers() - game.Absences.Count + game.Pickups.Count < 12)
                {
                    less12++;
                }
                if (CurrentPool.GetNumberOfAvaliableMembers() - game.Absences.Count + game.Pickups.Count < 14)
                {
                    less14++;
                }
                else
                {
                    full++;
                    if (game.WaitingList.Count > 0)
                    {
                        fullAndWaiting++;
                        // this.PoolStatTable.Caption = this.PoolStatTable.Caption + "|" + game.Date.ToShortDateString();
                    }
                }
            }
            foreach (Game game in CurrentPool.Games)
            {
                int pickups = 0;
                foreach (Pickup pickup in game.Pickups.Items)
                {
                    Dropin dropin = CurrentPool.Dropins.Find(player => player.Id == pickup.PlayerId);
                    if (dropin == null || !dropin.IsCoop)
                    {
                        pickups++;
                    }
                }

                if (CurrentPool.GetNumberOfAvaliableMembers() - game.Absences.Count + pickups < 12)
                {
                    less12WithoutCoop++;
                }

                if (CurrentPool.GetNumberOfAvaliableMembers() - game.Absences.Count + pickups < 14)
                {
                    less14WithoutCoop++;
                }
                else
                {
                    fullWithoutCoop++;
                    fullGames.Add(game);
                    foreach (Waiting waiting in game.WaitingList.Items)
                    {
                        Dropin dropin = CurrentPool.Dropins.Find(player => player.Id == waiting.PlayerId);
                        if (dropin == null || !dropin.IsCoop)
                        {
                            fullAndWaitingWithoutCoop++;
                            break;
                        }
                    }
                }
            }
            TableRow row = new TableRow();
            //Total
            TableCell cell = new TableCell();

            cell.Text = CurrentPool.Games.Count.ToString();
            row.Cells.Add(cell);
            //Less 12
            cell      = new TableCell();
            cell.Text = less12WithoutCoop.ToString();// + " / "+ less14.ToString();
            row.Cells.Add(cell);
            //Less 14
            cell      = new TableCell();
            cell.Text = (less14WithoutCoop - less12WithoutCoop).ToString();// + " / "+ less14.ToString();
            row.Cells.Add(cell);
            //Full no waiting
            cell      = new TableCell();
            cell.Text = fullWithoutCoop.ToString();// +"/ " + full.ToString();
            row.Cells.Add(cell);
            //Full and waiting
            cell      = new TableCell();
            cell.Text = fullAndWaitingWithoutCoop.ToString();// +" / " + fullAndWaiting.ToString();
            row.Cells.Add(cell);
            this.PoolStatTable.Rows.Add(row);
            //Fill ful game table
            int index = 1;

            foreach (Game fullGame in fullGames)
            {
                row = new TableRow();
                //Order
                cell      = new TableCell();
                cell.Text = (index++).ToString();
                row.Cells.Add(cell);
                //Date
                cell      = new TableCell();
                cell.Text = fullGame.Date.ToShortDateString();
                row.Cells.Add(cell);
                //Waiting list
                cell = new TableCell();
                String waitingListNames = null;
                foreach (Waiting waiting in fullGame.WaitingList.Items)
                {
                    Player player = Manager.FindPlayerById(waiting.PlayerId);
                    waitingListNames = waitingListNames == null ? player.Name : waitingListNames + "," + player.Name;
                }
                cell.Text = waitingListNames;
                row.Cells.Add(cell);
                this.FullTable.Rows.Add(row);
            }
        }