Пример #1
0
        /// <summary>
        /// 通过群组号获取群组人员ID
        /// </summary>
        /// <param name="groupId">群组ID</param>
        /// <returns>群组Friend列表</returns>
        public FriendList LoadFriendListByGroupId(int groupId)
        {
            this.list = new FriendList();
            DbOperate dbo = new DbOperate();
            dbo.TableName = FriendsOperator.TABLENAME;

            SqlCommand com = new SqlCommand();
            com.CommandText = string.Format("select * from Friends where groupId={0}",groupId);

            DataTable table = dbo.Select(com).Tables[0];
            foreach(DataRow row in table.Rows)
            {
                FriendItem item = new FriendItem();
                item.Id = Convert.ToInt32(row["id"]);
                item.HostId = Convert.ToInt32(row["HostId"]);
                item.FriendId = Convert.ToInt32(row["FriendId"]);
                item.FriendShipId = Convert.ToInt32(row["FriendShipPolicy"]);
                if (row["GroupId"] != null)
                {
                    item.GroupId = Convert.ToInt32(row["GroupId"]);
                }
                else
                {
                    item.GroupId = 0;
                }
                this.list.Add(item);
            }

            return this.list.Length >= 1 ? this.list : null;
        }
Пример #2
0
 public FriendsOperator()
 {
     this.list = new FriendList();
 }