예제 #1
0
        public IHttpActionResult QueryList(RemindCondition condition)
        {
            condition.ReceiverAccount = ClientCookie.UserCode;
            int totalSize;
            var data = Remind.Query(condition, out totalSize).ToList();

            return(Ok(new { data, totalSize }));
        }
예제 #2
0
        public static IQueryable <Remind> Query(RemindCondition searchCondition, out int totalSize)
        {
            var predicate = PredicateBuilder.True <Remind>();

            if (!string.IsNullOrEmpty(searchCondition.Title))
            {
                predicate = predicate.And(e => e.Title.Contains(searchCondition.Title));
            }

            if (!string.IsNullOrEmpty(searchCondition.SenderZHCN))
            {
                //var employeeList = Employee.Search(e => e.NameZHCN.Contains(searchCondition.SenderZHCN));
                //var employeeCodeList = employeeList.Select(e => e.Code).ToList();

                predicate = predicate.And(e => e.SenderNameZHCN.Contains(searchCondition.SenderNameZHCN));
            }

            if (!string.IsNullOrEmpty(searchCondition.SenderNameENUS))
            {
                //var employeeList = Employee.Search(e => e.NameZHCN.Contains(searchCondition.SenderZHCN));
                //var employeeCodeList = employeeList.Select(e => e.Code).ToList();

                predicate = predicate.And(e => e.SenderNameENUS.Contains(searchCondition.SenderNameENUS));
            }

            if (!string.IsNullOrEmpty(searchCondition.ReceiverAccount))
            {
                predicate = predicate.And(e => e.ReceiverAccount == searchCondition.ReceiverAccount);
            }

            //从多少页开始取数据
            var remindList = Search(predicate, e => e.CreateTime, searchCondition.PageIndex, searchCondition.PageSize,
                                    out totalSize, true);

            return(remindList);
        }