コード例 #1
0
 public WeixinUserRS GetUsers(WeixinUserRQ rq)
 {
     if (rq == null || rq.pageIndex <= 0 || rq.pageSize <= 0)
     {
         return new WeixinUserRS {
                    total = 0, list = null
         }
     }
     ;
     return(_service.GetUsers(rq));
 }
コード例 #2
0
ファイル: UserService.cs プロジェクト: zhubin168/WebSite
        /// <summary>
        /// 理财师管理列表
        /// </summary>
        /// <param name="rq"></param>
        /// <returns></returns>

        public WeixinUserRS GetUsers(WeixinUserRQ rq)
        {
            var result = new WeixinUserRS {
                total = 0, list = null
            };
            var sql = string.Empty;//"select * from Wexin_User where 1=1 ";

            if (!string.IsNullOrWhiteSpace(rq.paraName))
            {
                sql += string.Format(" (Username like '%{0}%' or TelePhone like '%{0}%') ", rq.paraName);
            }
            var user  = Wexin_User.FindAll(sql, "Id desc", null, (rq.pageIndex - 1) * rq.pageSize, rq.pageSize);
            var query = (from a in user.ToList()
                         select new
            {
                a.City,
                a.Country,
                a.Create_time,
                a.Headimgurl,
                a.Id,
                a.LoginTime,
                a.Nickname,
                a.Open_Id,
                a.Password,
                a.Province,
                a.Remark,
                a.RoleId,
                a.Sex,
                a.Subscribe_time,
                a.TelePhone,
                a.Unionid,
                a.Username,
                a.IsPrice,
                a.Ident,
                a.CardNo,
                a.BankName,
                a.Company,
                a.CompCity,
                a.Department,
                a.Position
            });

            query        = query.OrderByDescending(q => q.Id).ThenByDescending(q => q.LoginTime);
            result.total = Wexin_User.FindAll(sql, null, null, 0, 0).Count;     //query.Count();
            if (result.total == 0)
            {
                return(result);
            }
            result.list = query.Select(a => new WeixinUserItemRS
            {
                //City = a.City,
                //Country = a.Country,
                //Create_time = a.Create_time,
                Headimgurl = a.Headimgurl,
                Id         = a.Id,
                //LoginTime = a.LoginTime,
                Nickname = a.Nickname,
                OpenId   = a.Open_Id,
                Password = a.Password,
                //Province = a.Province,
                Remark = a.Remark,
                RoleId = a.RoleId,
                Sex    = a.Sex,
                //Subscribe_time = a.Subscribe_time,
                TelePhone = a.TelePhone,
                //Unionid = a.Unionid,
                Username   = a.Username,
                IsPrice    = a.IsPrice,
                Ident      = a.Ident,
                CardNo     = a.CardNo,
                BankName   = a.BankName,
                Company    = a.Company,
                CompCity   = a.CompCity,
                Department = a.Department,
                Position   = a.Position
            }).ToList();
            return(result);
        }