Beispiel #1
0
        public GetResult <IEnumerable <ResponseSessionDisplayInfo> > GetSessionList(SessionFilter filter)
        {
            var query = FormFilteredSessionQuery(filter);

            return(new GetResult <IEnumerable <ResponseSessionDisplayInfo> >
            {
                ResultOk = true,
                RequestedData = query
                                .Select(s => new ResponseSessionDisplayInfo
                {
                    SessionId = s.SessionId,
                    Film = new ResponseFilmDisplayInfo
                    {
                        FilmId = s.FilmId,
                        Name = s.Film.Name
                    },
                    Cinema = new ResponseCinemaDisplayInfo
                    {
                        Name = s.CinemaRoom.Cinema.Name,
                        City = s.CinemaRoom.Cinema.City,
                        CinemaId = s.CinemaRoom.Cinema.CinemaId
                    },
                    CinemaRoom = new ResponseCinemaRoomDisplayInfo
                    {
                        Name = s.CinemaRoom.Name,
                        CinemaRoomId = s.CinemaRoomId
                    },
                    BeginTime = s.BeginTime
                })
            });
        }
Beispiel #2
0
        public async Task <IActionResult> Sessions([FromRoute] string credentialId, [FromQuery] SessionFilter filter)
        {
            if (string.IsNullOrEmpty(credentialId))
            {
                return(NotFound());
            }

            var validationResult = new SessionFilterValidator(DisplayNameRule).Validate(filter);

            validationResult.AddToModelState(this.ModelState, null);

            if (!validationResult.IsValid)
            {
                return(ValidationError());
            }

            var sessionsPage = await CredentialStore.GetSessions(credentialId, filter);

            if (sessionsPage.IsEmpty)
            {
                return(NotFound <Session>(filter, sessionsPage));
            }

            return(Collection <Session>(filter, sessionsPage));
        }
Beispiel #3
0
        public async Task <IEnumerable <SessionDto> > FindAsync(SessionFilter filter = null)
        {
            var sessions = await sessionRepository.FindAsync(filter);

            var sessionsDto = mapper.Map <IEnumerable <SessionDto> >(sessions);

            return(sessionsDto);
        }
Beispiel #4
0
        public async Task <SessionDto> GetAsync(int id, SessionFilter filter = null)
        {
            var session = await sessionRepository.GetAsync(id);

            var sessionDto = mapper.Map <SessionDto>(session);

            return(sessionDto);
        }
Beispiel #5
0
 private bool FilterSpeakers(object obj)
 {
     if (obj is Session session)
     {
         return(session.Title.ToUpper().Contains(SessionFilter.ToUpper()) || session.Timeslot_1.ToUpper().Contains(SessionFilter.ToUpper()) ||
                session.Room_1.ToUpper().Contains(SessionFilter.ToUpper()) || session.Speaker_1.ToUpper().Contains(SessionFilter.ToUpper()));
     }
     return(false);
 }
Beispiel #6
0
        public IActionResult GetSessionList([FromQuery] SessionFilter filter)
        {
            GetResult <IEnumerable <ResponseSessionDisplayInfo> > result = sessionService.GetSessionList(filter);

            if (result.ResultOk)
            {
                return(Ok(result));
            }
            return(NotFound(result));
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            var xmlFile    = @"C:\Users\dfrin_000\Desktop\local_test.xml";
            var username   = "******";
            var password   = "******";
            var folderName = "Test";

            using (var sessionManager = new SessionManagementWrapper(username, password))
            {
                var folderId = GetFolderId(folderName, sessionManager);

                using (var remoteRecorderService = new RemoteRecorderManagementWrapper(username, password))
                {
                    using (var usageManager = new UsageManagementWrapper(username, password))
                    {
                        SessionFilter filter = new SessionFilter();

                        //usageManager.IsSessionUsageOK();
                    }
                }
            }

            //try
            //{
            //    var parser = new RecorderScheduleXmlParser(xmlFile);
            //    var recordings = parser.ExtractRecordings();

            //    using (var sessionManager = new SessionManagementWrapper(username, password))
            //    {
            //        var folderId = GetFolderId(folderName, sessionManager);

            //        using (var remoteRecorderService = new RemoteRecorderManagementWrapper(username, password))
            //        {
            //            //var settings = remoteRecorderService.GetSettingsByRecorderName("EDKNIGHT-PC");
            //            //remoteRecorderService.ScheduleRecording("TestRecording", folderId, false, DateTime.Now, DateTime.Now.AddMinutes(1), new List<RecorderSettings> { settings });

            //            foreach (var recording in recordings)
            //            {
            //                    var settings = remoteRecorderService.GetSettingsByRecorderName(recording.RecorderName);
            //                    remoteRecorderService.ScheduleRecording(recording.Title, folderId, false, recording.StartTime, recording.EndTime, new List<RecorderSettings> { settings }, false);
            //            }
            //        }
            //    }
            //}
            //catch (Exception e)
            //{
            //    log.Error(e);
            //    Console.WriteLine("An error has occurred:  {0}", e.Message);
            //    Console.WriteLine("See the log for more details.");
            //}

            Console.ReadLine();
        }
        public static List <SessionView> ListSessions(SessionFilter filter)
        {
            var perculus = Common.CreatePerculusClient();

            (List <SessionView> sessions, ApiErrorResponse error) = perculus.Sessions.SearchSessions(filter);

            if (error != null)
            {
                Common.HandleErrorResponse(error);
            }

            return(sessions);
        }
Beispiel #9
0
        public async Task <ActionResult> Sessions(
            [FromRoute] string dateFilter,
            [FromRoute] string cinemaFilter,
            [FromRoute] string filmFilter)
        {
            SessionFilter filter = new SessionFilter()
            {
                SessionDate = Convert.ToDateTime(dateFilter),
                CinemaName  = cinemaFilter,
                FilmName    = filmFilter
            };
            var sessions = await sessionService.FindAsync(filter);

            return(View(sessions));
        }
Beispiel #10
0
 public void ApplySessionFilters(SessionFilter filter)
 {
     if (filter != null)
     {
         if (filter.Active != null)
         {
             this.AddParameter("active", filter.Active);
         }
         if (filter.From != null)
         {
             this.AddParameter("from", String.Format("{0:dd/MM/yyyy}", filter.From));
         }
         if (filter.To != null)
         {
             this.AddParameter("to", String.Format("{0:dd/MM/yyyy}", filter.To));
         }
     }
 }
Beispiel #11
0
        public Task <Session> GetAsync(int id, SessionFilter filter = null)
        {
            var session = dbContext.Sessions
                          .Include(s => s.Tickets)
                          .SingleOrDefault(s => s.SessionId == id);
            ICollection <Ticket> filteredTickets = new Collection <Ticket>();

            foreach (var filteredTicket in session.Tickets)
            {
                if (filteredTicket.OrderId == null)
                {
                    filteredTickets.Add(filteredTicket);
                }
            }
            if (filteredTickets.Count != 0)
            {
                session.Tickets = filteredTickets;
            }
            return(Task.FromResult(session));
        }
Beispiel #12
0
 public Task <IEnumerable <Session> > FindAsync(SessionFilter filter = null)
 {
     if (filter != null)
     {
         var sessions = dbContext.Sessions
                        .AsNoTracking()
                        .Include(s => s.Cinema)
                        .Include(s => s.Film)
                        .Where(s => s.SessionDate == filter.SessionDate &&
                               s.Cinema.Name == filter.CinemaName &&
                               s.Film.Title == filter.FilmName)
                        .AsEnumerable();
         return(Task.FromResult(sessions));
     }
     else
     {
         var sessions = dbContext.Sessions
                        .AsNoTracking()
                        .AsEnumerable();
         return(Task.FromResult(sessions));
     }
 }
Beispiel #13
0
        private IQueryable <Session> FormFilteredSessionQuery(SessionFilter filter)
        {
            IQueryable <Session> query = dbContext.Sessions
                                         .Include(s => s.Film)
                                         .Include(s => s.CinemaRoom)
                                         .Include(s => s.CinemaRoom.Cinema)
                                         .AsNoTracking();

            if (filter.FilmId != null)
            {
                query = query.Where(s => s.FilmId == filter.FilmId);
            }
            if (filter.StartDate != null)
            {
                query = query.Where(s => filter.StartDate < s.BeginTime);
            }
            if (filter.EndDate != null)
            {
                query = query.Where(s => s.BeginTime < filter.EndDate);
            }

            return(query);
        }
