コード例 #1
0
        // Returns the queryable object to the DB.
        private static IQueryable <Person> getQueryable(
            DbRequest dbRequest,
            PersonDataContext dataContext)
        {
            var query = dataContext.Persons.AsQueryable();

            if (dbRequest.ForceMe &&
                CurrentMisparIshi.GetCurrentMisparIshi().Length > 0)
            {
                query = query.Where(person =>
                                    person.MisparIshi == CurrentMisparIshi.GetCurrentMisparIshi());
                return(query);
            }

            if (dbRequest.Tags > 1)
            {
                query = query.Where(person =>
                                    person.Tags % dbRequest.Tags == 0);
            }

            if (dbRequest.StandardInputTextValues.Count != 0)
            {
                // Note that WhereMatches is defined in WhereMatchesQuery.cs.
                query = query.WhereMatches(
                    dbRequest.StandardInputTextValues, dbRequest.IsOnlyNumbers);
            }
            return(query);
        }
コード例 #2
0
 public static IEnumerable <object> GetMe()
 {
     return(new PersonDataContext().Persons
            .Where(person =>
                   person.MisparIshi == CurrentMisparIshi.GetCurrentMisparIshi())
            .Select(person => new {
         name = person.GivenName,
         // TODO(Josh): Extract this is as it is common functionality.
         full_name = String.Format("{0} {1}", person.GivenName, person.Surname),
         mispar_ishi = person.MisparIshi,
         picture = person.Picture,
         activity_level = person.GetUserTagLevel(),
         department = person.Department
     })
            .ToList());
 }
コード例 #3
0
        public static void WriteAdminChange(string description)
        {
            if (!CurrentMisparIshi.IsAdmin())
            {
                return;
            }
            var message = String.Format(
                "The admin {0} made the following change: {1}.",
                CurrentMisparIshi.GetCurrentMisparIshi(),
                description);
            var newAdminChange = new AdminChange();

            newAdminChange.Description = message;
            newAdminChange.TimeAdded   = DateTime.Now;
            var dataContext = new LogDataContext();

            dataContext.AdminChanges.InsertOnSubmit(newAdminChange);
            dataContext.SubmitChanges();
        }
コード例 #4
0
 private bool getIsMe()
 {
     return(CurrentMisparIshi.GetCurrentMisparIshi().Equals(person.MisparIshi));
 }