// private CU_LogService logServiceObj; public CU_Employee_RoleProgramService() { _CU_Employee_RoleProgramRepository = new Repository <CU_Employee_RoleProgram>(_unitOfWork); _EmployeeRepository = new Repository <CU_Employee>(_unitOfWork); roleServiceObj = new CU_RoleService(); _RoleProgramServece = new CU_Role_ProgramService(); }
public CU_EmployeeService() { _CU_EmployeeRepository = new Repository <CU_Employee>(_unitOfWork); _logService = new CU_LogService(); _CU_Role_ProgramService = new CU_Role_ProgramService(); //int num = 0; //var x = new NeighborhodModel().filterExpProgram<Poor_Member>(null).Compile(); //var m = _supportProgramRepository.GetGridList(out num, 1, 1, x); }
public UserModel ValidateLoginData(string loginName, string passWord) { // passWord = QvLib.Security.DataProtection.Encrypt(passWord); var xx = _employeeService.EmployeeList; var emp = _employeeService.EmployeeList.Where(x => x.LoginName.Trim().ToLower() == loginName.Trim().ToLower() && x.IsActive == true).FirstOrDefault(); if (emp != null) { bool isPasswordMatch = false; isPasswordMatch = hashSaltProtection.IsPasswordMatch(passWord, emp.Salt, emp.Password); if (isPasswordMatch) { CU_Role_ProgramService progServ = new CU_Role_ProgramService(); int[] roles = progServ.RolesList.Where(i => i.CU_Employee_RoleProgram.Where(s => s.IdEmployee == emp.ID).Count() > 0).Select(i => i.ID).ToArray(); if (roles.Count() == 0) { Identity.UserID = null; } Identity.UserFullName = emp.Name; Identity.UserID = emp.ID; Identity.Roles = roles; Identity.DepartmentID = emp.IdDepartment; Identity.LastVisit = emp.LastVisitTime.HasValue ? QvLib.QVUtil.Date.GregToHijri(emp.LastVisitTime.Value) : DataServiceArabicResource.NoSignInBefore; Identity.HeadDepartmentID = emp.IdHeadDepartment; Identity.BranchID = emp.BranchID == null ? 0 : emp.BranchID; //update last visit } else { emp = null; } } var data = Mapper.Map <CU_Employee, UserModel>(emp); return(data); //return emp; }