private List <PersonGroup> GetListDataBytag(string strID, List <SysAddressBookMember> userInfos)
        {
            var targetList = new List <PersonGroup>();

            if (!string.IsNullOrEmpty(strID))
            {
                var result       = WeChatCommonService.GetTagById(this.AccountManageID, int.Parse(strID));// MailListApi.GetTagMember(GetToken(), int.Parse(strID));
                var userlst      = result.userlist;
                var userIds      = result.userlist.Select(u => u.userid).ToList();
                var allDeptList  = WeChatCommonService.lstDepartment(this.AccountManageID);// MailListApi.GetDepartmentList(GetToken()).department;
                var userInfosNew = userInfos.Where(u => userIds.Contains(u.UserId) && u.DeleteFlag != 1);
                var partylst     = new List <DepartmentList>();
                if (result.partylist != null)
                {
                    partylst = allDeptList.Where(a => result.partylist.Contains(a.id)).ToList();
                }

                //allDeptList

                targetList.AddRange(userInfosNew.Select(a => new PersonGroup {
                    Type = "Person", WeixinId = a.UserId, WeixinName = a.UserName
                }));
                targetList.AddRange(partylst.Select(a => new PersonGroup {
                    Type = "Group", WeixinId = a.id.ToString(), WeixinName = a.name
                }));
                return(targetList);
            }
            return(targetList);
        }
        public List <TagView> GetListDataBytag(int iPage, int iCount, ref int iTotal)
        {
            string strID = Request["TagId"];
            string strSearchCondition = Request["SearchCondition"];

            if (!string.IsNullOrEmpty(strID))
            {
                var result      = WeChatCommonService.GetTagById(AccountManageID, int.Parse(strID));// MailListApi.GetTagMember(GetToken(), int.Parse(strID));
                var userlst     = result.userlist;
                var userIds     = result.userlist.Select(u => u.userid).ToList();
                var allDeptList = WeChatCommonService.lstDepartment(AccountManageID); //MailListApi.GetDepartmentList(GetToken()).department;
                var userInfos   = _addressBookService.Repository.Entities.Where(u => userIds.Contains(u.UserId) && u.DeleteFlag != 1).ToList();
                if (!string.IsNullOrEmpty(strSearchCondition))
                {
                    userInfos = userInfos.Where(x => x.UserId.IndexOf(strSearchCondition.Trim(), StringComparison.OrdinalIgnoreCase) >= 0 ||
                                                x.UserName.IndexOf(strSearchCondition.Trim(), StringComparison.OrdinalIgnoreCase) >= 0 ||
                                                (!string.IsNullOrEmpty(x.Email) && x.Email.IndexOf(strSearchCondition.Trim(), StringComparison.OrdinalIgnoreCase) >= 0) ||
                                                (!string.IsNullOrEmpty(x.Mobile) && x.Mobile.IndexOf(strSearchCondition.Trim(), StringComparison.OrdinalIgnoreCase) >= 0) ||
                                                (!string.IsNullOrEmpty(x.EmployeeNo) && x.EmployeeNo.IndexOf(strSearchCondition.Trim(), StringComparison.OrdinalIgnoreCase) >= 0)).ToList();
                }
                var partylst = new List <DepartmentList>();
                if (result.partylist != null)
                {
                    partylst = allDeptList.Where(a => result.partylist.Contains(a.id)).ToList();
                    if (!string.IsNullOrEmpty(strSearchCondition))
                    {
                        partylst = partylst.Where(x => x.id.ToString().IndexOf(strSearchCondition.Trim(), StringComparison.OrdinalIgnoreCase) >= 0 ||
                                                  x.name.IndexOf(strSearchCondition.Trim(), StringComparison.OrdinalIgnoreCase) >= 0).ToList();
                    }
                }
                //allDeptList
                var targetList = new List <TagView>();
                targetList.AddRange(userInfos.Select(a => new TagView {
                    Type = "Person", WeixinId = a.UserId, WeixinName = a.UserName, Department = GetDepartmentName(allDeptList, a.Department)
                }));
                targetList.AddRange(partylst.Select(a => new TagView {
                    Type = "Group", WeixinId = a.id.ToString(), WeixinName = a.name, Department = GetDepartmentPath(allDeptList, a.id)
                }));

                iTotal = targetList.Count();
                return(targetList.Skip((iPage - 1) * iCount).Take(iCount).ToList());
            }

            return(null);
        }