private void frmUsers_DataMove(object sender, MoveCommandEnum _moveCommand) { BackOfficeBL.Security.User user = null; switch (_moveCommand) { case MoveCommandEnum.MoveFirst: user = BackOfficeBL.Security.User.GetFirst(); break; case MoveCommandEnum.MoveLast: user = BackOfficeBL.Security.User.GetLast(); break; case MoveCommandEnum.MoveNext: user = BackOfficeBL.Security.User.GetNext(CrUser); break; case MoveCommandEnum.MovePrev: user = BackOfficeBL.Security.User.GetPrev(CrUser); break; } if (user != null) { CrUser = user; ShowGUI(); } }
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; } }
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 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 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; }
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); } }
private void frmUsers_Delete(object sender, ref bool _status) { if (CrUser == null) { _status = false; return; } else { if (CrUser.IsNew == true) { _status = false; return; } } DataDeleteResult result = CrUser.Delete(); _status = result.DeleteStatus; if (result.DeleteStatus == false) MessageBox.Show(result.ErrorMessage); else CrUser = null; }
private void frmUsers_AddNew(object sender, ref bool _status) { CrUser = new BackOfficeBL.Security.User(); }
private void frmUsers_Find(object sender, Dictionary<string, object> _findFields) { CrUser = User.FindByUserID((int)_findFields["UserID"]); ShowGUI(); }