Beispiel #1
0
        /// <summary>
        /// 获取公司列表
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string List(HttpContext context)
        {
            int    pageIndex = !string.IsNullOrEmpty(context.Request["pageindex"]) ? int.Parse(context.Request["pageindex"]) : 1;
            int    pageSize  = !string.IsNullOrEmpty(context.Request["pagesize"]) ? int.Parse(context.Request["pagesize"]) : 10;
            string keyWord   = context.Request["keyword"];

            System.Text.StringBuilder sbWhere = new System.Text.StringBuilder(string.Format(" WebSiteOwner='{0}'", bll.WebsiteOwner));
            if (!string.IsNullOrEmpty(keyWord))
            {
                sbWhere.AppendFormat(" And ComPanyName like '%{0}%'", keyWord);
            }
            int totalCount = bll.GetCount <CompanyInfo>(sbWhere.ToString());
            var sourceData = bll.GetLit <CompanyInfo>(pageSize, pageIndex, sbWhere.ToString());
            var list       = from p in sourceData
                             select new
            {
                company_id         = p.CompanyId,
                company_logo       = bll.GetImgUrl(p.CompanyLogo),
                company_name       = p.ComPanyName,
                company_tel        = p.LinkTel,
                company_natrue     = p.Nature,
                company_director   = p.Director,
                company_websiteurl = p.WebsiteUrl
            };

            var data = new
            {
                totalcount = totalCount,
                list       = list,//列表
            };

            return(ZentCloud.Common.JSONHelper.ObjectToJson(data));
        }