Esempio n. 1
0
        private PageHeader GetPageHeader(Group group)
        {
            List <BreadCrumbItem> list    = new List <BreadCrumbItem>();
            List <Button>         buttons = new List <Button>();
            string groupName;
            string subtitle = "";

            list.Add(new BreadCrumbItem()
            {
                Controller = "Home", Name = AppResource.StartPage, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Controller = "Administration", Name = AppResource.Administration, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Id = group.Id, Name = group.Name, Controller = "Groups"
            });

            if (group.IsPublicGroup)
            {
                foreach (var unit in (GeneralUnitType[])Enum.GetValues(typeof(GeneralUnitType)))
                {
                    buttons.Add(new Button()
                    {
                        Id = group.Id, Caption = string.Format(AppResource.AddUnit, unit.GetDisplayName()), Target = "_self", Controller = "Units", Action = "CreateGeneral", Type = unit.ToString()
                    });
                }
                groupName = "General";
            }
            else
            {
                foreach (var unit in (SportUnitType[])Enum.GetValues(typeof(SportUnitType)))
                {
                    buttons.Add(new Button()
                    {
                        Id = group.Id, Caption = string.Format(AppResource.AddUnit, unit.GetDisplayName()), Target = "_self", Controller = "Units", Action = "CreateSport", Type = unit.ToString()
                    });
                }
                subtitle  = AppResource.Sport;
                groupName = "Sport";
            }
            PageHeader pageHeader = new PageHeader()
            {
                BreadCrumbs = list,
                Buttons     = buttons,
                Title       = group.Name,
                Subtitle    = subtitle,
                GroupName   = groupName
            };

            return(pageHeader);
        }
        private PageHeader GetPageHeader(Team team)
        {
            List <BreadCrumbItem> list    = new List <BreadCrumbItem>();
            List <Button>         buttons = new List <Button>();

            if (team.Tournament.Status == TournamentStatus.OpenedForRegistration && team.Coach == User.Identity.Name)
            {
                buttons.Add(new Button()
                {
                    Target = "_self", Id = team.Id, Caption = AppResource.AddParticipant, Action = "Create", Controller = "Participants"
                });
            }

            list.Add(new BreadCrumbItem()
            {
                Controller = "Home", Name = AppResource.StartPage, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Controller = "Tournaments", Name = AppResource.Tournaments, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Id = team.Tournament.Id, Name = team.Tournament.Name, Controller = "Tournaments", Action = "Details"
            });
            list.Add(new BreadCrumbItem()
            {
                Id         = team.Id,
                Name       = team.Name,
                Controller = "Teams",
                Action     = "Details",
                Routes     = team.Tournament.Teams.ToDictionary(x => x.Id, y => string.Format("{0}, {1}", y.Name, y.City))
            });
            PageHeader pageHeader = new PageHeader()
            {
                BreadCrumbs = list,
                Title       = team.Name,
                Buttons     = buttons,
                Subtitle    = string.Format("{0}, {1}", team.City, team.Country.Translate()),
                Description = new List <string>()
                {
                    String.Format("<strong>{0}:</strong> <em>{1} ({2})</em>", AppResource.Coach, team.Coach.GetFullName(), team.CoachRanking.Translate()),
                    String.Format("<strong class='text-{0}'>{1}</strong>", team.ParticipationConfirmed?"success":"danger", team.ParticipationConfirmed?AppResource.ParticipationConfirmed:AppResource.WaitingForConfirmation)
                }
            };

            return(pageHeader);
        }
        private PageHeader GetPageHeader(Referee referee)
        {
            List <BreadCrumbItem> list    = new List <BreadCrumbItem>();
            List <Button>         buttons = new List <Button>();

            if (referee.Tournament.Organizer == User.Identity.Name && referee.Tournament.DateFrom > DateTime.Now)
            {
                buttons.Add(new Button()
                {
                    Target = "_self", Id = referee.Id, Caption = AppResource.AddTimeline, Action = "Create", Controller = "Timelines"
                });
            }
            buttons.Add(new Button()
            {
                Target = "_blank", Id = referee.Id, Caption = "Display", Action = "DisplayFullHD", Controller = "Referees"
            });
            list.Add(new BreadCrumbItem()
            {
                Controller = "Home", Name = AppResource.StartPage, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Controller = "Tournaments", Name = AppResource.Tournaments, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Id = referee.Tournament.Id, Name = referee.Tournament.Name, Controller = "Tournaments", Action = "Details"
            });
            list.Add(new BreadCrumbItem()
            {
                Id         = referee.Id,
                Name       = referee.Position.Translate(),
                Controller = "Referees",
                Action     = "Details",
                Routes     = referee.Tournament.Referees.ToDictionary(x => x.Id, y => y.Position.Translate())
            });

            PageHeader pageHeader = new PageHeader()
            {
                BreadCrumbs = list,
                Title       = referee.Position.Translate(),
                Subtitle    = referee.RefereeEmail.GetFullName(),
                Buttons     = buttons
            };

            return(pageHeader);
        }
        private PageHeader GetPageHeader()
        {
            List <BreadCrumbItem> list    = new List <BreadCrumbItem>();
            List <Button>         buttons = new List <Button>();
            string title = "";

            list.Add(new BreadCrumbItem()
            {
                Controller = "Home", Name = AppResource.StartPage, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Controller = "Administration", Name = AppResource.Administration, Action = "Index"
            });

            buttons.Add(new Button()
            {
                Target = "_self", Caption = AppResource.AddGroup, Action = "Create", Controller = "Groups"
            });
            buttons.Add(new Button()
            {
                Target = "_self", Caption = "Add report", Action = "Create", Controller = "Reports"
            });
            buttons.Add(new Button()
            {
                Target = "_self", Caption = "Manage report", Action = "Manage", Controller = "Reports"
            });
            title = AppResource.Administration;

            PageHeader pageHeader = new PageHeader()
            {
                Title       = title,
                Buttons     = buttons,
                BreadCrumbs = list
            };

            return(pageHeader);
        }
