public static bool UpdateDCUser() { var userProfileService = DependencyInjectionFactory.CreateInjectionInstance <IUserProfileService>(); var domainAuthenticationService = DependencyInjectionFactory.CreateInjectionInstance <IDomainAuthenticationService>(); //user hayi az DC ke login kardand vali password e DC anha taghir karde ra migirad //meghdare DCPassword ra dar cache null mikonad ta user az halate motabr boodan kharej shavad var DCUserProfileList = userProfileService.All() .Where(profile => profile.IsDCUser && !string.IsNullOrEmpty(profile.DCPassword)).ToList() .Select(profile => { var info = new UserProfile() { UserName = profile.UserName, Password = profile.DCPassword }; //if (!domainAuthenticationService.ValidateUser(info)) if (!userProfileService.ValidateUser(info)) { profile.DCPassword = null; } return(profile); }); return(DCUserProfileList.Count() > 0); }
public static List <ViewElementDTO> GetViewElementByUserId(int userId) { var roleList = new List <Role>(); var ViewElementDTOList = new List <ViewElementDTO>(); var roles = DependencyInjectionFactory.CreateInjectionInstance <IUserService>().FindUserRoles(userId); if (roles.Any()) { roleList = roles.ToList(); } foreach (var role in roleList) { var viewElements = role.ViewElementRoles .Select(viewElementRole => new ViewElementDTO { UniqueName = viewElementRole.ViewElement.UniqueName, Title = viewElementRole.ViewElement.Title }); ViewElementDTOList.AddRange(viewElements); } return(ViewElementDTOList); }