当前位置: 首页>>代码示例>>C#>>正文


C# DataClassesDataContext.GetAllTeamsByBracketRegionFaction方法代码示例

本文整理汇总了C#中DataClassesDataContext.GetAllTeamsByBracketRegionFaction方法的典型用法代码示例。如果您正苦于以下问题:C# DataClassesDataContext.GetAllTeamsByBracketRegionFaction方法的具体用法?C# DataClassesDataContext.GetAllTeamsByBracketRegionFaction怎么用?C# DataClassesDataContext.GetAllTeamsByBracketRegionFaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataClassesDataContext的用法示例。


在下文中一共展示了DataClassesDataContext.GetAllTeamsByBracketRegionFaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetCompStrings

        // Create string interpretations of teams (Assuming only US for now)
        // FORM OF: {TeamMember1Class}{TeamMember1Spec}{TeamMember2Class}{TeamMember2Spec}{TeamMember3Class}{TeamMember3Spec}
        private void SetCompStrings()
        {
            var db = new DataClassesDataContext();
            var teamMembers = from d in db.GetAllTeamsByBracketRegionFaction(m_RespModel.CurBracket.ToString(), (int)m_RespModel.CurRegion, (int)m_RespModel.CurFaction)
                              select new
                              {
                                  d.TeamID,
                                  d.Name,
                                  d.BlizzName,
                                  d.FactionID
                              };

            int playerCounter = 0;
            int prevTeamMembersTeamId = 0;
            string str = "";
            int teamIndex = -1;
            foreach (var tm in teamMembers)
            {
                // Avoiding the situation where the sql query returns a number of teammembers
                // that is not evenly divisible by the number of people on each team. The odd 
                // man/men/woman/women out can only be at the beginning of the result set I think.
                // TODO Probably best to fix stored proc. to only return full teams.
                if (prevTeamMembersTeamId == 0 || prevTeamMembersTeamId != tm.TeamID)
                {
                    str = "";
                    playerCounter = 0;
                }
                prevTeamMembersTeamId = (int)tm.TeamID;

                str += tm.Name + tm.BlizzName; // + BitToFaction(tm.FactionID);  Can maybe tack this onto the end for an icon

                // set a teamIndex if the current string matches a string already in the comps list
                teamIndex = -1;
                foreach (var comp in m_RespModel.TeamModel.Comps)
                {
                    if (str == comp.strComp) // if already in list 
                        teamIndex = m_RespModel.TeamModel.Comps.IndexOf(comp);
                }

                // If we have finished iterating through a team then add the team to the comp. list
                if (playerCounter % (int)GetBracketFromString() == (int)m_RespModel.CurBracket - 1)
                {
                    if (teamIndex == -1) // if this is a new team comp., then add it to both lists (classes & percentages)
                    {
                        m_RespModel.TeamModel.Comps.Add(new CompPercentModel() { strComp = str, Total = 1 });
                    }
                    else
                        m_RespModel.TeamModel.Comps[teamIndex].Total++;
                    str = "";
                }
                playerCounter++;
            }
        }
开发者ID:jmstefans,项目名称:FlavorOfTheMonth,代码行数:55,代码来源:HomeController.cs


注:本文中的DataClassesDataContext.GetAllTeamsByBracketRegionFaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。