Beispiel #14
0
    /// <inheritdoc/>
    public virtual async Task DeleteSessionsAsync(SessionFilter filter, CancellationToken cancellationToken = default)
    {
        cancellationToken = cancellationToken == CancellationToken.None ? CancellationTokenProvider.CancellationToken : cancellationToken;

        filter.Validate();

        var entities = await Filter(Context.ServerSideSessions.AsQueryable(), filter)
                       .ToArrayAsync(cancellationToken);

        entities = Filter(entities.AsQueryable(), filter).ToArray();

        Context.ServerSideSessions.RemoveRange(entities);

        try
        {
            await Context.SaveChangesAsync(cancellationToken);

            Logger.LogDebug("Removed {serverSideSessionCount} server-side sessions from database for {@filter}", entities.Length, filter);
        }
        catch (DbUpdateConcurrencyException ex)
        {
            Logger.LogInformation("Error removing {serverSideSessionCount} server-side sessions from database for {@filter}: {error}", entities.Length, filter, ex.Message);
        }
    }
Beispiel #15
0
        /// <summary>
        /// Search Sessions using session filter
        /// </summary>
        /// <param name="filter">SessionFilter Model</param>
        /// <returns>A session view list object and error info if error occurs</returns>
        public List <SessionView> SearchSessions(SessionFilter filter, out ApiErrorResponse error)
        {
            string             query         = filter.ToQueryString();
            var                request       = HttpWebClient.CreateWebRequest("GET", BuildRoute($"session?{query}"));
            var                response      = HttpWebClient.SendWebRequest(request);
            List <SessionView> sessionsViews = null;

            error = null;

            if (response != null)
            {
                string result = HttpWebClient.GetResponseBody(response);
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    sessionsViews = result.ToObject <List <SessionView> >();
                }
                else
                {
                    error = response.ToErrorResponse();
                }
            }

            return(sessionsViews);
        }
Beispiel #16
0
    /// <inheritdoc/>
    public virtual async Task <IReadOnlyCollection <ServerSideSession> > GetSessionsAsync(SessionFilter filter, CancellationToken cancellationToken = default)
    {
        cancellationToken = cancellationToken == CancellationToken.None ? CancellationTokenProvider.CancellationToken : cancellationToken;

        filter.Validate();

        var entities = await Filter(Context.ServerSideSessions.AsNoTracking().AsQueryable(), filter)
                       .ToArrayAsync(cancellationToken);

        entities = Filter(entities.AsQueryable(), filter).ToArray();

        var results = entities.Select(entity => new ServerSideSession
        {
            Key         = entity.Key,
            Scheme      = entity.Scheme,
            SubjectId   = entity.SubjectId,
            SessionId   = entity.SessionId,
            DisplayName = entity.DisplayName,
            Created     = entity.Created,
            Renewed     = entity.Renewed,
            Expires     = entity.Expires,
            Ticket      = entity.Data,
        }).ToArray();

        Logger.LogDebug("Found {serverSideSessionCount} server-side sessions for {@filter}", results.Length, filter);

        return(results);
    }
Beispiel #17
0
        static void Main(string[] args)
        {
            var config    = Config.GetInstance();
            var userEmail = "test-user-" + Guid.NewGuid() + "@advancity.com.tr";
            var username  = "******" + Guid.NewGuid();
            var userId    = String.Empty;
            var sessionId = String.Empty;

            try
            {
                #region USERS
                HEADER("Creating a user");
                userId = UserMethods.CreateUser(userEmail, username);

                if (!String.IsNullOrEmpty(userId))
                {
                    OK("Created user {0}", userId);
                }
                else
                {
                    ERROR("Could not create user");
                }

                if (!String.IsNullOrEmpty(userId))
                {
                    HEADER("Getting the user");
                    var user = UserMethods.GetUserById(userId);
                    if (user != null)
                    {
                        OK("Fetched user information by user id: {0}", JsonConvert.SerializeObject(user));
                        user = UserMethods.GetUserByUsername(user.username);
                        if (user != null)
                        {
                            OK("Fetched user information by username: {0}", JsonConvert.SerializeObject(user));
                        }

                        HEADER("Searching users");
                        List <UserView> users = UserMethods.SearchUsers(new UserFilter()
                        {
                            Role       = "u",
                            PageNumber = 1,
                            PageSize   = 3,
                            UserName   = username,
                        });
                        OK("{0} Users Found {1}", users.Count.ToString(), JsonConvert.SerializeObject(users));

                        HEADER("Updating user");
                        PostUserView updateModel = new PostUserView
                        {
                            email      = user.email,
                            username   = user.username,
                            lang       = user.lang,
                            name       = user.name,
                            surname    = user.surname,
                            expires_at = user.expires_at,
                            role       = user.role,
                            active     = user.status == Models.Enum.ActiveStatus.Active ? true : false
                        };

                        string updatedUserId = UserMethods.UpdateUser(userId, updateModel);
                        OK("Updated user {0}", updatedUserId);
                    }
                    else
                    {
                        ERROR("User could not be fetched.");
                    }

                    HEADER("Changing password");
                    if (UserMethods.ChangeUserPassword(userId, "123"))
                    {
                        OK("Changed password");
                    }
                    else
                    {
                        ERROR("Password could not be changed.");
                    }
                }
                #endregion USERS

                #region SESSIONS & Attendees
                HEADER("Creating a session");
                sessionId = SessionMethods.CreateSession();

                if (!String.IsNullOrEmpty(sessionId))
                {
                    OK("Created session {0}", sessionId);
                }
                else
                {
                    ERROR("Could not create session");
                }

                if (!String.IsNullOrEmpty(sessionId))
                {
                    HEADER("Getting the session");
                    var session = SessionMethods.GetSession(sessionId);
                    if (session != null)
                    {
                        OK("Fetched session {0}. {1}{2}", session.session_id, Environment.NewLine, JsonConvert.SerializeObject(session));
                    }
                    else
                    {
                        ERROR("Session could not be updated");
                    }
                }

                if (!String.IsNullOrEmpty(sessionId))
                {
                    HEADER("Updating the session");
                    var session_id_updated = SessionMethods.UpdateSession(sessionId);
                    if (!String.IsNullOrEmpty(session_id_updated))
                    {
                        OK("Updated session {0}", session_id_updated);
                    }
                    else
                    {
                        ERROR("Session could not be updated");
                    }
                }

                HEADER("Search Sessions");

                var sessionFilter = new SessionFilter()
                {
                    //SessionName = "SessionName",
                    BeginDate  = DateTime.Now.AddMinutes(-10),
                    PageNumber = 1,
                    PageSize   = 10
                };

                var sessionsList = SessionMethods.ListSessions(sessionFilter);

                if (sessionsList != null && sessionsList.Count > 0)
                {
                    OK("{0} Sessions Found {1}", sessionsList.Count.ToString(), JsonConvert.SerializeObject(sessionsList));
                }
                else
                {
                    ERROR("Sessions could not be found");
                }
                if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(sessionId))
                {
                    HEADER("Adding attendee by user id {0} to session {1}", userId, sessionId);
                    if (AttendeeMethods.AddAttendeeByUserId(sessionId, userId) != null)
                    {
                        OK("Created attendee");
                    }
                    else
                    {
                        ERROR("Could not create attendee");
                    }

                    HEADER("Searching for an attendee in session {0}", sessionId);
                    var attendeeSearchFilter = new AttendeeFilter()
                    {
                        UserId     = userId,
                        Role       = "a",
                        PageSize   = 10,
                        PageNumber = 1
                    };

                    var attendees = AttendeeMethods.SearchAttendees(sessionId, attendeeSearchFilter);
                    if (attendees != null && attendees.Count > 0)
                    {
                        OK("{0} Attendees Found: {1}", attendees.Count.ToString(), JsonConvert.SerializeObject(attendees));
                    }
                    else
                    {
                        ERROR("Attendee Not Found");
                    }

                    HEADER("Deleting the attendee by user id");
                    if (AttendeeMethods.DeleteAttendee(sessionId, userId))
                    {
                        OK("Deleted attendee");
                    }
                    else
                    {
                        ERROR("Could not delete attendee");
                    }

                    HEADER("Adding attendee by user id {0} to session {1} using multiple adding method", userId, sessionId);
                    AttendeesPostResult testMultipleAttendeesByUserId = AttendeeMethods.AddMultipleAttendeesByUserId(sessionId, userId);
                    if (testMultipleAttendeesByUserId.approved != null && testMultipleAttendeesByUserId.approved.Count == 1)
                    {
                        OK("Created attendee");

                        var attendanceCode = testMultipleAttendeesByUserId.approved[0].attendance_code;
                        HEADER("Deleting the newly created attendee {0}", attendanceCode);
                        if (AttendeeMethods.DeleteAttendee(sessionId, attendanceCode))
                        {
                            OK("Deleted attendee");
                        }
                        else
                        {
                            ERROR("Could not delete attendee");
                        }
                    }
                    else
                    {
                        ERROR("Could not create attendee");
                    }
                }
                if (!String.IsNullOrEmpty(sessionId))
                {
                    HEADER("Adding external attendee (without user id)");
                    var newAttendee = new PostAttendeeView()
                    {
                        name    = "Test Attendee Name",
                        surname = "Test Attendee Surname",
                        email   = userEmail,
                        mobile  = "05412345678",
                        role    = "u",
                    };
                    AttendeeView testAddAttendee = AttendeeMethods.AddAttendee(sessionId, newAttendee);

                    if (testAddAttendee != null)
                    {
                        string joiningAddress = string.Format(config.APP_JOIN_URL_FORMAT, testAddAttendee.attendance_code);
                        OK("Created attendee -> Join address: {0}", joiningAddress);

                        HEADER("Deleting newly created attendee {0}", testAddAttendee.attendance_code);
                        if (AttendeeMethods.DeleteAttendee(sessionId, testAddAttendee.attendance_code))
                        {
                            OK("Deleted attendee");
                        }
                        else
                        {
                            ERROR("Could not delete attendee");
                        }
                    }
                }
                #endregion SESSIONS
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception occured. Details: " + Environment.NewLine + ex.ToString());
            }

            try
            {
                #region Clean-UP
                HEADER("CLEAN-UP");
                if (!String.IsNullOrEmpty(userId))
                {
                    if (UserMethods.DeleteUser(userId))
                    {
                        OK("Deleted user {0}", userId);
                    }
                    else
                    {
                        ERROR("Could not delete user {0}", userId);
                    }
                }

                if (!String.IsNullOrEmpty(sessionId))
                {
                    if (SessionMethods.DeleteSession(sessionId))
                    {
                        OK("Deleted session {0}", sessionId);
                    }
                    else
                    {
                        ERROR("Could not delete session {0}", sessionId);
                    }
                }
                #endregion Clean-UP
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception occured. Details: " + Environment.NewLine + ex.ToString());
            }
            HEADER("THE END");

            Console.ReadKey();
        }
