Exemplo n.º 1
0
        public void TestIsOnlineAfterLogout()
        {
            var testData = CreateNewSession((ProfileDTO)profiles[1].Tag, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                service.Logout(testData.Token);
            });

            var criteria = UserSearchCriteria.CreateAllCriteria();

            criteria.UserName = profiles[1].UserName;

            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            PagedResult <UserSearchDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetUsers(data.Token, criteria, pageInfo);
            });
            Assert.IsFalse(result.Items[0].IsOnline);
        }
Exemplo n.º 2
0
        public void WithoutIsDeleted()
        {
            var deletedExercise = CreateExercise(Session, null, "test", "tt");

            deletedExercise.IsDeleted = true;
            insertToDatabase(deletedExercise);
            var criteria = ExerciseSearchCriteria.CreateAllCriteria();

            criteria.ExerciseTypes.Add(Service.V2.Model.ExerciseType.Klatka);

            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            PagedResult <ExerciseDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetExercises(data.Token, criteria, pageInfo);
            });

            var count = result.Items.Where(x => x.GlobalId == deletedExercise.GlobalId).Count();

            Assert.AreEqual(0, count);
        }
        public void TestGetWorkoutPlans_OnlyOther()
        {
            WorkoutPlanSearchCriteria criteria = WorkoutPlanSearchCriteria.CreateFindAllCriteria();

            criteria.SearchGroups.Remove(WorkoutPlanSearchCriteriaGroup.Mine);
            criteria.SearchGroups.Remove(WorkoutPlanSearchCriteriaGroup.Favorites);
            PagedResult <WorkoutPlanDTO> result = null;
            var                   profile       = (ProfileDTO)profiles[0].Tag;
            SessionData           data          = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo      = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 3, new[] { "test2-3", "test2-4", "test2-7" }, null);

            profile = (ProfileDTO)profiles[1].Tag;
            data    = SecurityManager.CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 2, new[] { "test1-3", "test1-7" }, null);
        }
        public void GetUserRating()
        {
            RatingUserValue rating = new RatingUserValue();

            rating.RatedObjectId = definitions[0].GlobalId;
            rating.Rating        = 2;
            rating.ProfileId     = profiles[0].GlobalId;
            rating.VotedDate     = DateTime.UtcNow;
            insertToDatabase(rating);
            rating = new RatingUserValue();
            rating.RatedObjectId = definitions[0].GlobalId;
            rating.Rating        = 5;
            rating.ProfileId     = profiles[1].GlobalId;
            rating.VotedDate     = DateTime.UtcNow;
            insertToDatabase(rating);

            var                   param    = new GetSupplementsCycleDefinitionsParam();
            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            PagedResult <SupplementCycleDefinitionDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetSupplementsCycleDefinitions(data.Token, param, pageInfo);
            });
            Assert.AreEqual(2, result.Items.Where(x => x.GlobalId == definitions[0].GlobalId).Single().UserRating);
            Assert.AreEqual(null, result.Items.Where(x => x.GlobalId == definitions[1].GlobalId).Single().UserRating);
        }
Exemplo n.º 5
0
 public static PagedResult <SuplementDTO> GetSuplements(PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(delegate
     {
         return Instance.GetSuplements(Token, pageInfo);
     }));
 }
        public void TestGetWorkoutPlans_OnlySplit()
        {
            WorkoutPlanSearchCriteria criteria = WorkoutPlanSearchCriteria.CreateFindAllCriteria();

            criteria.WorkoutPlanType.Add(BodyArchitect.Service.Model.TrainingPlans.TrainingType.Split);
            PagedResult <WorkoutPlanDTO> result = null;
            var                   profile       = (ProfileDTO)profiles[0].Tag;
            SessionData           data          = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo      = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 2, new[] { "test1-4", "test1-6" }, null);

            profile = (ProfileDTO)profiles[1].Tag;
            data    = SecurityManager.CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 3, new[] { "test1-6", "test2-5", "test2-8" }, null);
        }
        public void TestGetWorkoutPlans_OnlyBeginners()
        {
            PagedResult <WorkoutPlanDTO> result   = null;
            WorkoutPlanSearchCriteria    criteria = WorkoutPlanSearchCriteria.CreateFindAllCriteria();

            criteria.Difficults.Add(Service.Model.TrainingPlans.TrainingPlanDifficult.Beginner);

            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 5, new[] { "test1-1", "test1-3", "test1-5", "test1-7", "test2-3" }, null);

            profile = (ProfileDTO)profiles[1].Tag;
            data    = SecurityManager.CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 6, new[] { "test1-1", "test1-3", "test1-7", "test2-3", "test2-5", "test2-8" }, null);
        }
