コード例 #1
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ChampionshipResultsViewModel viewModel = (ChampionshipResultsViewModel)item;

            if (viewModel.Item.Category == ChampionshipWinningCategories.Druzynowa)
            {
                return(GroupTemplate);
            }
            var template = CustomerTemplate;

            return(template);
        }
コード例 #2
0
        protected override void BuildDetails(StringBuilder builder)
        {
            foreach (IGrouping <ChampionshipCategoryDTO, ChampionshipResultItemDTO> dto in championship.Results.GroupBy(x => x.Category).OrderBy(x => x.Key.Category))
            {
                var mainItem = new ChampionshipResultsViewModel(dto);

                addGroupTable(builder, mainItem.Category, delegate(StringBuilder stringBuilder)
                {
                    if (dto.Key.Category != ChampionshipWinningCategories.Druzynowa)
                    {
                        stringBuilder.AppendFormat("<TR><TD><table width='100%' height='100%' style=' solid black;border-collapse:collapse;' Border='1' RULES='COLS' FRAME='VOID'><TR><TH class='dayHeader'></TH><TH class='dayHeader'>{0}</TH>", InstructorStrings.ChampionshipDataGrid_Grid_Customer);
                        stringBuilder.AppendFormat("<TH class='dayHeader'  >{0}</TH>", InstructorStrings.ChampionshipView_Grid_Year);
                        stringBuilder.AppendFormat("<TH class='dayHeader'  >{0}</TH>", InstructorStrings.ChampionshipDataGrid_Grid_Team);
                        stringBuilder.AppendFormat("<TH class='dayHeader' >{0}</TH>", InstructorStrings.ChampionshipView_Grid_Weight);

                        if (this.PrintEntriesComment)
                        {
                            stringBuilder.AppendFormat("<TH class='commentColumn' >{0}</TH>", InstructorStrings.ChampionshipDataGrid_Grid_Comment);
                        }

                        stringBuilder.AppendFormat("<TH class='dayHeader'  colspan='3'>{0}</TH>", ExercisesReposidory.Instance.BenchPress.Name);
                        if (championship.ChampionshipType == ChampionshipType.Trojboj)
                        {
                            stringBuilder.AppendFormat("<TH class='dayHeader'  colspan='3'>{0}</TH>", ExercisesReposidory.Instance.Deadlift.Name);
                            stringBuilder.AppendFormat("<TH class='dayHeader'  colspan='3'>{0}</TH>", ExercisesReposidory.Instance.Sqad.Name);
                        }
                        stringBuilder.AppendFormat("<TH class='dayHeader' >{0}</TH>", InstructorStrings.ChampionshipView_Grid_Total);
                        stringBuilder.AppendFormat("<TH class='dayHeader' >{0}</TH></TR>", InstructorStrings.ChampionshipView_Grid_Wilks);

                        stringBuilder.Append("<TR><TH/><TH/><TH/><TH/><TH/>");
                        if (this.PrintEntriesComment)
                        {
                            stringBuilder.Append("<TH class='commentColumn' ></TH>");
                        }
                        stringBuilder.Append("<TH>1</TH><TH>2</TH><TH>3</TH>");
                        if (championship.ChampionshipType == ChampionshipType.Trojboj)
                        {
                            stringBuilder.Append("<TH >1</TH><TH>2</TH><TH>3</TH>");
                            stringBuilder.Append("<TH >1</TH><TH>2</TH><TH>3</TH>");
                        }
                        stringBuilder.Append("<TH/><TH/></TR>");
                        if (dto.Key.Type == ChampionshipCategoryType.Weight)
                        {
                            var items = mainItem.Items.OrderBy(x => x.ResultItem.Value).GroupBy(x => x.WeightCategory);
                            foreach (IGrouping <string, ChampionshipResultItemViewModel> grouping in items)
                            {
                                bool alt = false;
                                stringBuilder.AppendFormat("<TR><TD/><TD class='dayHeader'><b class='doNotTranslate'>{0}</b></TD><TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/>", grouping.Key);
                                if (this.PrintEntriesComment)
                                {
                                    stringBuilder.Append("<TD class='dayHeader'/>");
                                }
                                if (championship.ChampionshipType == ChampionshipType.Trojboj)
                                {
                                    stringBuilder.Append("<TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/><TD class='dayHeader'/>");
                                }
                                foreach (var itemViewModel in grouping)
                                {
                                    buildCustomerItem(stringBuilder, itemViewModel, alt);
                                    alt = !alt;
                                }
                            }
                        }
                        else
                        {
                            bool alt = false;
                            foreach (var itemViewModel in mainItem.Items)
                            {
                                buildCustomerItem(stringBuilder, itemViewModel, alt);
                                alt = !alt;
                            }
                        }
                        stringBuilder.AppendLine("</TABLE></TD></TR>");
                    }
                    else
                    {
                        stringBuilder.AppendFormat("<TR><TD><table width='100%' height='100%' style=' solid black;border-collapse:collapse;' Border='1' RULES='COLS' FRAME='VOID'><TR><TH class='dayHeader'></TH><TH class='dayHeader'>{0}</TH>", InstructorStrings.ChampionshipDataGrid_Grid_Team);
                        stringBuilder.AppendFormat("<TH class='dayHeader' >{0}</TH></TR>", InstructorStrings.ChampionshipView_Grid_TeamPoints);
                        bool alt = false;
                        foreach (var itemViewModel in mainItem.Items)
                        {
                            stringBuilder.AppendFormat("<TR class='{1}'><TD width='20' class='doNotTranslate'>{0}</TD>", itemViewModel.Position, alt && UseAlternateRows ? "exercisesAlt" : "exercises");
                            stringBuilder.AppendFormat("<TD class='doNotTranslate' align='center'>{0}</TD>", itemViewModel.FullName);
                            stringBuilder.AppendFormat("<TD class='doNotTranslate' align='center'>{0}</TD></TR>", itemViewModel.Wilks);
                            alt = !alt;
                        }
                        stringBuilder.AppendLine("</TABLE></TD></TR>");
                    }
                });
            }
        }