Beispiel #18
0
    /// <inheritdoc/>
    public async Task <IReadOnlyCollection <UserSession> > GetSessionsAsync(SessionFilter filter, CancellationToken cancellationToken = default)
    {
        var sessions = await _store.GetSessionsAsync(filter, cancellationToken);

        var results = sessions
                      .Select(x => new { x.Renewed, Ticket = x.Deserialize(_protector, _logger) ! })
Beispiel #19
0
 private void SetUp()
 {
     SetUpGenericRepositoryStub();
     _filter = new SessionFilter(_genericRepository);
 }
Beispiel #20
0
        /// <summary>
        /// Retrieves a list of sessions. This endpoint implements pagination by using links. Additionally, it is possible to filter by parameters such as patientId, externalId, createdAfter, updatedAfter or to sort ascending or descending.
        /// </summary>
        /// <exception cref="CNXT.Connector.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="first">Read the first n sessions of the set. The default and maximum value is set to 25 sessions per request.</param>
        /// <param name="after">Read all sessions in the set after (below) this cursor. (optional)</param>
        /// <param name="filter">Filter session by parameters e.g. patientId, externalId, state, createdAfter, or updatedAfter. CreatedAfter is used for filtering sessions which are created after a specified date. UpdatedAfter is used for filtering sessions which are updated after a specified date.  (Supported values: patientId, externalId, createdAfter, updatedAfter, state).    A state has the following supported values: (OPEN, CLOSED, ORDERED, EXPORTED, SAVED) (optional)</param>
        /// <param name="sort">List of parameters to sort sessions by parameter.  (Supported values: createdAt, updatedAt).    To sort descending add a &#39;-&#39; as prefix e.g. (-createdAt, -updatedAt). (optional)</param>
        /// <param name="include">List of related resources for including relationships directly into session such as Patient.  (Supported values: patient) (optional)</param>
        /// <returns>ApiResponse of SessionsResponse</returns>
        public ApiResponse <SessionsResponse> GetSessionsWithHttpInfo(int first, string after = default(string), SessionFilter filter = default(SessionFilter), List <string> sort = default(List <string>), List <string> include = default(List <string>))
        {
            // verify the required parameter 'first' is set
            if (first == null)
            {
                throw new ApiException(400, "Missing required parameter 'first' when calling SessionsApi->GetSessions");
            }

            var    localVarPath         = "/sessions";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType    = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (first != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "first", first));                // query parameter
            }
            if (after != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "after", after));                // query parameter
            }
            // TODO: Bugfix for supporting deepObjects as query parameters
            //if (filter != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "filter", filter)); // query parameter
            if (filter != null)
            {
                foreach (PropertyInfo propertyInfo in filter.GetType().GetProperties().Where(property => property.GetValue(filter, null) != null))
                {
                    if (propertyInfo.PropertyType == typeof(DateTime) || propertyInfo.PropertyType == typeof(DateTime?))
                    {
                        DateTime?dateTimeValue = propertyInfo.GetValue(filter, null) as DateTime?;

                        if (dateTimeValue.HasValue)
                        {
                            localVarQueryParams.Add(new KeyValuePair <string, string>(string.Format("filter[{0}]", char.ToLower(propertyInfo.Name[0]) + propertyInfo.Name.Substring(1)), dateTimeValue.Value.ToString("o")));
                        }
                    }
                    else
                    {
                        localVarQueryParams.Add(new KeyValuePair <string, string>(string.Format("filter[{0}]", char.ToLower(propertyInfo.Name[0]) + propertyInfo.Name.Substring(1)), propertyInfo.GetValue(filter, null).ToString()));
                    }
                }
            }

            if (sort != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "sort", sort));               // query parameter
            }
            if (include != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "include", include));                  // query parameter
            }
            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
                                                                                                 Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                 localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetSessions", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <SessionsResponse>(localVarStatusCode,
                                                      localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                                      (SessionsResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SessionsResponse))));
        }