Esempio n. 5
0
        private PageHeader GetPageHeader(Unit unit)
        {
            List <BreadCrumbItem> list    = new List <BreadCrumbItem>();
            List <Button>         buttons = new List <Button>();
            string Subtitle;

            var descList = new List <string>();

            list.Add(new BreadCrumbItem()
            {
                Controller = "Home", Name = AppResource.StartPage, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Controller = "Home", Name = AppResource.Administration, Action = "Details"
            });

            var sportUnit = sportUnitService.GetById(unit.Id);

            if (sportUnit != null)
            {
                list.Add(new BreadCrumbItem()
                {
                    Id         = sportUnit.SportGroup_Id,
                    Name       = sportUnit.SportGroup.Name,
                    Controller = "Groups",
                    Action     = "Details"
                });

                list.Add(new BreadCrumbItem()
                {
                    Id         = unit.Id,
                    Name       = unit.Name,
                    Controller = "Units",
                    Routes     = sportUnit.SportGroup.SportUnits.Where(a => a.SportType == sportUnit.SportType).ToDictionary(x => x.Id, y => y.Name)
                });
                Subtitle = sportUnit.SportType.GetDisplayName();
            }
            else
            {
                var generalUnit = generalUnitService.GetById(unit.Id);
                list.Add(new BreadCrumbItem()
                {
                    Id         = generalUnit.GeneralGroup_Id,
                    Name       = generalUnit.GeneralGroup.Name,
                    Controller = "Groups",
                    Action     = "Details"
                });

                list.Add(new BreadCrumbItem()
                {
                    Id         = unit.Id,
                    Name       = unit.Name,
                    Controller = "Units",
                    Routes     = generalUnit.GeneralGroup.GeneralUnits.Where(a => a.GeneralType == generalUnit.GeneralType).ToDictionary(x => x.Id, y => y.Name)
                });
                Subtitle = generalUnit.GeneralType.GetDisplayName();
            }

            buttons.Add(new Button()
            {
                Target = "_self", Id = unit.Id, Caption = AppResource.AddTranslation, Action = "Create", Controller = "Translations"
            });

            if (unit.Image != null)
            {
                descList.Add(string.Format("<div class='thumbnail div-max-width'><img alt='{0}' src='/en/Images/Details/{1}?width=300'/></div>", unit.Name, unit.Id));
                buttons.Add(new Button()
                {
                    Target = "_self", Id = unit.Id, Caption = AppResource.ChangeImage, Action = "Edit", Controller = "Images"
                });
                buttons.Add(new Button()
                {
                    Target = "_self", Id = unit.Id, Caption = AppResource.DeleteImage, Action = "Delete", Controller = "Images"
                });
            }
            else
            {
                buttons.Add(new Button()
                {
                    Target = "_self", Id = unit.Id, Caption = AppResource.AddImage, Action = "Create", Controller = "Images"
                });
            }

            PageHeader pageHeader = new PageHeader()
            {
                BreadCrumbs = list,
                Title       = unit.Name,
                Buttons     = buttons,
                Description = descList,
                Subtitle    = Subtitle
            };

            return(pageHeader);
        }
