예제 #1
0
 public static PagedResult <ActivityDTO> GetActivities()
 {
     return(exceptionHandling(delegate
     {
         PartialRetrievingInfo pagerInfo = new PartialRetrievingInfo();
         pagerInfo.PageSize = -1;
         return Instance.GetActivities(Token, pagerInfo);
     }));
 }
예제 #2
0
 public static PagedResult <SuplementDTO> GetSuplements(PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(delegate
     {
         var param = new GetSupplementsParam();
         param.SortOrder = SearchSortOrder.Name;
         return Instance.GetSuplements(Token, param, pageInfo);
     }));
 }
예제 #3
0
 public static PagedResult <CustomerDTO> GetCustomers(CustomerSearchCriteria customerSearchCriteria)
 {
     return(exceptionHandling(delegate
     {
         PartialRetrievingInfo pagerInfo = new PartialRetrievingInfo();
         pagerInfo.PageSize = -1;
         return Instance.GetCustomers(Token, customerSearchCriteria, pagerInfo);
     }));
 }
예제 #4
0
        public async void RetrieveMonth(DateTime monthDate, TrainingDaysHolder holder)
        {
            DateTime monthTOShow             = monthDate;
            WorkoutDaysSearchCriteria search = new WorkoutDaysSearchCriteria();

            search.UserId     = holder.User != null ? (Guid?)holder.User.GlobalId : null;
            search.CustomerId = holder.CustomerId;
            search.EndDate    = monthDate.AddMonths(1);
            if (Settings.NumberOfMonthToRetrieve > 1)
            {//-1 because we need to subtract months
                monthDate = monthDate.AddMonths(-1 * (Settings.NumberOfMonthToRetrieve - 1));
            }
            search.StartDate = monthDate;
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 0;//we want to download all entries in selected period of time



            var m = new ServiceManager <GetTrainingDaysCompletedEventArgs>(delegate(BodyArchitectAccessServiceClient client1, EventHandler <GetTrainingDaysCompletedEventArgs> operationCompleted)
            {
                client1.GetTrainingDaysCompleted -= operationCompleted;
                client1.GetTrainingDaysCompleted += operationCompleted;
                client1.GetTrainingDaysAsync(ApplicationState.Current.SessionData.Token, search, pageInfo);
            });

            m.OperationCompleted += (s, a) =>
            {
                if (a.Error != null)
                {
                    onTrainingDaysRetrieved(monthTOShow);
                    BAMessageBox.ShowError(ApplicationStrings.ApplicationState_ErrRetrieveTrainingDays);
                    return;
                }
                if (a.Result != null && a.Result.Result != null)
                {
                    RetrievedDays(monthDate, Settings.NumberOfMonthToRetrieve, a.Result.Result.Items, holder);
                    onTrainingDaysRetrieved(monthTOShow);
                }
            };

            if (!m.Run())
            {
                if (ApplicationState.Current.IsOffline)
                {
                    BAMessageBox.ShowError(ApplicationStrings.ErrOfflineMode);
                }
                else
                {
                    BAMessageBox.ShowError(ApplicationStrings.ErrNoNetwork);
                }
                onTrainingDaysRetrieved(monthTOShow);
            }
        }
예제 #5
0
        public PagedResult <ExerciseDTO> GetExercises(Token token, ExerciseSearchCriteria searchCriteria, PartialRetrievingInfo retrievingInfo)
        {
            BodyArchitect.Service.V2.InternalBodyArchitectService service = new V2.InternalBodyArchitectService(NHibernateContext.Current().Session);
            V2.Model.Token v2token = new V2.Model.Token(token.SessionId, token.Language);
            V2.Model.ExerciseSearchCriteria crit = new V2.Model.ExerciseSearchCriteria();
            V2.Model.PartialRetrievingInfo  nfo  = new V2.Model.PartialRetrievingInfo();
            crit = Mapper.Map <V2.Model.ExerciseSearchCriteria>(searchCriteria);
            nfo  = Mapper.Map <V2.Model.PartialRetrievingInfo>(retrievingInfo);

            var res = service.GetExercises(v2token, crit, nfo);
            var ret = Mapper.Map <V2.Model.PagedResult <V2.Model.ExerciseDTO>, PagedResult <ExerciseDTO> >(res);

            return(ret);
        }
예제 #6
0
 public static PagedResult <ExerciseRecordsReportResultItem> ReportExerciseRecords(ExerciseRecordsParams param, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(() => Instance.ReportExerciseRecords(Token, param, pageInfo)));
 }
예제 #7
0
 public static PagedResult <MessageDTO> GetMessages(GetMessagesCriteria param, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(() => Instance.GetMessages(Token, param, pageInfo)));
 }
예제 #8
0
 public static PagedResult <MyPlaceDTO> GetMyPlaces(MyPlaceSearchCriteria param, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(() => Instance.GetMyPlaces(Token, param, pageInfo)));
 }
예제 #9
0
 public static PagedResult <SupplementCycleDefinitionDTO> GetSupplementsCycleDefinitions(GetSupplementsCycleDefinitionsParam param, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(() => Instance.GetSupplementsCycleDefinitions(Token, param, pageInfo)));
 }
예제 #10
0
 public static PagedResult <MyTrainingDTO> GetMyTrainings(GetMyTrainingsParam param, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(() => Instance.GetMyTrainings(Token, param, pageInfo)));
 }
예제 #11
0
 public static PagedResult <ProductInfoDTO> GetProducts(GetProductsParam criteria, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(() => Instance.GetProducts(Token, criteria, pageInfo)));
 }
예제 #12
0
 public static PagedResult <ReminderItemDTO> GetReminders(GetRemindersParam remindersParam, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(() => Instance.GetReminders(Token, remindersParam, pageInfo)));
 }
예제 #13
0
 public static PagedResult <TrainingDayDTO> GetTrainingDays(WorkoutDaysSearchCriteria searchCriteria, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(delegate
     {
         return Instance.GetTrainingDays(Token, searchCriteria, pageInfo);
     }));
 }
예제 #14
0
 public static PagedResult <ExerciseDTO> GetExercises(ExerciseSearchCriteria searchCriteria, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(delegate
     {
         pageInfo.PageSize = GetPageSize(150);
         return Instance.GetExercises(Token, searchCriteria, pageInfo);
     }));
 }
예제 #15
0
 public static PagedResult <ChampionshipDTO> GetChampionships(GetChampionshipsCriteria criteria, PartialRetrievingInfo retrievingInfo)
 {
     return(exceptionHandling(() => Instance.GetChampionships(Token, criteria, retrievingInfo)));
 }
예제 #16
0
 public static PagedResult <ScheduleEntryBaseDTO> GetScheduleEntries(GetScheduleEntriesParam getScheduleEntriesParam, PartialRetrievingInfo retrievingInfo)
 {
     return(exceptionHandling(delegate
     {
         retrievingInfo.PageSize = GetPageSize(retrievingInfo.PageSize);
         return Instance.GetScheduleEntries(Token, getScheduleEntriesParam, retrievingInfo);
     }));
 }
예제 #17
0
 public static PagedResult <TrainingPlan> GetWorkoutPlans(WorkoutPlanSearchCriteria searchCriteria, PartialRetrievingInfo pagerInfo)
 {
     return(exceptionHandling(delegate
     {
         pagerInfo.LongTexts = false;
         return Instance.GetWorkoutPlans(Token, searchCriteria, pagerInfo);
     }));
 }
예제 #18
0
 public static PagedResult <UserSearchDTO> GetUsers(UserSearchCriteria searchCriteria, PartialRetrievingInfo pagerInfo)
 {
     return(exceptionHandling(() =>
     {
         pagerInfo.PageSize = GetPageSize(40);
         return Instance.GetUsers(Token, searchCriteria, pagerInfo);
     }));
 }
예제 #19
0
 public static PagedResult <CommentEntryDTO> GetComments(IRatingable ratingable, PartialRetrievingInfo retrievingInfo)
 {
     return(exceptionHandling(delegate
     {
         retrievingInfo.PageSize = GetPageSize(retrievingInfo.PageSize);
         return Instance.GetComments(Token, ratingable.GlobalId, retrievingInfo);
     }));
 }