Exemplo n.º 8
0
        public PagedResult <ActivityDTO> GetActivities(Token token, PartialRetrievingInfo retrievingInfo)
        {
            var securityInfo = SecurityManager.EnsureAuthentication(token);
            var service      = new ActivityService(Session, securityInfo, Configuration);

            return(service.GetActivities(retrievingInfo));
        }
        public void TestGetWorkoutPlans_LoadPlanContent()
        {
            WorkoutPlanSearchCriteria criteria = WorkoutPlanSearchCriteria.CreateFindAllCriteria();

            criteria.UserName = profiles[0].UserName;
            PagedResult <WorkoutPlanDTO> result = null;
            var                   profile       = (ProfileDTO)profiles[0].Tag;
            SessionData           data          = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo      = new PartialRetrievingInfo();

            pageInfo.LongTexts = false;
            pageInfo.PageSize  = 50;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            foreach (var plan in result.Items)
            {
                Assert.IsNull(plan.PlanContent);
            }

            pageInfo.LongTexts = true;
            criteria.UserName  = profiles[1].UserName;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            foreach (var plan in result.Items)
            {
                Assert.AreEqual("plan content", plan.PlanContent);
            }
        }
        void fillPage(int pageIndex)
        {
            if (tokenSource != null)
            {
                tokenSource.Cancel();
                tokenSource = null;
            }
            tokenSource = new CancellationTokenSource();
            progressIndicator.IsRunning = true;
            var recordsForUsers = RecordMode;

            Task.Factory.StartNew(delegate(object cancellationToken)
            {
                CancellationToken cancelToken = (CancellationToken)cancellationToken;
                PartialRetrievingInfo info    = new PartialRetrievingInfo();
                info.PageIndex   = pageIndex;
                var param        = new ExerciseRecordsParams();
                param.ExerciseId = exercise.GlobalId;
                param.Mode       = recordsForUsers;
                var result       = ServiceManager.ReportExerciseRecords(param, info);
                if (cancelToken.IsCancellationRequested)
                {
                    return;
                }
                lstRecords.Dispatcher.BeginInvoke(new Action(delegate
                {
                    buildPager(result.AllItemsCount, info.PageSize, pageIndex);
                    lstRecords.ItemsSource      = result.Items.Select(x => new ExerciseRecordViewModel(x, result, info.PageSize));
                    progressIndicator.IsRunning = false;
                }));
            }, tokenSource.Token, tokenSource.Token);
        }
Exemplo n.º 11
0
        public PagedResult <CommentEntryDTO> GetComments(Token token, Guid globalId, PartialRetrievingInfo retrievingInfo)
        {
            var         securityInfo = SecurityManager.EnsureAuthentication(token);
            VoteService service      = new VoteService(Session, securityInfo, Configuration, PushNotificationService, EMailService);

            return(service.GetComments(globalId, retrievingInfo));
        }
        public void TestGetWorkoutPlans_All()
        {
            PagedResult <Service.V2.Model.TrainingPlans.TrainingPlan> result = null;
            WorkoutPlanSearchCriteria criteria = new WorkoutPlanSearchCriteria();
            var                   profile      = (ProfileDTO)profiles[0].Tag;
            SessionData           data         = CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo     = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 11, null, new[] { "test2-1", "test2-5", "test2-6", "test2-8" });

            profile = (ProfileDTO)profiles[1].Tag;
            data    = CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 12, null, new[] { "test1-2", "test1-4", "test1-5" });
        }
        public void TestGetWorkoutPlans_OnlyOther()
        {
            WorkoutPlanSearchCriteria criteria = new WorkoutPlanSearchCriteria();

            criteria.SearchGroups.Add(WorkoutPlanSearchCriteriaGroup.Other);
            PagedResult <Service.V2.Model.TrainingPlans.TrainingPlan> result = null;
            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 3, new[] { "test2-3", "test2-4", "test2-7" }, null);

            profile = (ProfileDTO)profiles[1].Tag;
            data    = CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 2, new[] { "test1-3", "test1-7" }, null);
        }
