public BaseController(IAuthenticationService authenticationService, IEcoUserService ecoUserService,
     IEcoProfileService ecoProfileService)
 {
     _ecoUserService = ecoUserService;
     _authenticationService = authenticationService;
     _ecoProfileService = ecoProfileService;
 }
 public HomeController(IShapeFactory shapeFactory, IAuthenticationService authenticationService,
     IMembershipService membershipService,
     IEcoMedicineService medicineService,
     IEcoUserService ecoUserService,
     IEcoProfileService ecoProfileService,
     IOrchardServices orchardServices)
     : base(authenticationService, ecoUserService, ecoProfileService)
 {
     _shapeFactory = shapeFactory;
     _membershipService = membershipService;
     _medicineService = medicineService;
     _orchardServices = orchardServices;
     _t = NullLocalizer.Instance;
 }
 public LifestyleController(IAuthenticationService authenticationService, IEcoUserService ecoUserService, IEcoProfileService ecoProfileService)
     : base(authenticationService, ecoUserService, ecoProfileService)
 {
 }
        public EcoUserHandler(IRepository<EcoUserPartRecord> repository,
            IEcoUserService ecoUserService, IOrchardServices orchardServices)
        {
            _ecoUserService = ecoUserService;
            _orchardServices = orchardServices;

            Filters.Add(StorageFilter.For(repository));

            OnCreated<UserPart>((context, part) =>
            {
                var ecoUser = part.As<EcoUserPart>();
                if (ecoUser != null)
                {
                    // ensure created user...
                    var user = _ecoUserService.GetById(ecoUser.UserId);
                    if (user != null)
                    {
                        ecoUser.User = user;
                    }
                    if (user == null && !string.IsNullOrEmpty(part.Email))
                    {
                        user = _ecoUserService.GetUserByEmail(part.Email) as User;

                        if (user == null)
                        {
                            user = new User();
                            user.UserName = part.Email;
                            user.CreateDate = DateTime.UtcNow;
                            user.LastUpdateDate = user.CreateDate;
                            user.Email = user.UserName;
                            user.Password = "******";
                            user.PasswordFormat = 0;
                            user.LoweredEmail = user.Email;

                            _ecoUserService.Add(user);
                        }

                        ecoUser.UserId = user.Id;
                        ecoUser.User = user;

                        /*var rootPersona = _personaService.GetPersonaByName("User");
                        var userPersona = new UserPersona();
                        userPersona.PersonaId = rootPersona.Id;
                        userPersona.UserId = user.Id;
                        _personaService.Save(rootPersona);*/

                        _orchardServices.ContentManager.Publish(part.ContentItem);

                        _orchardServices.ContentManager.Publish(ecoUser.ContentItem);
                    }
                }
            });

            OnLoaded<UserPart>((context, part) =>
            {
                var ecoUser = part.As<EcoUserPart>();
                if (ecoUser != null)
                {
                    // ensure created user when module might have been disabled, etc...
                    // ensure created user...
                    var user = _ecoUserService.GetById(ecoUser.UserId);
                    if (user != null)
                    {
                        ecoUser.User = user;
                    }
                    if (user == null && !string.IsNullOrEmpty(part.Email))
                    {
                        user = new User();
                        user.UserName = part.Email;
                        user.CreateDate = DateTime.UtcNow;
                        user.LastUpdateDate = user.CreateDate;
                        user.Email = user.UserName;
                        user.Password = "******";
                        user.PasswordFormat = 0;
                        user.LoweredEmail = user.Email;

                        _ecoUserService.Add(user);

                        ecoUser.UserId = user.Id;

                        /*var rootPersona = _personaService.GetPersonaByName("User");
                        var userPersona = new UserPersona();
                        userPersona.PersonaId = rootPersona.Id;
                        userPersona.UserId = user.Id;
                        _personaService.Save(rootPersona);*/

                        _orchardServices.ContentManager.Publish(ecoUser.ContentItem);
                    }
                }
            });
        }
 public AccountController(IAuthenticationService authenticationService, IEcoUserService ecoUserService, IEcoProfileService ecoProfileService)
     : base(authenticationService, ecoUserService, ecoProfileService)
 {
 }
 public SupplementsController(IAuthenticationService authenticationService, IEcoUserService ecoUserService, IEcoProfileService ecoProfileService)
     : base(authenticationService, ecoUserService, ecoProfileService)
 {
 }