Example #1
0
        private void BindTeamData(Guid guid)
        {
            var rltList = RelationLeagueTeam.QueryByLeagueGuid(guid);

            var list = new List <Team>();

            if (rltList != null && rltList.Count > 0)
            {
                foreach (var rlt in rltList)
                {
                    var t = Team.Cache.Load(rlt.TeamGuid);

                    if (t != null)
                    {
                        list.Add(t);
                    }
                }

                ddlTeam.DataSource     = list.OrderBy(x => x.TeamEnglishName);
                ddlTeam.DataTextField  = "TeamDisplayName";
                ddlTeam.DataValueField = "ID";
                ddlTeam.DataBind();

                ddlTeam.Visible = true;
            }
            else
            {
                ddlTeam.Items.Clear();
                ddlTeam.Visible = false;
            }

            ddlTeam.Items.Insert(0, new ListItem("--请选择对阵球队--", string.Empty));
        }
Example #2
0
        private void BindGroupTeam(Guid leagueGuid)
        {
            var rlts = RelationLeagueTeam.QueryByLeagueGuid(leagueGuid);

            var query = from rlt in rlts
                        join t in Team.Cache.TeamList on rlt.TeamGuid equals t.ID
                        orderby t.TeamEnglishName
                        select t;

            lbLeagueTeam.DataSource     = query;
            lbLeagueTeam.DataTextField  = "TeamDisplayName";
            lbLeagueTeam.DataValueField = "ID";
            lbLeagueTeam.DataBind();

            lbLeagueTeam.Visible = true;

            #region Set lbLeagueTeam Selected Items

            if (GroupGuid != Guid.Empty)
            {
                var rgts = RelationGroupTeam.QueryByGroupGuid(GroupGuid);

                foreach (ListItem item in lbLeagueTeam.Items)
                {
                    if (rgts.Exists(x => x.TeamGuid.ToString() == item.Value))
                    {
                        item.Selected = true;
                    }
                }
            }

            #endregion
        }
Example #3
0
        private void BindTeamData(Guid guid)
        {
            var rltList = RelationLeagueTeam.QueryByLeagueGuid(guid);

            var list = new List <Team>();

            if (rltList != null && rltList.Count > 0)
            {
                list.AddRange(rltList.Select(rlt => Team.Cache.Load(rlt.TeamGuid)).Where(t => t != null));

                ddlTeam.DataSource     = list.OrderBy(x => x.TeamEnglishName);
                ddlTeam.DataTextField  = "TeamDisplayName";
                ddlTeam.DataValueField = "ID";
                ddlTeam.DataBind();
            }
            else
            {
                ddlTeam.Items.Clear();
            }

            ddlTeam.Items.Insert(0, new ListItem("--请选择对阵球队--", string.Empty));
        }