public static User GetFirst() { NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString); var dbUser = newAppsCnn.Sec_Users.FirstOrDefault(); if (dbUser != null) { User user = new User(); user.FromDbUser(dbUser); user.LoadDbUserGroups(dbUser); return user; } else return null; }
public static User GetPrev(User _user) { if (_user == null) return GetFirst(); NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString); var dbUsers = from u in newAppsCnn.Sec_Users where u.UserID < _user.UserID orderby u.UserID descending select u; if (dbUsers.Count() > 0) { var dbUser = dbUsers.FirstOrDefault(); User user = new User(); user.FromDbUser(dbUser); user.LoadDbUserGroups(dbUser); return user; } else return null; }
public static User FindByUserID(int _userID) { NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString); var dbUsers = from u in newAppsCnn.Sec_Users where u.UserID == _userID select u; if (dbUsers.Count() > 0) { Sec_Users dbUser = dbUsers.First(); User user = new User(); user.FromDbUser(dbUser); user.LoadDbUserGroups(dbUser); return user; } else return null; }