예제 #20
0
        public async Task RetrieveMonthAsync(DateTime monthDate, TrainingDaysHolder holder)
        {
            DateTime monthTOShow             = monthDate;
            WorkoutDaysSearchCriteria search = new WorkoutDaysSearchCriteria();

            search.UserId     = holder.User != null ? (Guid?)holder.User.GlobalId : null;
            search.CustomerId = holder.CustomerId;
            search.EndDate    = monthDate.AddMonths(1);
            if (Settings.NumberOfMonthToRetrieve > 1)
            {//-1 because we need to subtract months
                monthDate = monthDate.AddMonths(-1 * (Settings.NumberOfMonthToRetrieve - 1));
            }
            search.StartDate = monthDate;
            PartialRetrievingInfo pageInfo = new PartialRetrievingInfo();

            pageInfo.PageSize = 0;//we want to download all entries in selected period of time

            try
            {
                var result = await BAService.GetTrainingDaysAsync(search, pageInfo);

                RetrievedDays(monthDate, Settings.NumberOfMonthToRetrieve, result.Items, holder);
            }
            catch (NetworkException)
            {
                if (ApplicationState.Current.IsOffline)
                {
                    BAMessageBox.ShowWarning(ApplicationStrings.EntryObjectPageBase_SavedLocallyOnly);
                }
                else
                {
                    BAMessageBox.ShowError(ApplicationStrings.ErrNoNetwork);
                }
            }
            catch (Exception)
            {
                BAMessageBox.ShowError(ApplicationStrings.ApplicationState_ErrRetrieveTrainingDays);
            }



            //var m = new ServiceManager<GetTrainingDaysCompletedEventArgs>(delegate(BodyArchitectAccessServiceClient client1, EventHandler<GetTrainingDaysCompletedEventArgs> operationCompleted)
            //{
            //    client1.GetTrainingDaysCompleted -= operationCompleted;
            //    client1.GetTrainingDaysCompleted += operationCompleted;
            //    client1.GetTrainingDaysAsync(ApplicationState.Current.SessionData.Token, search, pageInfo);
            //});
            //m.OperationCompleted += (s, a) =>
            //   {

            //    if (a.Error != null)
            //    {
            //        onTrainingDaysRetrieved(monthTOShow);
            //        BAMessageBox.ShowError(ApplicationStrings.ApplicationState_ErrRetrieveTrainingDays);
            //        return;
            //    }
            //    if (a.Result != null && a.Result.Result!=null )
            //    {
            //        RetrievedDays(monthDate, Settings.NumberOfMonthToRetrieve, a.Result.Result.Items, holder);
            //        onTrainingDaysRetrieved(monthTOShow);
            //    }
            //};

            //if(!m.Run())
            //{
            //    if(ApplicationState.Current.IsOffline)
            //    {
            //        BAMessageBox.ShowError(ApplicationStrings.ErrOfflineMode);
            //    }
            //    else
            //    {
            //        BAMessageBox.ShowError(ApplicationStrings.ErrNoNetwork);
            //    }
            //    onTrainingDaysRetrieved(monthTOShow);
            //}
        }
예제 #21
0
 public static PagedResult <PaymentBasketDTO> GetPaymentBaskets(GetPaymentBasketParam getPaymentBasketParam, PartialRetrievingInfo retrievingInfo)
 {
     return(exceptionHandling(() => Instance.GetPaymentBaskets(Token, getPaymentBasketParam, retrievingInfo)));
 }
예제 #22
0
 public static PagedResult <CustomerGroupDTO> GetCustomerGroups(CustomerGroupSearchCriteria criteria, PartialRetrievingInfo pageInfo)
 {
     return(exceptionHandling(() => Instance.GetCustomerGroups(Token, criteria, pageInfo)));
 }
예제 #23
0
 public static PagedResult <TrainingDayCommentDTO> GetBlogComments(TrainingDayInfoDTO day, PartialRetrievingInfo info)
 {
     return(exceptionHandling(delegate
     {
         info.PageSize = GetPageSize(info.PageSize);
         return Instance.GetTrainingDayComments(Token, day, info);
     }));
 }