public UserRolesForm(int EmployeeID) { InitializeComponent(); employeeId = EmployeeID; manager = new ContextManager(); StaffEmployeeLogic employeeLogic = new StaffEmployeeLogic(manager); StaffEmployee employee = employeeLogic.Get(EmployeeID); if (employee != null) { if (employee.UserID != null) { userId = Convert.ToInt32(employee.UserID); SecurityUsersLogic usersLogic = new SecurityUsersLogic(manager); SecurityUser user = usersLogic.Get(Convert.ToInt32(userId)); LoginL.Text = user.Login; } else MessageBox.Show("Логін користувача відсутній"); } LFML.Text = employee.LastName + " " + employee.FirstName + " " + employee.MiddleName; FillRoles(); }
public UserRolesForm(int EmployeeID) { InitializeComponent(); employeeId = EmployeeID; manager = new ContextManager(); StaffEmployeeLogic employeeLogic = new StaffEmployeeLogic(manager); StaffEmployee employee = employeeLogic.Get(EmployeeID); if (employee != null) { if (employee.UserID != null) { userId = Convert.ToInt32(employee.UserID); SecurityUsersLogic usersLogic = new SecurityUsersLogic(manager); SecurityUser user = usersLogic.Get(Convert.ToInt32(userId)); LoginL.Text = user.Login; } else { MessageBox.Show("Логін користувача відсутній"); } } LFML.Text = employee.LastName + " " + employee.FirstName + " " + employee.MiddleName; FillRoles(); }
private void FillData() { SecurityUsersLogic users = new SecurityUsersLogic(manager); if (id != null) { SecurityUser user = users.Get(Convert.ToInt32(id)); LoginTB.Text = user.Login; ActiveCB.Checked = user.Active; } }
/// <summary> /// Проверяем, существует ли имя пользователя в базе данных — файле XML. /// </summary> /// <param name="name">Имя пользователя.</param> /// <returns>ID пользователя.</returns> private int AuthUser(string name, string Hash) { // Считываем и сравниваем имя пользователя. ContextManager manager = new ContextManager(); SecurityUsersLogic users = new SecurityUsersLogic(manager); int userId = users.Get(name, Hash); if (userId >= 0) { this._isAuth = true; } else { this._isAuth = false; } manager.CloseContext(); return(userId); // Если пользователь не найден, генерируем исключение. throw new System.Security.SecurityException(String.Format("Пользователь {0} не найден в базе данных.", name)); }
/// <summary> /// Проверяем, существует ли имя пользователя в базе данных — файле XML. /// </summary> /// <param name="name">Имя пользователя.</param> /// <returns>ID пользователя.</returns> private int AuthUser(string name, string Hash) { // Считываем и сравниваем имя пользователя. ContextManager manager = new ContextManager(); SecurityUsersLogic users = new SecurityUsersLogic(manager); int userId = users.Get(name, Hash); if (userId >= 0) { this._isAuth = true; } else { this._isAuth = false; } manager.CloseContext(); return userId; // Если пользователь не найден, генерируем исключение. throw new System.Security.SecurityException(String.Format("Пользователь {0} не найден в базе данных.", name)); }