Exemplo n.º 14
0
        public void GetApplicationName()
        {
            var         profile   = (ProfileDTO)profiles[0].Tag;
            SessionData data      = CreateNewSession(profile, ClientInformation, null, apiKey);
            var         loginData = Session.QueryOver <LoginData>().SingleOrDefault();

            comments[0].LoginData = loginData;
            insertToDatabase(comments[0]);
            comments[1].LoginData = loginData;
            insertToDatabase(comments[1]);

            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            PagedResult <TrainingDayCommentDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                var criteria = Mapper.Map <TrainingDay, TrainingDayDTO>(day);
                result       = Service.GetTrainingDayComments(data.Token, criteria, pageInfo);
            });
            Assert.AreEqual(apiKey.ApplicationName, result.Items[0].ApplicationName);
            Assert.AreEqual(apiKey.ApplicationName, result.Items[1].ApplicationName);
            Assert.AreEqual(null, result.Items[2].ApplicationName);
        }
Exemplo n.º 15
0
        protected override PagedResult <MyPlaceDTO> GetItemsMethod(PartialRetrievingInfo pageInfo)
        {
            var param = new MyPlaceSearchCriteria();

            param.ProfileId = key.ProfileId;
            return(ServiceManager.GetMyPlaces(param, pageInfo));
        }
        public void TestGetWorkoutPlans_UserName()
        {
            WorkoutPlanSearchCriteria criteria = WorkoutPlanSearchCriteria.CreateFindAllCriteria();

            criteria.UserName = profiles[0].UserName;

            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;
            PagedResult <WorkoutPlanDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 7, new[] { "test1-1", "test1-2", "test1-3", "test1-4", "test1-5", "test1-6", "test1-7" }, null);

            criteria.UserName = profiles[1].UserName;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetWorkoutPlans(data.Token, criteria, pageInfo);
            });
            assertWorkoutPlansListPack(result, 4, new[] { "test2-2", "test2-3", "test2-4", "test2-7" }, null);
        }
Exemplo n.º 17
0
        public void RetrieveDays(DateTime startDate, DateTime endDate)
        {
            var      param    = new WorkoutDaysSearchCriteria();
            DateTime firstDay = DateHelper.GetFirstDayOfMonth(startDate);
            DateTime endDay   = DateHelper.GetLastDayOfMonth(endDate);

            param.StartDate  = firstDay;
            param.EndDate    = endDay;
            param.CustomerId = key.CustomerId;
            param.UserId     = key.ProfileId;

            var pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = PartialRetrievingInfo.AllElementsPageSize;
            var res = ServiceManager.GetTrainingDays(param, pageInfo);

            foreach (var dto in res.Items)
            {
                days.AddOrUpdate(dto.TrainingDate, dto, (x, y) => dto);
            }
            for (int i = 0; i < endDate.MonthDifference(startDate) + 1; i++)
            {
                DateTime tempDate = startDate.AddMonths(i);
                if (!retrievedMonths.Contains(tempDate))
                {
                    retrievedMonths.Add(tempDate);
                }
            }
        }
Exemplo n.º 18
0
        public PagedResult <MyTrainingDTO> GetMyTrainings(GetMyTrainingsParam param, PartialRetrievingInfo retrievingInfo)
        {
            Log.WriteWarning("GetMyTrainings:Username={0}", SecurityInfo.SessionData.Profile.UserName);

            using (var transactionScope = Session.BeginGetTransaction())
            {
                MyTraining _temp   = null;
                var        idQuery = Session.QueryOver <MyTraining>(() => _temp);
                idQuery = (QueryOver <MyTraining, MyTraining>)getMyTrainingsCriterias(idQuery, param);
                if (idQuery == null)
                {
                    return(new PagedResult <MyTrainingDTO>(new List <MyTrainingDTO>(), 0, 0));
                }

                var fetchQuery = Session.QueryOver <MyTraining>(() => _temp)
                                 .Fetch(x => x.EntryObjects).Eager
                                 .Fetch(x => ((SuplementsEntry)x.EntryObjects.First()).Items).Eager
                                 .Fetch(x => (((SuplementsEntry)x.EntryObjects.First()).Items).First().Suplement).Eager
                                 .Fetch(x => ((StrengthTrainingEntry)x.EntryObjects.First()).Entries).Eager
                                 .Fetch(x => (((StrengthTrainingEntry)x.EntryObjects.First()).Entries).First().Exercise).Eager
                                 .Fetch(x => x.EntryObjects.First().LoginData).Eager
                                 .Fetch(x => x.EntryObjects.First().LoginData.ApiKey).Eager
                                 .Fetch(x => x.EntryObjects.First().Reminder).Eager
                                 .Fetch(x => x.EntryObjects.First().TrainingDay).Eager
                                 .Fetch(x => x.EntryObjects.First().TrainingDay.Objects).Lazy;

                var listPack = fetchQuery.ToExPagedResults <MyTrainingDTO, MyTraining>(retrievingInfo, idQuery);
                transactionScope.Commit();
                return(listPack);
            }
        }