Esempio n. 6
0
        private PageHeader GetPageHeader(Tournament tournament)
        {
            List <BreadCrumbItem> list        = new List <BreadCrumbItem>();
            List <Button>         buttons     = new List <Button>();
            List <string>         description = new List <string>();
            string title;
            string subtitle;

            list.Add(new BreadCrumbItem()
            {
                Controller = "Home", Name = AppResource.StartPage, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Controller = "Tournaments", Name = AppResource.Tournaments, Action = "Index"
            });

            if (tournament != null)
            {
                if (tournament.Status == TournamentStatus.OpenedForRegistration)
                {
                    buttons.Add(new Button()
                    {
                        Target = "_self", Id = tournament.Id, Caption = AppResource.AddTeam, Action = "Create", Controller = "Teams"
                    });
                }

                if (tournament.Organizer == User.Identity.Name)
                {
                    buttons.Add(new Button()
                    {
                        Target = "_self", Id = tournament.Id, Caption = AppResource.AddCategory, Action = "Create", Controller = "Categories"
                    });
                    buttons.Add(new Button()
                    {
                        Target = "_self", Id = tournament.Id, Caption = AppResource.AddReferee, Action = "Create", Controller = "Referees"
                    });
                    buttons.Add(new Button()
                    {
                        Target = "devider", Id = tournament.Id
                    });
                    buttons.Add(new Button()
                    {
                        Target = "ajax", Id = tournament.Id, Caption = AppResource.GenerateTable, Action = "CreateTable", Controller = "Tournaments"
                    });
                    if (User.IsInRole("Admin"))
                    {
                        buttons.Add(new Button()
                        {
                            Target = "_self", Id = tournament.Id, Caption = "Prepare sample data", Action = "SampleData", Controller = "Tournaments"
                        });
                    }
                    //if (rep.Count() > 0)
                    //{
                    //    buttons.Add(new Button() { Target = "dropdown-header", Id = (int)id, Caption = AppResource.Reports });
                    //    buttons.AddRange(rep.Select(x => new Button() { Target = "_self", Controller = "Tournaments", Action = "Report", Type = x.FileName, Caption = x.Name, Id = (int)id }));
                    //}
                }

                list.Add(new BreadCrumbItem()
                {
                    Controller = "Tournaments", Id = tournament.Id, Name = tournament.Name, Action = "Details"
                });
                title    = tournament.Name;
                subtitle = string.Format("{0}, {1}", tournament.City, tournament.Country.Translate());

                description.Add(string.Format("<strong>{0}:</strong> <em>{1:d} - {2:d}</em>", AppResource.Duration, tournament.DateFrom, tournament.DateTo));
                description.Add(string.Format("<strong>{0}:</strong> <em>{1}</em>", AppResource.Organizer, tournament.Organizer.GetFullName()));
            }
            else
            {
                title    = AppResource.Tournaments;
                subtitle = "";
                buttons.Add(new Button()
                {
                    Target = "_self", Caption = AppResource.AddTournament, Action = "Create", Controller = "Tournaments"
                });
            }

            PageHeader pageHeader = new PageHeader()
            {
                BreadCrumbs = list,
                Buttons     = buttons,
                Title       = title,
                Subtitle    = subtitle,
                Description = description
            };

            return(pageHeader);
        }
