Exemple #1
0
        private List <Tracker> BuildTracker()
        {
            var trackerList = new List <Tracker>();

            trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.CURRENT_WEIGHT,
                                                            CurrentWeightValue.ToString()));

            trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.CURRENT_WEIGHT_UI,
                                                            CurrentWeightValue.ToString()));

            trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.WEIGHT_VOLUME_TYPE,
                                                            App.Configuration.AppConfig.DefaultWeightVolume));

            if (GoalAchieved)
            {
                trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.TSHIRT_SIZE,
                                                                TShirtSize.Trim()));
                trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.FRONT_IMAGE,
                                                                ImageFront.Trim()));
                trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.SIDE_IMAGE,
                                                                ImageSide.Trim()));
                trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.ABOUT_JOURNEY,
                                                                AboutYourJourney.Trim()));
            }

            return(trackerList);
        }
Exemple #2
0
        private async Task <List <Tracker> > BuildTracker()
        {
            var trackerList = new List <Tracker>();
            await Task.Run(async() =>
            {
                trackerList.Add(await trackerService.AddTracker(TrackerConstants.CURRENT_WEIGHT,
                                                                CurrentWeightValue.ToString()));
                if (GoalAchieved)
                {
                    trackerList.Add(await trackerService.AddTracker(TrackerConstants.TSHIRT_SIZE,
                                                                    TShirtSize.Trim()));
                    trackerList.Add(await trackerService.AddTracker(TrackerConstants.FRONT_IMAGE,
                                                                    ImageFront.Trim()));
                    trackerList.Add(await trackerService.AddTracker(TrackerConstants.SIDE_IMAGE,
                                                                    ImageSide.Trim()));
                    trackerList.Add(await trackerService.AddTracker(TrackerConstants.ABOUT_JOURNEY,
                                                                    AboutYourJourney.Trim()));
                }
            });

            return(trackerList);
        }
Exemple #3
0
        private async Task <bool> Validate()
        {
            var validationErrors = new ValidationErrors();
            await Task.Run(() =>
            {
                // Current Weight
                if (CurrentWeightValue == 0)
                {
                    validationErrors.Add(
                        string.Format(TextResources.Required_IsMandatory, TextResources.WeightLossGoal));
                }
                else if (CurrentWeightValue < App.Configuration.AppConfig.MINIMUM_WEIGHT_LOSE)
                {
                    validationErrors.Add(string.Format(TextResources.Validation_MustBeMoreThan,
                                                       TextResources.WeightLossGoal, App.Configuration.AppConfig.MINIMUM_WEIGHT_LOSE));
                }

                if (GoalAchieved)
                {
                    // Front Photo
                    if (ImageFront == null || ImageFront.Trim().Length == 0 ||
                        ImageFront == ImageDefault)
                    {
                        validationErrors.Add(string.Format(TextResources.Required_MustBeSelected,
                                                           TextResources.FrontPhoto));
                    }
                    // Side Photo
                    if (ImageSide == null || ImageSide.Trim().Length == 0 ||
                        ImageSide == ImageDefault)
                    {
                        validationErrors.Add(string.Format(TextResources.Required_MustBeSelected,
                                                           TextResources.SidePhoto));
                    }
                    //Gender
                    if (IsGenderRequired && !IsGenderSelected)
                    {
                        validationErrors.Add(string.Format(TextResources.Required_MustBeSelected,
                                                           TextResources.Gender));
                    }
                    // T-Shirt Size
                    if (TShirtSize == null || TShirtSize.Trim().Length == 0)
                    {
                        validationErrors.Add(string.Format(TextResources.Required_MustBeSelected,
                                                           TextResources.TShirtSize));
                    }
                    // Why you want to join
                    if (AboutYourJourney == null || AboutYourJourney.Trim().Length == 0)
                    {
                        validationErrors.Add(string.Format(TextResources.Required_IsMandatory,
                                                           TextResources.AboutYourJourney));
                    }
                }
            });

            if (validationErrors.Count() > 0)
            {
                SetActivityResource(showError: true,
                                    errorMessage: validationErrors.Count() > 2
                        ? TextResources.PleaseReviewAllInputsAreMandatory
                        : validationErrors.Show("\n"));
            }
            return(validationErrors.Count() == 0);
        }