using System; using System.Collections.Generic; using System.Linq; using System.Linq.Dynamic; using System.Text; using Domain; using Dao; namespace Service.Implement { public class ManualVisitManager : GenericManagerBase, IManualVisitManager { public IList LoadAllByPage(out long total, int page, int rows, string order, string sort, DateTime? startDate, DateTime? endDate) { var list = CurrentRepository.LoadAll(); if (startDate.HasValue && endDate.HasValue) { list = list.Where(r => r.CreatedDate >= startDate && r.CreatedDate <= endDate); } total = list.LongCount(); list = list.OrderBy(sort + " " + order); list = list.Skip((page - 1) * rows).Take(rows); return list.ToList(); } /// /// 验证验证码是否正确 /// /// /// /// public bool ValidateCode(string phoneNumber, string validateCode) { ManualVisit item = CurrentRepository.LoadAll() .Where(r => r.PhoneNumber == phoneNumber && r.ValidateCode == validateCode) .OrderByDescending(r => r.ID) .FirstOrDefault(); if (item != null) { return true; } else { return false; } } } }