public static ApplicationUserManager Create(IdentityFactoryOptions <ApplicationUserManager> options, IOwinContext context) { GSLogisticsContext db = context.Get <GSLogisticsContext>(); ApplicationUserManager userManager = new ApplicationUserManager(new UserStore <ApplicationUser>(db)); //Activate when needed userManager.PasswordValidator = new PasswordValidator { RequiredLength = 4, RequireNonLetterOrDigit = false, RequireDigit = false, RequireLowercase = false, RequireUppercase = false }; //userManager.UserValidator = new UserValidator<ApplicationUser>(userManager) //{ // AllowOnlyAlphanumericUserNames = true, // RequireUniqueEmail = true //}; return(userManager); }
private ClientUserInfo GenerateClientUserInfo(string userName) { using (var context = new GSLogisticsContext()) { var userInfo = new ClientUserInfo(); var user = context.UserInfos.Where(x => x.UserName == userName).FirstOrDefault(); if (user != null) { userInfo.UserName = user.UserName; if (user.UserCustomers != null && user.UserCustomers.Any()) { List <string> clientIds = new List <string>(); List <int> divisionIds = new List <int>(); clientIds = user.UserCustomers.Select(x => x.CustomerId).Distinct().ToList(); divisionIds = user.UserCustomers.Select(x => x.DivisionId).Distinct().ToList(); userInfo.CustomerIds = clientIds.ToArray(); userInfo.DivisionIds = divisionIds.ToArray(); } } return(userInfo); } }
internal LogicBase(IKernel kernel) { if (kernel == null) { throw new ArgumentNullException("kernel"); } _Kernel = kernel; _Context = Kernel.Get <GSLogisticsContext>(); _Repository = Kernel.Get <GSLogisticsRepository>(); }
protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { context.Dispose(); context = null; } disposed = true; }
public GSLogisticsRepository(IKernel kernel, GSLogisticsContext context = null) { if (kernel == null) { throw new ArgumentNullException(nameof(kernel)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } _Kernel = kernel; _Context = _Kernel.Get <GSLogisticsContext>(); }
protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { _Repository.Dispose(); _Repository = null; _Context.Dispose(); _Context = null; } disposed = true; }