Exemplo n.º 1
0
        /// <summary>
        /// 分页查询客户信息
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <CustomerEntity> GetCustomerList(CustomerEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID);
            if (!entity.CusNum.IsEmpty())
            {
                entity.And("CusNum", ECondition.Like, "%" + entity.CusNum + "%");
            }
            if (!entity.CusName.IsEmpty())
            {
                entity.And("CusName", ECondition.Like, "%" + entity.CusName + "%");
            }
            if (!entity.Phone.IsEmpty())
            {
                entity.And("Phone", ECondition.Like, "%" + entity.Phone + "%");
            }
            if (entity.CusType > 0)
            {
                entity.And(a => a.CusType == entity.CusType);
            }
            int rowCount = 0;
            List <CustomerEntity> listResult = this.Customer.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查询客户地址分页列表
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <CusAddressEntity> GetList(CusAddressEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            entity.Where(a => a.CompanyID == this.CompanyID)
            .And(a => a.IsDelete == (int)EIsDelete.NotDelete);

            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);
            if (entity.CusType > 0)
            {
                customer.And(item => item.CusType == entity.CusType);
            }
            if (!entity.Address.IsEmpty())
            {
                entity.And("Address", ECondition.Like, "%" + entity.Address + "%");
            }
            if (!entity.Phone.IsEmpty())
            {
                entity.And("Phone", ECondition.Like, "%" + entity.Phone + "%");
            }
            if (!entity.CusNum.IsEmpty())
            {
                customer.And("CusNum", ECondition.Like, "%" + entity.CusNum + "%");
            }
            if (!entity.CusName.IsEmpty())
            {
                customer.And("CusName", ECondition.Like, "%" + entity.CusName + "%");
            }

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

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