Exemplo n.º 1
0
        /// <summary>
        /// 根据关键字搜索客户信息
        /// </summary>
        /// <param name="KeyWord"></param>
        /// <param name="TopSize"></param>
        /// <returns></returns>
        public List <CusAddressEntity> SearchCustomer(string KeyWord, int TopSize)
        {
            CusAddressEntity entity = new CusAddressEntity();

            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            entity.Where(a => a.CompanyID == this.CompanyID);

            CustomerEntity customer = new CustomerEntity();

            customer.Include(a => new { CusNum = a.CusNum, CusName = a.CusName, CusType = a.CusType, Fax = a.Fax, Email = a.Email });

            entity.Left <CustomerEntity>(customer, new Params <string, string>()
            {
                Item1 = "CustomerSN", Item2 = "SnNum"
            });
            customer.And(a => a.IsDelete == (int)EIsDelete.NotDelete);

            PageInfo pageInfo = new PageInfo()
            {
                PageIndex = 1, PageSize = 10
            };

            customer.AndBegin <CustomerEntity>()
            .Or <CustomerEntity>("CusNum", ECondition.Like, "%" + KeyWord + "%")
            .Or <CustomerEntity>("CusName", ECondition.Like, "%" + KeyWord + "%")
            .Or <CustomerEntity>("Phone", ECondition.Like, "%" + KeyWord + "%")
            .End();

            int rowCount = 0;
            List <CusAddressEntity> listResult = this.CusAddress.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }