Пример #1
0
            /// <summary>
            /// Executes get stores by employee request.
            /// </summary>
            /// <param name="request">The service request.</param>
            /// <returns>The response containing accessible stores of this employee.</returns>
            private static EntityDataServiceResponse <OrgUnit> GetEmployeeStoresFromAddressBook(GetEmployeeStoresFromAddressBookRealtimeRequest request)
            {
                var dataRequest = new GetEmployeeStoresFromAddressBookDataRequest(request.QueryResultSettings);
                EntityDataServiceResponse <OrgUnit> response = request.RequestContext.Execute <EntityDataServiceResponse <OrgUnit> >(dataRequest);

                return(response);
            }
Пример #2
0
            /// <summary>
            /// Gets the accessible stores of the current employee.
            /// </summary>
            /// <param name="request">Instance of <see cref="GetStoresByEmployeeServiceRequest"/>.</param>
            /// <returns>Instance of <see cref="EntityDataServiceResponse{OrgUnit}"/>.</returns>
            private static EntityDataServiceResponse <OrgUnit> GetStoresByEmployee(GetStoresByEmployeeServiceRequest request)
            {
                ThrowIf.Null(request.RequestContext, "request.RequestContext");
                EntityDataServiceResponse <OrgUnit> response = null;

                if (request.RequestContext.Runtime.Configuration.IsMasterDatabaseConnectionString)
                {
                    // If connected to online, we make a RTS call for retrieving all accessible org units.
                    var serviceRequest = new GetEmployeeStoresFromAddressBookRealtimeRequest(request.QueryResultSettings);
                    response = request.RequestContext.Execute <EntityDataServiceResponse <OrgUnit> >(serviceRequest);
                }
                else
                {
                    var dataRequest = new GetEmployeeStoresFromAddressBookDataRequest(request.QueryResultSettings);
                    response = request.RequestContext.Execute <EntityDataServiceResponse <OrgUnit> >(dataRequest);
                }

                return(response);
            }
Пример #3
0
            /// <summary>
            /// Gets the employee stores from address book.
            /// </summary>
            /// <param name="request">The data service request.</param>
            /// <returns>The data service response.</returns>
            private EntityDataServiceResponse <OrgUnit> GetEmployeeStoresFromAddressBook(GetEmployeeStoresFromAddressBookDataRequest request)
            {
                EmployeeDataManager dataManager = this.GetDataManagerInstance(request.RequestContext);
                var result = dataManager.GetEmployeeStoresFromAddressBook(request.RequestContext.GetPrincipal().UserId, request.QueryResultSettings);

                return(new EntityDataServiceResponse <OrgUnit>(result));
            }