Beispiel #21
0
        public static Dictionary <Session, SessionUsage> FetchSessions(string username, string password, SessionFilter filter)
        {
            Dictionary <Session, SessionUsage> retSessions = new Dictionary <Session, SessionUsage>();

            using (var sessionManager = new SessionManagementWrapper(username, password))
            {
                Session[] results = sessionManager.GetSessionsInDateRange(filter.StartDate.Value, filter.EndDate.Value);

                using (var usageManager = new UsageManagementWrapper(username, password))
                {
                    foreach (var session in results)
                    {
                        var usage = usageManager.IsSessionUsageOK(session, filter);
                        if (!usage.IsOK)
                        {
                            retSessions.Add(session, usage);
                        }
                    }
                }
            }

            return(retSessions);
        }
Beispiel #22
0
    private IQueryable <Entities.ServerSideSession> Filter(IQueryable <Entities.ServerSideSession> query, SessionFilter filter)
    {
        if (!String.IsNullOrWhiteSpace(filter.SubjectId))
        {
            query = query.Where(x => x.SubjectId == filter.SubjectId);
        }
        if (!String.IsNullOrWhiteSpace(filter.SessionId))
        {
            query = query.Where(x => x.SessionId == filter.SessionId);
        }

        return(query);
    }
Beispiel #23
0
        /// <summary>
        /// Retrieves a list of sessions. This endpoint implements pagination by using links. Additionally, it is possible to filter by parameters such as patientId, externalId, createdAfter, updatedAfter or to sort ascending or descending.
        /// </summary>
        /// <exception cref="CNXT.Connector.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="first">Read the first n sessions of the set. The default and maximum value is set to 25 sessions per request.</param>
        /// <param name="after">Read all sessions in the set after (below) this cursor. (optional)</param>
        /// <param name="filter">Filter session by parameters e.g. patientId, externalId, state, createdAfter, or updatedAfter. CreatedAfter is used for filtering sessions which are created after a specified date. UpdatedAfter is used for filtering sessions which are updated after a specified date.  (Supported values: patientId, externalId, createdAfter, updatedAfter, state).    A state has the following supported values: (OPEN, CLOSED, ORDERED, EXPORTED, SAVED) (optional)</param>
        /// <param name="sort">List of parameters to sort sessions by parameter.  (Supported values: createdAt, updatedAt).    To sort descending add a &#39;-&#39; as prefix e.g. (-createdAt, -updatedAt). (optional)</param>
        /// <param name="include">List of related resources for including relationships directly into session such as Patient.  (Supported values: patient) (optional)</param>
        /// <returns>SessionsResponse</returns>
        public SessionsResponse GetSessions(int first, string after = default(string), SessionFilter filter = default(SessionFilter), List <string> sort = default(List <string>), List <string> include = default(List <string>))
        {
            ApiResponse <SessionsResponse> localVarResponse = GetSessionsWithHttpInfo(first, after, filter, sort, include);

            return(localVarResponse.Data);
        }
Beispiel #24
0
 /// <summary>
 /// Specify The session conditions.
 /// </summary>
 /// <param name="sessionFilter">The session filter.</param>
 /// <returns>Composed TimeSale</returns>
 public IIntervalBuilder WithSession(SessionFilter sessionFilter) => Build(cmd => cmd.SessionFilter = sessionFilter);