Ejemplo n.º 1
0
        public List <CustomerTransactionEntity> GetList(Pagination pagination, string keyword, DateTime?beginTime, DateTime?endTime, bool?tranStatus)
        {
            var expression = ExtLinq.True <CustomerTransactionEntity>();
            //非管理员只可查看自己的客户
            var loginInfo = OperatorProvider.Provider.GetCurrent();

            if (!"admin".Equals(loginInfo.UserCode))
            {
                expression = expression.And(t => t.SalesmanCode.Contains(loginInfo.UserCode));
            }
            if (beginTime != null)
            {
                expression = expression.And(t => t.BillDate >= beginTime);
            }
            if (endTime != null)
            {
                DateTime?e = endTime.Value.AddDays(1);
                expression = expression.And(t => t.BillDate < endTime);
            }
            if (tranStatus != null)
            {
                expression = expression.And(t => t.TradStatus == tranStatus);
            }
            if (!string.IsNullOrEmpty(keyword))
            {
                expression = expression.And(t => t.CustomerName.Contains(keyword));
                expression = expression.Or(t => t.Salesman.Contains(keyword));
            }
            return(service.FindList(expression, pagination));
        }
Ejemplo n.º 2
0
        public List <CustomerEntity> GetList(Pagination pagination, string keyword, bool?tranStatus)
        {
            var    lst         = tranService.FindList("select * from Buz_CustomerTransaction");
            string customerids = string.Empty;

            foreach (var item in lst)
            {
                if (!customerids.Contains(item.CustomerId))
                {
                    customerids += item.CustomerId + ",";
                }
            }

            var expression = ExtLinq.True <CustomerEntity>();
            //非管理员只可查看自己的客户
            var loginInfo = OperatorProvider.Provider.GetCurrent();

            if (!"admin".Equals(loginInfo.UserCode))
            {
                expression = expression.And(t => t.SalesmanCode.Contains(loginInfo.UserCode));
            }
            if (!string.IsNullOrEmpty(keyword))
            {
                expression = expression.And(t => t.Name.Contains(keyword));
                expression = expression.Or(t => t.Telphone.Contains(keyword));
                expression = expression.Or(t => t.Address.Contains(keyword));
            }
            if (tranStatus != null)
            {
                if (tranStatus == true)
                {
                    expression = expression.And(t => customerids.Contains(t.Id));
                }
                else
                {
                    expression = expression.And(t => !customerids.Contains(t.Id));
                }
            }
            return(service.FindList(expression, pagination));
        }