Exemplo n.º 19
0
        public void TestGetExercises_UserName()
        {
            var criteria = ExerciseSearchCriteria.CreateAllCriteria();

            criteria.UserId = profiles[1].Id;

            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;

            PagedResult <ExerciseDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                result = Service.GetExercises(data.Token, criteria, pageInfo);
            });

            assertExercisesListPack(result, 5, new[] { "t22", "t23", "t25", "t26", "t28" }, null);

            profile = (ProfileDTO)profiles[1].Tag;
            data    = SecurityManager.CreateNewSession(profile, ClientInformation);
            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                result = Service.GetExercises(data.Token, criteria, pageInfo);
            });

            assertExercisesListPack(result, 8, new[] { "t21", "t22", "t23", "t24", "t25", "t26", "t27", "t28" }, null);
        }
Exemplo n.º 20
0
        public void Load()
        {
            if (dictExercises == null || ShouldRefresh)
            {
                PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();
                pageInfo.PageSize = 0;

                var m = new ServiceManager <ARG>(delegate(BodyArchitectAccessServiceClient client1, EventHandler <ARG> operationCompleted)
                {
                    RetrieveObjects(client1, pageInfo, operationCompleted);
                });
                m.OperationCompleted += OnOperationCompleted;
                if (!m.Run())
                {
                    if (ApplicationState.Current.IsOffline)
                    {
                        BAMessageBox.ShowError(ApplicationStrings.ErrOfflineMode);
                    }
                    else
                    {
                        BAMessageBox.ShowError(ApplicationStrings.ErrNoNetwork);
                    }
                    onLoaded();
                }
            }
            else
            {
                onLoaded();
            }
        }
Exemplo n.º 21
0
 void fillPage(int pageIndex)
 {
     if (tokenSource != null)
     {
         tokenSource.Cancel();
         tokenSource = null;
     }
     tokenSource = new CancellationTokenSource();
     startProgress(true);
     var task = Task.Factory.StartNew(delegate(object cancellationToken)
     {
         CancellationToken cancelToken = (CancellationToken)cancellationToken;
         PartialRetrievingInfo info    = new PartialRetrievingInfo();
         info.PageIndex = pageIndex;
         var result     = ServiceManager.GetBlogComments(entry, info);
         if (cancelToken.IsCancellationRequested)
         {
             //lstComments.Dispatcher.Invoke(new Action(delegate
             //{
             //    startProgress(false);
             //}));
             return;
         }
         lstComments.Dispatcher.Invoke(new Action(delegate
         {
             buildPager(result.AllItemsCount, info.PageSize, pageIndex);
             lstComments.ItemsSource = result.Items;
             startProgress(false);
         }));
     }, tokenSource.Token, tokenSource.Token);
 }
 private void FillCalendar(DateTime startDate, DateTime endDate)
 {
     if (!UserContext.IsInstructor)
     {
         return;
     }
     if (fillCancelSource != null)
     {
         fillCancelSource.Cancel();
         fillCancelSource = null;
     }
     fillCancelSource = parentView.RunAsynchronousOperation(delegate(OperationContext context)
     {
         var param         = new GetScheduleEntriesParam();
         param.StartTime   = startDate.ToUniversalTime();
         param.EndTime     = endDate.ToUniversalTime();
         var pageInfo      = new PartialRetrievingInfo();
         pageInfo.PageSize = -1;
         var items         = ServiceManager.GetScheduleEntries(param, pageInfo);
         if (context != null && context.CancellatioToken.IsCancellationRequested)
         {
             return;
         }
         originalEntries = items.Items.StandardClone().ToArray();
         parentView.SynchronizationContext.Send(delegate
         {
             fillAppointments(items.Items);
             IsModified = false;
         }, null);
     });
 }
