DefconDotNet

Untitled

Dec 14th, 2012
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.             Ensure.Argument.NotNull(template);
  3.            
  4.             var users = _userRepo
  5.                 .AllIncluding(u => u.SentEmails);
  6.  
  7.             switch (template.QueueAfter)
  8.             {
  9.                 case QueueAfter.RegistrationDate:
  10.                     users = users.Where(ud => ud.RegisteredOn <= DateTime.Today.AddDays(template.QueueDays));
  11.                     break;
  12.                 default:
  13.                     throw new ArgumentOutOfRangeException();
  14.             }
  15.            
  16.             var asc = UserBase.GetAccountStateCode(template.QueueAccountState);
  17.             return users
  18.                 .Where(u => u.AccountStateCode == asc
  19.                          && u is Customer
  20.                          && !u.SentEmails.Select(s => s.EmailTemplateId).Contains(template.Id))
  21.                     .Select(user => user as Customer)
  22.                     .ToList();
Advertisement
Add Comment
Please, Sign In to add comment