Пример #1
0
        private IQueryable <SMSList> FetchSentMessages()
        {
            var ingroups = UserInGroups();
            var q        = from message in CurrentDatabase.SMSLists
                           where ingroups.Contains(message.SendGroupID)
                           select message;

            if (SentFilterStart != null)
            {
                q = q.Where(e => e.SendAt >= SentFilterStart);
            }
            if (SentFilterEnd != null)
            {
                q = q.Where(e => e.SendAt < SentFilterEnd.Value.AddHours(24));
            }
            if (SentFilterGroupId.ToInt() > 0)
            {
                q = q.Where(e => e.SendGroupID == SentFilterGroupId.ToInt());
            }
            if (SentFilterPeopleId.ToInt() > 0)
            {
                q = q.Where(e => e.SenderID == SentFilterPeopleId.ToInt());
            }
            if (SentFilterTitle.HasValue())
            {
                var titleid = SentFilterTitle.Substring(1);
                q = titleid.AllDigits()
                    ? q.Where(e => e.ReplyToId == titleid.ToInt())
                    : q.Where(e => e.Title.Contains(SentFilterTitle));
            }
            return(q);
        }
Пример #2
0
        public IEnumerable <SelectListItem> GroupMembers()
        {
            var q = from c in CurrentDatabase.SMSGroupMembers
                    where SentFilterGroupId.ToInt() == c.GroupID
                    select new SelectListItem
            {
                Value = c.User.PeopleId.ToString(),
                Text  = c.User.Name2,
            };
            var groupMembers = q.ToList();

            groupMembers.Insert(0, new SelectListItem {
                Text = "(select group member)", Value = "0"
            });
            return(groupMembers);
        }