protected void Application_Start() { RegisterRoutes(RouteTable.Routes); _starter = new Starter <IOrchardHost>(HostInitialization, HostBeginRequest, HostEndRequest); _starter.OnApplicationStart(this); LocalizationInfoFactory.Init( new WebIpAddressProvider(), new WebServiceGeoLocationInfoProvider(106603, "WmvDZnIe7c3I")); }
public IUser CreateUser(string email, string password, string name, string phone) { Logger.Information("CreateUser {0} {1}", email, password, name, phone); var teeyootUser = _orchardServices.ContentManager.New("TeeyootUser"); var userPart = teeyootUser.As <UserPart>(); userPart.UserName = email; userPart.Email = email; userPart.NormalizedUserName = email.ToLowerInvariant(); userPart.HashAlgorithm = PBKDF2; _membershipService.SetPassword(userPart, password); userPart.RegistrationStatus = UserStatus.Approved; userPart.EmailStatus = UserStatus.Approved; var teeyootUserPart = teeyootUser.As <TeeyootUserPart>(); var culture = _workContextAccessor.GetContext().CurrentCulture.Trim(); var cultureRecord = _cultureRepository.Table.First(c => c.Culture == culture); userPart.Culture = cultureRecord; teeyootUserPart.CreatedUtc = DateTime.UtcNow; teeyootUserPart.PhoneNumber = phone; teeyootUserPart.PublicName = name; teeyootUserPart.TeeyootUserCulture = cultureRecord.Culture; var localizationInfo = LocalizationInfoFactory.GetCurrentLocalizationInfo(); var USDCurrency = _currencies.Table.FirstOrDefault(aa => aa.Code == "USD"); teeyootUserPart.CountryRecord = _countryService.GetCountry(localizationInfo); teeyootUserPart.CurrencyRecord = (USDCurrency == null) ? _countryService.GetCurrency(localizationInfo, LocalizationInfoFactory.GetCurrency()) : USDCurrency; _orchardServices.ContentManager.Create(teeyootUser); var role = _roleService.GetRoleByName("Seller"); if (role != null) { _userRolesRepository.Create(new UserRolesPartRecord { UserId = userPart.Id, Role = role }); } return(userPart); }
public void SetUp() { var ipAddressProvider = new MockIpAddressProvider("113.210.0.0"); LocalizationInfoFactory.Init(ipAddressProvider, new WebServiceGeoLocationInfoProvider(106603, "WmvDZnIe7c3I")); }
public void StillMalaysia() { var localizationInfo = LocalizationInfoFactory.GetCurrentLocalizationInfo(); Assert.AreEqual(Country.Malaysia, localizationInfo.Country); }