Example #1
0
        /// <summary>
        /// 根据客户名称获取客户集合
        /// </summary>
        /// <param name="serviceSpaceId">服务空间id</param>
        /// <param name="name">客户名称</param>
        /// <param name="totalNum">记录条数</param>
        /// <returns>客户集合</returns>
        public List <Customer> GetAllByName(string serviceSpaceId, string name, out int totalNum)
        {
            totalNum = 0;
            //参数验证
            if (string.IsNullOrEmpty(name))
            {
                ErrorMsg = ErrorCode.ParameterNull;
                return(null);
            }

            List <Customer>   customers          = null;
            List <DataEntity> customerEntityList = _customerProvider.GetAllByName(serviceSpaceId, name, out totalNum);

            if (customerEntityList != null && customerEntityList.Count > 0)
            {
                customers = new List <Customer>();
                Customer customer = null;
                foreach (DataEntity customerEntity in customerEntityList)
                {
                    customer = GetCustomerFromEntity(customerEntity);
                    customers.Add(customer);
                }
            }

            return(customers);
        }