protected Params GetParams(string filteringQuery, int sortingClassId, string sortingMemberCode, string sortingDirection, int?pagingSkip, int?pagingTake) { Filtering filtering = null; if (!string.IsNullOrEmpty(filteringQuery)) { filtering = new Filtering(filteringQuery); } Sorting sorting = null; if (!string.IsNullOrEmpty(sortingMemberCode) && !string.IsNullOrEmpty(sortingDirection)) { IDomainManager domainManager = this.GetService <IDomainManager>(); Member member = domainManager.GetMemberByClassIdAndCodeInlcudingParent(sortingClassId, sortingMemberCode); DataType dataType = domainManager.GetDataType((int)member.PropertyDataTypeId); sorting = new Sorting(dataType.StorageDataType, member.Id, sortingDirection); } Paging paging = null; if (pagingSkip != null && pagingTake != null) { paging = new Paging(pagingSkip, pagingTake); } return(new Params(filtering, sorting, paging)); }
public async Task <IHttpActionResult> CreateUserAsync([FromBody] JToken body) { var model = body.ToObject <RegisterAuth>(); model.ClientIP = Request.GetClientIp(); _userDomainManager = ApiControllerExtensions.GetAzureDomainManager <User>(_dataContext, Request); try { var result = await _authManagerService.RegisterAuthAsync(_userDomainManager, model); if (result.Succeeded) { result.Token = this.GetAuthenticationTokenForUser(result.UserId); return(Ok(result)); } else { return(BadRequest(result.ToErrorString())); } } catch (Exception ex) { return(InternalServerError(ex)); } }
/// <summary> /// 初始化域名服务 /// </summary> public DomainService(IAgentsUnitOfWork unitOfWork, IDomainRepository domainRepository, IDomainManager domainManager) : base(unitOfWork, domainRepository) { UnitOfWork = unitOfWork; DomainRepository = domainRepository; DomainManager = domainManager; }
public Params Create(string filteringQuery = null, int?sortingMemberId = null, string sortingDirection = null, int?pagingSkip = null, int?pagingTake = null) { Filtering filtering = null; if (!string.IsNullOrEmpty(filteringQuery)) { filtering = new Filtering(filteringQuery); } Sorting sorting = null; if (sortingMemberId != null && !string.IsNullOrEmpty(sortingDirection)) { IDomainManager domainManager = this.requestHandler.GetService <IDomainManager>(); Member member = domainManager.GetMember((int)sortingMemberId); DataType dataType = domainManager.GetDataType((int)member.PropertyDataTypeId); sorting = new Sorting(dataType.StorageDataType, member.Id, sortingDirection); } Paging paging = null; if (pagingSkip != null && pagingTake != null) { paging = new Paging(pagingSkip, pagingTake); } return(new Params(filtering, sorting, paging)); }
/// <summary> /// Initializes a new instance of the <see cref="TableController{TData}"/> class /// with a given <paramref name="domainManager"/>. /// </summary> /// <param name="domainManager">The <see cref="IDomainManager{T}"/> for this controller.</param> protected TableController(IDomainManager <TData> domainManager) { if (domainManager == null) { throw new ArgumentNullException("domainManager"); } this.DomainManager = domainManager; }
public AuthenticationService(ManufacturingContext context, IDomainManager domainManager, ILogger logger, IUserSettingsService userSettingsService) { this._context = context; this._userRepository = new UserRepository(this._context); this._sessionRepository = new SessionRepository(this._context); this._permissionRepository = new PermissionRepository(this._context); this._unitOfWork = new UnitOfWork(this._context); this._domainManager = domainManager; this._logger = logger; this._userSettingsService = userSettingsService; }
public UserManager(InventoryContext context, IDomainManager domainManager, IUserService userService) : base(context, userService) { this._context = context; this._userService = userService; this._domainmanager = domainManager; this._inventoryUserProvider = new InventoryUserProvider(this._context, this._domainmanager, this._userService); this._domainUserProvider = new DomainUserProvider(this._context, this._domainmanager, this._userService); this._inventoryUserOperations = new InventoryUserDataOperations(this._context, this._domainmanager, this._userService); this._domainUserOperations = new DomainUserDataOperations(this._context, this._domainmanager, this._userService); }
public TableControllerMock(IDomainManager <TData> domainManager) : base(domainManager) { this.RequestContext = new HttpRequestContext() { IncludeErrorDetail = true }; this.Request = new HttpRequestMessage(HttpMethod.Get, "http://localhost"); this.Request.SetRequestContext(this.RequestContext); this.Configuration = this.config; }
public TableControllerOfDataTests() { this.patch = new Delta <TestEntity>(); this.data = new TestEntity { BooleanValue = true, Id = Id, IntValue = 42 }; this.exception = new Exception("Catch this!"); this.response = new HttpResponseMessage(HttpStatusCode.Conflict); this.responseException = new HttpResponseException(this.response); this.domainManagerMock = new Mock <DomainManager <TestEntity> >(new HttpRequestMessage(), false); this.domainManager = this.domainManagerMock.Object; this.controller = new TableControllerMock(this.domainManager); }
protected Params GetParams(IRequestHandler requestHandler, bool enableSorting) { Filtering filtering = null; if (this.HasParameter("EnableFiltering") && this.GetBoolParameterValue("EnableFiltering")) { filtering = new Filtering(requestHandler.HttpContext.Request.Query[this.GetStringParameterValue("QueryUrlParameterName")]); } Sorting sorting = null; if (enableSorting) { int sortingMemberId = this.GetIntParameterValue("SortingMemberId"); string sortingDirection = this.GetStringParameterValue("SortingDirection"); IDomainManager domainManager = requestHandler.GetService <IDomainManager>(); Member member = domainManager.GetMember(sortingMemberId); DataType dataType = domainManager.GetDataType((int)member.PropertyDataTypeId); sorting = new Sorting(dataType.StorageDataType, sortingMemberId, sortingDirection); } Paging paging = null; if (this.HasParameter("EnablePaging") && this.GetBoolParameterValue("EnablePaging")) { int.TryParse(requestHandler.HttpContext.Request.Query[this.GetStringParameterValue("SkipUrlParameterName")], out int skip); int.TryParse(requestHandler.HttpContext.Request.Query[this.GetStringParameterValue("TakeUrlParameterName")], out int take); if (take == 0) { take = this.GetIntParameterValue("DefaultTake"); } paging = new Paging(skip, take); } return(new Params(filtering, sorting, paging)); }
public void RegisterDomainManager(IDomainManager manager) { _domainManager = manager; }
public AlbumController(ILogger <AlbumController> logger, IDomainManager domainManager) { _domainManager = domainManager; }
public DomainRepository(IDomainManager client) { m_client = client; }
public CommentController(ILogger <CommentController> logger, IDomainManager domainManager) { _domainManager = domainManager; }
public override bool Initialize(string siteName) { if (this._isInitialized) { return(true); } lock (WebApplicationRuntime.MobiRuntimeInitializationLockObject) { if (this._isInitialized) { return(true); } this._serviceMap = new Dictionary <string, IService>(); this._domainMap = new Dictionary <string, Domain>(); this._services = new List <IService>(); IServiceManager sManager = Service.CreateManager(); List <Service> services = sManager.Load(this.ApplicationData); if (services == null || services.Count == 0) { Log.Fatal("WebApplicationRuntime: There is no services for this application"); //throw new ArgumentException("WebApplicationRuntime: There is no services for this application"); } IDomainManager dManager = Domain.CreateManager(); foreach (Service service in services) { // adding domain List <Domain> serviceDomains = dManager.Load(service); if (serviceDomains == null || serviceDomains.Count == 0) { Log.Error("Domain doesn't exist"); } foreach (Domain sDomain in serviceDomains) { this._domainMap.Add(sDomain.DomainName, sDomain); } // adding service IService iservice = service.Instantiate(this); this._services.Add(iservice); this._serviceMap.Add(service.Name, iservice); // ading localizations MobiChat.Data.ILocalizationManager lManager = MobiChat.Data.Localization.CreateManager(); List <MobiChat.Data.Localization> localizations = lManager.Load(this.ApplicationData); foreach (MobiChat.Data.Localization localization in localizations) { if (!this._localizationProviders.ContainsKey(localization)) { this._localizationProviders.Add(localization, localization.InstantiateProvider()); } } } } return(true); }
public InventoryUserDataOperations(InventoryContext context, IDomainManager domainManager, IUserService userService) { this._context = context; this._domainManager = domainManager; this._userService = userService; }
public PhotoController(ILogger <PhotoController> logger, IDomainManager domainManager) { _domainManager = domainManager; }
public async Task <AuthResult> RegisterAuthAsync(IDomainManager <User> domainManager, RegisterAuth model) { if (string.IsNullOrEmpty(model.ProviderUserId) && string.IsNullOrEmpty(model.Email)) { return(new AuthResult { Succeeded = false, ResultCode = AuthResultCode.Error, Errors = new[] { "'ProviderUserId' and 'Email' cannot be empty or is invalid." } }); } AuthResult authResult = null; return(await Task.Run(async() => { var deviceRegistrationnAlreadyExist = _dataContext.UserProfileDevices.SingleOrDefault(p => p.DeviceUniqueId.Equals(model.DeviceId)); if (deviceRegistrationnAlreadyExist != null) { return new AuthResult { Succeeded = true, ResultCode = AuthResultCode.Exist, UserId = deviceRegistrationnAlreadyExist.UserId }; } var providerAuthRegistrationAlreadyExist = _dataContext.UserProfileAuthorizations.SingleOrDefault(p => p.Provider.Equals(model.Provider) && p.ProviderUserId.Equals(model.ProviderUserId)); if (providerAuthRegistrationAlreadyExist != null) { authResult = new AuthResult { Succeeded = true, ResultCode = AuthResultCode.Exist, UserId = providerAuthRegistrationAlreadyExist.UserId }; UserProfileDevice userDevice = GetNewUserProfileDevice(model, providerAuthRegistrationAlreadyExist.UserId); _dataContext.UserProfileDevices.Add(userDevice); await _dataContext.SecureSaveChangesAsync(); } // if null, the params didnt match anything if (authResult == null) { var user = new User { Email = model.Email, UserName = model.Email, Password = string.Empty, RegisterDate = _dateTimeManagerService.GetUniversalDateTime() }; user = await domainManager.InsertAsync(user); if (!string.IsNullOrEmpty(model.ProviderUserId)) { var userAuth = new UserProfileAuthorization { UserId = user.Id, Provider = model.Provider, ProviderUserId = model.ProviderUserId, CreatedAt = _dateTimeManagerService.GetUniversalDateTime() }; _dataContext.UserProfileAuthorizations.Add(userAuth); } var userDevice = GetNewUserProfileDevice(model, user.Id); _dataContext.UserProfileDevices.Add(userDevice); await _dataContext.SecureSaveChangesAsync(); authResult = new AuthResult { Succeeded = true, ResultCode = AuthResultCode.Created, UserId = user.Id }; } return authResult; })); }
public RepositoryInterceptor(IDomainManager domain) { _domain = domain; }
public InventoryUserProvider(InventoryContext context, IDomainManager domainManager, IUserService userService) { this._context = context; this._domainManager = domainManager; this._userService = userService; }
internal SchemaBuilder(IDomainManager store, T definition) { _store = store; _definition = definition; }
public UserManagmentProvider() { _domainManager = DependencyResolver.Current.GetService <IDomainManager>(); }
///------------------------------------------------------------------------------------------------- /// <summary> /// Constructor. /// </summary> /// <param name="store"> /// The store. /// </param> /// <param name="definition"> /// The definition. /// </param> ///------------------------------------------------------------------------------------------------- internal DomainBuilder(IDomainManager store, IDomainConfiguration definition) { _store = store; _definition = definition; }
public LogInService(IDomainManager domainmanagment, IUserServiceProvider userServiceProvider) { this._userServiceProvider = userServiceProvider; this._domainOperations = domainmanagment; }
public UserManager(IGenericRepository repository, IDomainManager domainManager) { _repository = repository; _domainManager = domainManager; }
public UserServiceProvider(InventoryContext context, IDomainManager domainManager) { this._context = context; this._domainManager = domainManager; this.Load(); }