Exemplo n.º 23
0
        public void TestGetExercises_OnlyGlobalAndMine()
        {
            var criteria = ExerciseSearchCriteria.CreatePersonalCriteria();

            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;
            PagedResult <ExerciseDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetExercises(data.Token, criteria, pageInfo);
            });
            assertExercisesListPack(result, 21, new[] { "t01", "t02", "t03", "t04", "t05", "t06", "t07", "t08",
                                                        "t11", "t12", "t13", "t14", "t15", "t16", "t17", "t18", "t19", "t22", "t23", "t25", "t26" }, null);

            profile = (ProfileDTO)profiles[1].Tag;
            data    = SecurityManager.CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetExercises(data.Token, criteria, pageInfo);
            });
            assertExercisesListPack(result, 20, new[] { "t01", "t02", "t03", "t04", "t05", "t06", "t07", "t08",
                                                        "t21", "t22", "t23", "t24", "t25", "t26", "t27", "t28", "t12", "t13", "t15", "t16" }, null);
        }
Exemplo n.º 24
0
        public void TestGetExercises_EmptyCriteria()
        {
            var                   criteria = new ExerciseSearchCriteria();
            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;
            PagedResult <ExerciseDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetExercises(data.Token, criteria, pageInfo);
            });
            assertExercisesListPack(result, 0, null, null);

            profile = (ProfileDTO)profiles[1].Tag;
            data    = SecurityManager.CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetExercises(data.Token, criteria, pageInfo);
            });
            assertExercisesListPack(result, 0, null, null);
        }
Exemplo n.º 25
0
        public void TestGetExercises_OnlyBicepsAvailableForUser()
        {
            var criteria = ExerciseSearchCriteria.CreateAllCriteria();

            criteria.ExerciseTypes.Add(Service.Model.ExerciseType.Biceps);
            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;
            PagedResult <ExerciseDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetExercises(data.Token, criteria, pageInfo);
            });
            assertExercisesListPack(result, 7, new[] { "t02", "t04", "t05", "t12", "t14", "t15", "t25" }, null);

            profile = (ProfileDTO)profiles[1].Tag;
            data    = SecurityManager.CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService service)
            {
                result = service.GetExercises(data.Token, criteria, pageInfo);
            });
            assertExercisesListPack(result, 7, new[] { "t02", "t04", "t05", "t21", "t25", "t12", "t15" }, null);
        }
Exemplo n.º 26
0
        public void TestGetExercises_PendingPublishOnly()
        {
            var criteria = new ExerciseSearchCriteria();

            criteria.SearchGroups.Add(ExerciseSearchCriteriaGroup.PendingPublish);

            var                   profile  = (ProfileDTO)profiles[0].Tag;
            SessionData           data     = SecurityManager.CreateNewSession(profile, ClientInformation);
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 50;
            PagedResult <ExerciseDTO> result = null;

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                result = Service.GetExercises(data.Token, criteria, pageInfo);
            });
            assertExercisesListPack(result, 2, new[] { "t19", "t28" }, null);

            profile = (ProfileDTO)profiles[1].Tag;
            data    = SecurityManager.CreateNewSession(profile, ClientInformation);

            RunServiceMethod(delegate(InternalBodyArchitectService Service)
            {
                result = Service.GetExercises(data.Token, criteria, pageInfo);
            });
            assertExercisesListPack(result, 2, new[] { "t19", "t28" }, null);
        }
Exemplo n.º 27
0
        protected override PagedResult <MyTrainingDTO> GetItemsMethod(PartialRetrievingInfo pageInfo)
        {
            GetMyTrainingsParam param = new GetMyTrainingsParam();

            param.CustomerId = key.CustomerId;
            param.UserId     = key.ProfileId;
            return(ServiceManager.GetMyTrainings(param, new PartialRetrievingInfo()));
        }
Exemplo n.º 28
0
 protected override PagedResult <CommentEntryDTO> RetrieveItems(PartialRetrievingInfo pagerInfo)
 {
     if (plan != null)
     {
         return(ServiceManager.GetComments(plan, pagerInfo));
     }
     return(new PagedResult <CommentEntryDTO>(new List <CommentEntryDTO>(), 0, 0));
 }
Exemplo n.º 29
0
        protected override PagedResult <TrainingPlan> GetItemsMethod(PartialRetrievingInfo pageInfo)
        {
            WorkoutPlanSearchCriteria criteria = new WorkoutPlanSearchCriteria();

            criteria.SearchGroups.Add(WorkoutPlanSearchCriteriaGroup.Mine);
            criteria.SearchGroups.Add(WorkoutPlanSearchCriteriaGroup.Favorites);
            return(ServiceManager.GetWorkoutPlans(criteria, pageInfo));
        }
Exemplo n.º 30
0
 public void DoSearch(object param = null)
 {
     BeforeSearch(param);
     Items.Clear();
     SearchStatus = string.Empty;
     pagerInfo    = new PartialRetrievingInfo();
     fillPage(0);
 }