示例#1
0
        public static User CheckUser(string _userName, string _password)
        {
            try
            {
                NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
                var dbUsers = from u in newAppsCnn.Sec_Users where u.UserLogin == _userName && u.Password == _password select u;
                if (dbUsers.Count() > 0)
                {
                    Sec_Users dbUser = dbUsers.First();
                    User user = new User();
                    user.FromDbUser(dbUser);
                    user.LoadUserMenu(dbUser);
                    return user;
                }
                else
                    return null;
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
示例#2
0
 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;
 }
示例#3
0
 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;
 }
示例#4
0
 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;
 }
示例#5
0
 public void LoadGroupUsers(Sec_Groups _dbGroup)
 {
     Users.Clear();
     foreach (var dbUser in _dbGroup.Sec_Users)
     {
         User user = new User();
         user.FromDbUser(dbUser);
         Users.Add(user);
     }
 }