public static EmployeeVacationsIndexModel GetEmployeeVacationsIndexModel(int?statusId, int?userId) { EmployeeVacationsIndexModel model = new EmployeeVacationsIndexModel(); model.VacationStatusList = EmployeeVacationsRepositories.GetAllVacationStatus(); model.EmployeeUsersList = UserProfilesRepository.GetNotAdminUsers(); model.StatusId = statusId ?? 0; model.EmployeeUserId = userId ?? 0; return(model); }
public static void InsertNewEmployee(EmployeeUsersDetails employeeUser) { int userId = UserProfilesRepository.GetUserByUserName(employeeUser.UserName).UserId; Employee employee = new Employee(); employee.CurrentSalary = employeeUser.CurrentSalary; employee.JoinDate = employeeUser.JoinDate; employee.UserId = userId; employee.CreateDate = DateTimeHelper.Today(); if (employeeUser.RoleId == 0) { webpages_Roles role = RolesRepositories.GetEmployeeRole(); employeeUser.RoleId = role.RoleId; } EmployeesRepositories.InsertNewEmployee(employee); RolesRepositories.CreateUser(userId, employeeUser.RoleId); }
public static bool VerifyPassword(string userName, string password) { string hashedPassword = UserProfilesRepository.GetUserPassword(userName); if (hashedPassword == null) { return(false); } if (password == null) { return(false); } byte[] hashedPasswordBytes = Convert.FromBase64String(hashedPassword); // Verify a version 0 (see comment above) password hash. if (hashedPasswordBytes.Length != (1 + Config.SaltSize + Config.PBKDF2SubkeyLength) || hashedPasswordBytes[0] != 0x00) { // Wrong length or version header. return(false); } byte[] salt = new byte[Config.SaltSize]; Buffer.BlockCopy(hashedPasswordBytes, 1, salt, 0, Config.SaltSize); byte[] storedSubkey = new byte[Config.PBKDF2SubkeyLength]; Buffer.BlockCopy(hashedPasswordBytes, 1 + Config.SaltSize, storedSubkey, 0, Config.PBKDF2SubkeyLength); byte[] generatedSubkey; using (var deriveBytes = new Rfc2898DeriveBytes(password, salt, Config.PBKDF2IterCount)) { generatedSubkey = deriveBytes.GetBytes(Config.PBKDF2SubkeyLength); } byte[] outputBytes = new byte[1 + Config.SaltSize + Config.PBKDF2SubkeyLength]; Buffer.BlockCopy(salt, 0, outputBytes, 1, Config.SaltSize); Buffer.BlockCopy(generatedSubkey, 0, outputBytes, 1 + Config.SaltSize, Config.PBKDF2SubkeyLength); string hashEnterPassword = Convert.ToBase64String(outputBytes); if (hashedPassword == hashEnterPassword) { return(true); } return(false); }
public static List <string> GetUserNamesNotInProjectByTerm(string term, int projectId) { return(UserProfilesRepository.GetUserNamesInProjectByTerm(term, projectId)); }
public static UserData GetUserDataByUserId(int userId) { DateTime serverTime = DateTimeHelper.Today(); return(UserProfilesRepository.GetUserDataByUserId(userId, serverTime)); }
public static UserProfile GetUserById(int userId) { return(UserProfilesRepository.GetUserByUserId(userId)); }
public static void UpdateUserProfile(UserProfile userProfile) { UserProfilesRepository.UpdateUserProfile(userProfile); }
public static UserProfile GetUserByUserName(string userName) { return(UserProfilesRepository.GetUserByUserName(userName)); }