Esempio n. 7
0
        private PageHeader GetPageHeader(Category category)
        {
            List <BreadCrumbItem> list    = new List <BreadCrumbItem>();
            List <Button>         buttons = new List <Button>();

            var descList = new List <string>();

            list.Add(new BreadCrumbItem()
            {
                Controller = "Home", Name = AppResource.StartPage, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Controller = "Tournaments", Name = AppResource.Tournaments, Action = "Index"
            });
            list.Add(new BreadCrumbItem()
            {
                Id = category.Tournament.Id, Name = category.Tournament.Name, Controller = "Tournaments", Action = "Details"
            });
            list.Add(new BreadCrumbItem()
            {
                Id         = category.Id,
                Name       = String.Format("{0} [{1}] [{2}]", category.Gender.GetDisplayName(), category.Age, category.Weight),
                Controller = "Categories",
                Action     = "Details",
                Routes     = category.Tournament.Categories.ToDictionary(x => x.Id, y => String.Format("{0} [{1}] [{2}]", y.Gender.GetDisplayName(), y.Age, y.Weight))
            });

            descList.Add(string.Format("<strong>{0}:</strong> <em>{1}</em>", AppResource.Description, category.OneThirdPlace ? AppResource.OneThirdPlace : AppResource.TwoThirdPlaces));

            var finalFight = fightService.GetWithFilter(x => x.CategoryId == category.Id && x.Level.Description.Equals("level_1") && x.Fighters.Any(s => s.IsWinner)).SingleOrDefault();

            if (finalFight != null)
            {
                var winner  = finalFight.Fighters.Where(x => x.IsWinner).Single();
                var winner2 = finalFight.Fighters.Where(x => !x.IsWinner).Single();
                descList.Add(GetWinnerListItem(1, winner));
                descList.Add(GetWinnerListItem(2, winner2));
            }

            if (category.OneThirdPlace)
            {
                var thirdPlaceFight = fightService.GetWithFilter(filter: x => x.CategoryId == category.Id && x.Level.Description.Equals("level_0") && x.Fighters.Any(s => s.IsWinner)).SingleOrDefault();
                if (thirdPlaceFight != null)
                {
                    var winner3 = thirdPlaceFight.Fighters.Where(x => x.IsWinner).Single();
                    descList.Add(GetWinnerListItem(3, winner3));
                }
            }
            else
            {
                var semiFinalFights = fightService.GetWithFilter(filter: x => x.CategoryId == category.Id && x.Level.Description.Equals("level_2") && x.Fighters.Any(s => s.IsWinner));
                foreach (Fight semiFinalFight in semiFinalFights)
                {
                    var winner3 = semiFinalFight.Fighters.Where(x => x.IsWinner).Single();

                    descList.Add(GetWinnerListItem(3, winner3));
                }
            }
            PageHeader pageHeader = new PageHeader()
            {
                BreadCrumbs = list,
                Title       = category.Gender.GetDisplayName(),
                Subtitle    = string.Format("[{0}] [{1}]", category.Age, category.Weight),
                Description = descList
            };

            return(pageHeader);
        }