예제 #1
0
		public MemberProfilePage(User selectedUser, byte[] memberImage = null)
		{

			InitializeComponent();

			ViewModel = new MemberProfileViewModel(selectedUser);
			BindingContext = ViewModel;

			familyMembersListView.ItemTapped += (object sender, ItemTappedEventArgs e) =>
			{
				// don't do anything if we just de-selected the row
				if (e.Item == null) return;

				// do something with e.SelectedItem
				ViewModel.NavigateFamilyMemberCommand.Execute(e.Item as User);

				((ListView)sender).SelectedItem = null; // de-select the row
			};

			if (memberImage != null)
			{
				memberProfileImage.Source = ImageSource.FromStream(() => new MemoryStream(memberImage));
			}




		}
예제 #2
0
		public mpWorkoutsPage(User selectedUser)
		{
			ViewModel = new WorkoutsViewModel(selectedUser);
			InitializeComponent();

			this.BindingContext = ViewModel;

			listView.ItemTapped += (object sender, ItemTappedEventArgs e) =>
			{
				if (e.Item != null)
				{
					UserExerciseGroupViewModel vm = (UserExerciseGroupViewModel)e.Item;
					vm.MemberWorkoutExerciseSet.Execute(vm);
				}
			};

			listView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) =>
			{
				// don't do anything if we just de-selected the row
				if (e.SelectedItem == null) return;
				// do something with e.SelectedItem
				((ListView)sender).SelectedItem = null; // de-select the row
			};

			if (Device.OS == TargetPlatform.iOS)
			{
				listView.HasUnevenRows = true;
			}

		}
예제 #3
0
		public GoalHistoryViewModel(User selectedUser)
		{
			SelectedUser = selectedUser;
			//get the Member Image
			if(SelectedUser.ImageURL == null || SelectedUser.ImageURL == ""){
				MemberImage = "memberpic.png";

			}else{

				MemberImage = SelectedUser.ImageURL;
			}
			GoalHistoryList = new ObservableCollection<GoalHistory> ();
			if (CrossConnectivity.Current.IsConnected) {
				Task.Run (async() => {
					var goalHistoryDBList = await GoalHistoryDAL.GetGoalHistory (SelectedUser.ProfileID);
					foreach (var gHistoryDB in goalHistoryDBList) {
						await GoalHistoryDAL.DeleteGoalHistory (gHistoryDB);
					}
					var goalHistoryListAPI = await CoachServices.RequestGoalHistory (SelectedUser.ProfileID);
					foreach (var goalHistoryDTO in goalHistoryListAPI) {
						GoalHistory goalHistory = new GoalHistory (goalHistoryDTO);
						await GoalHistoryDAL.InsertGoalHistory (goalHistory);
					}
					var goalHistoryDBList2 = await GoalHistoryDAL.GetGoalHistory (SelectedUser.ProfileID);
					//goalHistoryDBList2 = goalHistoryDBList2.OrderByDescending(row => row.Id).ToList();
					GoalHistoryList = new ObservableCollection<GoalHistory> (goalHistoryDBList2);
				});
			} else {
				DependencyService.Get<ICustomDialog>().Display("You are not connected to a network. The displayed data might not be up to date.", "OK");
				Task.Run (async() => {
					var goalHistoryDBList = await GoalHistoryDAL.GetGoalHistory(SelectedUser.ProfileID);
					GoalHistoryList = new ObservableCollection<GoalHistory> (goalHistoryDBList);
				});
			}
		}
예제 #4
0
		public mpEditPage (User selectedUser)
		{
			InitializeComponent ();

			ViewModel = new ModifyMemberProfileViewModel (selectedUser);
			BindingContext = ViewModel;

			phoneNumber.TextChanged += Utility.ValidatePhoneNumber;
		}
예제 #5
0
		public BarrierStrategyModal (User selectedUser, BarriersAvailable barrierAvailable, MemberBarriers memberBarrier = null)
		{
			InitializeComponent ();
			_viewModel = new BarrierStrategyViewModel (selectedUser, barrierAvailable, this, memberBarrier);

			this.BindingContext = _viewModel;



		}
예제 #6
0
		public CameraPage (bool isMemberImage = false, User selectedUser = null)
		{
			InitializeComponent ();
			if (isMemberImage) {
				IsMemberImage = true;
			}
			if (selectedUser != null) {
				SelectedUser = selectedUser;
			}
		}
		public ModifyMemberProfileViewModel (User selectedUser)
		{
			IsProcessing = true;
			SelectedUser = selectedUser;

			//get the Member Image
			if (SelectedUser.ImageURL == null || SelectedUser.ImageURL == "") {
				MemberImage = "memberpic.png";

			} else {

				MemberImage = SelectedUser.ImageURL;
			}
			MemberProfileProperty = new MemberProfile ();
			MemberProfileProperty.DOB = DateTime.Now.Date.ToString ();
			if (CrossConnectivity.Current.IsConnected) {
				Task.Run (async() => {
					
					var memberProfile = await CoachServices.RequestMemberProfile (SelectedUser.ProfileID);

					var memberProfileDB = await MemberProfileDAL.GetMemberProfile (selectedUser.ProfileID);

					if (memberProfileDB != null && memberProfileDB.ProfileID == selectedUser.ProfileID) {
						await MemberProfileDAL.ModifyMemberProfile (memberProfile);
					} else {
						await MemberProfileDAL.InsertMemberProfile (memberProfile);
					}

					var memberProfileDB2 = await MemberProfileDAL.GetMemberProfile (selectedUser.ProfileID);

					MemberProfileProperty = memberProfileDB2;

					if (MemberProfileProperty.Password_Encrypted != null) {
						var byteArray = Convert.FromBase64String (MemberProfileProperty.Password_Encrypted);
						Password = UTF8Encoding.UTF8.GetString (byteArray, 0, byteArray.Count ());
					}

					IsProcessing = false;

				});
			} else {
				DependencyService.Get<ICustomDialog> ().Display ("You are not connected to a network. Member profile updates cannot be made without a network connection.", "OK");
				Task.Run (async() => {
					IsProcessing = true;
					var memberProfileDB2 = await MemberProfileDAL.GetMemberProfile (selectedUser.ProfileID);

					if (memberProfileDB2 != null) {
						MemberProfileProperty = memberProfileDB2;
					}
					IsProcessing = false;
				});
			}
		}
예제 #8
0
		public mpGoalsPage (User user)
		{
			InitializeComponent ();
			SelectedUser = user;
			ViewModel = new mpGoalsViewModel (SelectedUser);
			this.BindingContext = ViewModel;
			listView.ItemTapped += (object sender, ItemTappedEventArgs e) => {
				((ListView)sender).SelectedItem = null; // de-select the row
			};
			listView2.ItemTapped += (object sender, ItemTappedEventArgs e) => {
				((ListView)sender).SelectedItem = null; // de-select the row
			};

		}
예제 #9
0
		public AddNotesViewModel(User selectedUser)
		{
			SelectedUser = selectedUser;
			//get the Member Image
			if(SelectedUser.ImageURL == null || SelectedUser.ImageURL == ""){
				MemberImage = "memberpic.png";

			}else{

				MemberImage = SelectedUser.ImageURL;
			}


		}
		public mpEngagementNotesPage(User selectedUser)
		{
			InitializeComponent();
			ViewModel = new EngagementNotesViewModel(selectedUser);
			this.BindingContext = ViewModel;

			//this turns off the weird gray highlight when you tap listview item
			engagementNotesListView.ItemTapped += (object sender, ItemTappedEventArgs e) =>
			{
				// don't do anything if we just de-selected the row
				if (e.Item == null) return;
				// do something with e.SelectedItem
				((ListView)sender).SelectedItem = null; // de-select the row
			};
		}
예제 #11
0
		public BarrierStrategyViewModel(User selectedUser, BarriersAvailable barrierAvailable, Page page, MemberBarriers memberBarrier = null)
		{
			SelectedUser = selectedUser;
			BarrierAvailableProperty = barrierAvailable;

			PageProperty = page;
			if (memberBarrier == null) {
				BarrierName = barrierAvailable.BarrierIDTitle;
				memberBarrier = new MemberBarriers ();
				memberBarrier.BarrierDisplayValue = BarrierAvailableProperty.BarrierIDTitle;
				memberBarrier.BarrierID = BarrierAvailableProperty.BarrierID;
				memberBarrier.ProfileID = selectedUser.ProfileID;
			} else {
				BarrierName = memberBarrier.BarrierDisplayValue;
			}
			MemberBarrier = memberBarrier;
		}
예제 #12
0
		public EngagementNotesViewModel(User selectedUser)
		{
			SelectedUser = selectedUser;

			//get the Member Image
			if (SelectedUser.ImageURL == null || SelectedUser.ImageURL == "")
			{
				MemberImage = "memberpic.png";

			}
			else {

				MemberImage = SelectedUser.ImageURL;
			}

			EngagementNotesList = new ObservableCollection<EngagementNotes>();
			if (CrossConnectivity.Current.IsConnected)
			{
				Task.Run(async () =>
			   {
				   var engagementNotesListAPI = await CoachServices.GetEngagementNotes(SelectedUser.ProfileID);
				   if (engagementNotesListAPI.Count() > 0)
				   {
					   var engagementListDBDelete = await EngagementNotesDAL.GetEngagementNotes(SelectedUser.ProfileID);
					   foreach (var note in engagementListDBDelete)
					   {
						   await EngagementNotesDAL.DeleteEngagementNotes(note);
					   }
				   }
				   foreach (var engagementNote in engagementNotesListAPI)
				   {
					   await EngagementNotesDAL.SaveEngagementNotesRecord(Convert.ToDateTime(engagementNote.DateTime), engagementNote.GymID, engagementNote.ProfileID, engagementNote.Note, engagementNote.EngagementNoteID, engagementNote.UserID, engagementNote.StaffName);
				   }
			   });
			}
			else {
				DependencyService.Get<ICustomDialog>().Display("You are not connected to a network. The displayed data might not be up to date.", "OK");
				Task.Run(async () =>
				{
					var engagementListDB = await EngagementNotesDAL.GetEngagementNotes(SelectedUser.ProfileID);
					engagementListDB = engagementListDB.OrderByDescending(row => row.DateTime).ToList();
					EngagementNotesList = new ObservableCollection<EngagementNotes>(engagementListDB);
				});
			}
		}
예제 #13
0
		public WorkoutContainerViewModel(IWorkoutCreatorContext workoutCreatorContext, IConnectivity current, bool createWorkoutOnly = false, User logFeedbackOnlyUser = null)
		{
			WorkoutCreatorContext = workoutCreatorContext;
			Current = current;

			if (createWorkoutOnly)
			{
				Header = "Create Workout";
			}
			else {
				if (logFeedbackOnlyUser == null)
				{
					Header = "Create/Record Workout";
				}
				else {
					Header = "Log Feedback";
				}
			}
		}
		public mpTrainerAvailabilityPage (User selectedUser, int appointmentID)
		{
			InitializeComponent ();
			ViewModel = new TrainerAvailabilityViewModel (selectedUser, appointmentID);
			this.BindingContext = ViewModel;
			TrainerImage =  "memberpic.png";
			datePicker.DateSelected += (object sender, DateChangedEventArgs e) => {
				ViewModel.DateChangedCommand.Execute(null);
			};

			availabilityListView.ItemSelected += (sender, args) => {
				if (args.SelectedItem != null) {
					availabilityListView.SelectedItem = null;

					TrainerAvailabilityDTO trainerAvailability = (TrainerAvailabilityDTO)args.SelectedItem;
					ViewModel.ScheduleAppointmentCommand.Execute(trainerAvailability);

				}
			};
		}
예제 #15
0
		public AppointmentFormViewModel (User selectedUser, AppointmentStatusDTO appointmentStatus)
		{
			SelectedUser = selectedUser;
			//get the Member Image
			if(SelectedUser.ImageURL == null || SelectedUser.ImageURL == ""){
				MemberImage = "memberpic.png";

			}else{

				MemberImage = SelectedUser.ImageURL;
			}

			AppointmentQuestionList = new ObservableCollection<AppointmentQuestionDTO> ();
			QuestionGroupList = new ObservableCollection<AppointmentQuestionGroup>();
			if (CrossConnectivity.Current.IsConnected) {
				Task.Run (async() => {
					IsProcessing = true;
					string token = await TokenManager.GetToken ();
					int section = appointmentStatus.SurveySectionID;
					var appointmentQuestionListAPI = await CoachServices.RequestAppointmentQuestions(token,SelectedUser.GymID,section,SelectedUser.ProfileID);


					AppointmentQuestionList = new ObservableCollection<AppointmentQuestionDTO> (appointmentQuestionListAPI);

						
					foreach(var rSumm in AppointmentQuestionList)
					{
						AppointmentQuestionGroup responseSummaryGroup = new AppointmentQuestionGroup(rSumm.QuestionOptions, rSumm.QuestionText, rSumm.Form, rSumm.ID, rSumm.QuestionType);
						Device.BeginInvokeOnMainThread(() => {
							QuestionGroupList.Add(responseSummaryGroup);
						});
					}
					IsProcessing = false;

				});
			} else {
				DependencyService.Get<ICustomDialog> ().Display ("This function requires a connection to a network. Please connect to a network.", "OK");
			}
		}
예제 #16
0
		public WorkoutsViewModel(User selectedUser = null)
		{

			this.UserExerciseGroupViewModelList = new ObservableCollection<UserExerciseGroupViewModel>();

			if (selectedUser != null)
			{
				SelectedUser = selectedUser;
				//get the Member Image
				if (SelectedUser.ImageURL == null || SelectedUser.ImageURL == "")
				{
					MemberImage = "memberpic.png";

				}
				else {

					MemberImage = SelectedUser.ImageURL;
				}
			}


		}
		public TrainerAvailabilityViewModel (User selectedUser, int appointmentID)
		{
			SelectedUser = selectedUser;
			//get the Member Image
			if(SelectedUser.ImageURL == null || SelectedUser.ImageURL == ""){
				MemberImage = "memberpic.png";

			}else{

				MemberImage = SelectedUser.ImageURL;
			}

			AppointmentID = appointmentID;
			AvailabilityList = new List<TrainerAvailabilityDTO> ();
			AvailabilityGroupList = new ObservableCollection<TrainerAvailabilityGroup> ();
			SelectedDateTime = DateTime.Now;
			if (CrossConnectivity.Current.IsConnected) {
				Task.Run (async() => {
					await DateSet ();
				}).Wait ();



			} else {
				DependencyService.Get<ICustomDialog> ().Display (StringConstants._FeatureConnectivityDepencyMessage, "OK");
			}

		}
예제 #18
0
		public ResponseSummaryViewModel (User selectedUser)
		{
			SelectedUser = selectedUser;

			//get the Member Image
			if (SelectedUser.ImageURL == null || SelectedUser.ImageURL == "") {
				MemberImage = "memberpic.png";

			} else {

				MemberImage = SelectedUser.ImageURL;
			}

			ResponseQuestionList = new ObservableCollection<ResponseSummary> ();


			ResponseSummaryGroupList = new ObservableCollection<ResponseSummaryGroup> ();

			AppointmentSummaryList = new ObservableCollection<AppointmentSummary> ();


			AppointmentSummaryGroupList = new ObservableCollection<AppointmentSummaryGroup> ();



			if (CrossConnectivity.Current.IsConnected) {
				Task.Run (async() => {

					var responseSummaryDBList = await ResponseSummaryDAL.GetResponseSummary (SelectedUser.ProfileID);
					foreach (var responseSummaryDB in responseSummaryDBList) {
						await ResponseSummaryDAL.DeleteResponseSummary (responseSummaryDB);
					}




					var responseSummaryListAPI = await CoachServices.RequestResponseSummary (SelectedUser.ProfileID);
					foreach (var responseSummaryDTO in responseSummaryListAPI) {
						ResponseSummary responseSummary = new ResponseSummary (responseSummaryDTO);
						await ResponseSummaryDAL.InsertResponseSummary (responseSummary);
					}
					var responseSummaryDBList2 = await ResponseSummaryDAL.GetResponseSummary (SelectedUser.ProfileID);
					ResponseQuestionList = new ObservableCollection<ResponseSummary> (responseSummaryDBList2);
					foreach (var sum in ResponseQuestionList) {
						var responseArray = sum.MemberResponse.Split (',');
						for (int i = 0; i < responseArray.Count (); i++) {
							responseArray [i] = responseArray [i].Trim ();
						}
						sum.MemberResponseList = responseArray.ToList ();
					}

					foreach (var rSumm in ResponseQuestionList) {
						ResponseSummaryGroup responseSummaryGroup = new ResponseSummaryGroup (rSumm);
						Device.BeginInvokeOnMainThread (() => {
							ResponseSummaryGroupList.Add (responseSummaryGroup);
						});
					}

					var appointmentSummaryDBList = await AppointmentSummaryDAL.GetAppointmentSummaryList (SelectedUser.ProfileID);
					foreach (var appointmentSummaryDB in appointmentSummaryDBList) {
						await AppointmentSummaryDAL.DeleteAppointmentSummary (appointmentSummaryDB);
					}

					var appointmentSummaryListAPI = await CoachServices.RequestAppointmentSummary (SelectedUser.ProfileID);
					foreach (var appointmentSummaryDTO in appointmentSummaryListAPI) {
						AppointmentSummary appointmentSummary = new AppointmentSummary (appointmentSummaryDTO);
						await AppointmentSummaryDAL.InsertApppointmentSummary (appointmentSummary);
					}
					var appointmentSummaryDBList2 = await AppointmentSummaryDAL.GetAppointmentSummaryList (SelectedUser.ProfileID);
					AppointmentSummaryList = new ObservableCollection<AppointmentSummary> (appointmentSummaryDBList2);

					var distinctAppointmentNames = AppointmentSummaryList.Select(row => row.TypeName).Distinct();

					if(ResponseSummaryGroupList.Count() > 0)
					{
						AppointmentSummaryGroup tourGroup = new AppointmentSummaryGroup(ResponseSummaryGroupList, "Tour");
						Device.BeginInvokeOnMainThread(() => {
							AppointmentSummaryGroupList.Add(tourGroup);
						});
					}

					foreach(var appointmentName in distinctAppointmentNames)
					{
						var appointmentSummaryList = AppointmentSummaryList.Where(row => row.TypeName == appointmentName).ToList();
						AppointmentSummaryGroup appointmentSummaryGroup = new AppointmentSummaryGroup(appointmentSummaryList);
						Device.BeginInvokeOnMainThread(() => {
							AppointmentSummaryGroupList.Add(appointmentSummaryGroup);
						});
					}

				});
			} else {
				DependencyService.Get<ICustomDialog> ().Display ("You are not connected to a network. The displayed data might not be up to date.", "OK");
				Task.Run (async() => {
					var responseSummaryDBList = await ResponseSummaryDAL.GetResponseSummary (SelectedUser.ProfileID);
					ResponseQuestionList = new ObservableCollection<ResponseSummary> (responseSummaryDBList);
					foreach (var sum in ResponseQuestionList) {
						var responseArray = sum.MemberResponse.Split (',');
						for (int i = 0; i < responseArray.Count (); i++) {
							responseArray [i] = responseArray [i].Trim ();
						}
						sum.MemberResponseList = responseArray.ToList ();
					}

					foreach (var rSumm in ResponseQuestionList) {
						ResponseSummaryGroup responseSummaryGroup = new ResponseSummaryGroup (rSumm);
						Device.BeginInvokeOnMainThread (() => {
							ResponseSummaryGroupList.Add (responseSummaryGroup);
						});
					}

					var appointmentSummaryDBList2 = await AppointmentSummaryDAL.GetAppointmentSummaryList (SelectedUser.ProfileID);
					AppointmentSummaryList = new ObservableCollection<AppointmentSummary> (appointmentSummaryDBList2);

					var distinctAppointmentNames = AppointmentSummaryList.Select(row => row.TypeName).Distinct();

					if(ResponseSummaryGroupList.Count() > 0)
					{
						AppointmentSummaryGroup tourGroup = new AppointmentSummaryGroup(ResponseSummaryGroupList, "Tour");
						Device.BeginInvokeOnMainThread(() => {
							AppointmentSummaryGroupList.Add(tourGroup);
						});
					}

					foreach(var appointmentName in distinctAppointmentNames)
					{
						var appointmentSummaryList = AppointmentSummaryList.Where(row => row.TypeName == appointmentName).ToList();
						AppointmentSummaryGroup appointmentSummaryGroup = new AppointmentSummaryGroup(appointmentSummaryList);
						Device.BeginInvokeOnMainThread(() => {
							AppointmentSummaryGroupList.Add(appointmentSummaryGroup);
						});
					}

				});
			}
		}
예제 #19
0
		public TemplateListPage (User selectedUser = null)
		{
			_viewModel = new TemplateViewModel (selectedUser);

			if (selectedUser != null) {
				_viewModel.Title = "Assign Template to " + selectedUser.FullMemberName;
				if (_viewModel.ProfileID == 0) {
					_viewModel.ProfileID = selectedUser.ProfileID;
				}
			} else {
				_viewModel.Title = "Assign Template";
			}
			//Sync templates with the server
			var templatesTask = Task.Run (async () => {
				await _viewModel.SyncTemplateDataWithServer ();
			});

			InitializeComponent ();

			this.BindingContext = _viewModel;
			Action<Task> action = (actionResult) =>
				Device.BeginInvokeOnMainThread (() => {


					listView.ItemsSource = _viewModel.SimpleTemplateGroups;
				});

			templatesTask.ContinueWith (action);

			listView.ItemTemplate = new DataTemplate (typeof(CustomViewCellTwoTextTwoButton));
			listView.ItemTemplate.SetBinding (CustomViewCellTwoTextTwoButton.SimpleTemplateProperty, ".");

			listView.IsGroupingEnabled = true;
			listView.GroupDisplayBinding = new Binding ("Key");
			listView.GroupShortNameBinding = new Binding ("Key");
			listView.GroupHeaderTemplate = new DataTemplate (typeof(TemplateListHeaderCell));

			listView.ItemSelected += (sender, args) => {
				if (args.SelectedItem != null) {
					listView.SelectedItem = null;
					//TODO: Add message to profile
					if (selectedUser != null) {
						TemplateViewModel selectedViewModel = args.SelectedItem as TemplateViewModel;
						_viewModel.AssignTemplateCommand.Execute (selectedViewModel);

					} 

				}
			};

			ToolbarItem syncItem = new ToolbarItem {
				Text = "Sync",
				Order = ToolbarItemOrder.Primary
			};

			syncItem.Clicked += syncItem_Clicked;

			ToolbarItems.Add (syncItem);


			_viewModel.DataSyncEvent += _viewModel_DataSyncEvent;
		}
예제 #20
0
		public AppointmentsViewModel(User selectedUser)
		{
			SelectedUser = selectedUser;
		}
예제 #21
0
		public MemberProfileViewModel(User user)
		{
			SelectedUser = user;
			FamilyMemberObjectList = new List<FamilyMember>();
		}
		public ModalWorkoutCreationPage (bool createWorkoutOnly = false, User feedbackOnlyUser = null)
		{
			InitializeComponent ();

			templateNameEntry.TextChanged += Utility.EntryMax50CharValidation;

			templateDescriptionEntry.TextChanged += Utility.EditorMax200CharValidation;

			listView.ItemSelected += listView_ItemSelected;
			listView.ItemTemplate = new DataTemplate (typeof(CustomViewThreeTextCell));

			if (!createWorkoutOnly && feedbackOnlyUser == null) {

				memberSwitch.Toggled += (object sender, ToggledEventArgs e) => {
					if (e.Value) {
						addMemberEntry.IsEnabled = true;
						recordedAStack.IsVisible = true;
					} else {
						addMemberEntry.IsEnabled = false;
						recordedAStack.IsVisible = false;
					}
				};

				templateSwitch.Toggled += (object sender, ToggledEventArgs e) => {
					if (e.Value) {
						allSwitch.IsToggled = true;
					} else {
						allSwitch.IsToggled = false;
					}
				};

				templateSwitch.Toggled
				+= (object sender, ToggledEventArgs e) => {
					if (!e.Value) {
						completedWorkoutsSwitch.IsToggled = true;
					}
				};

				addMemberEntry.TextChanged += async (sender, args) => {
					if (_textChangedViaListSelection) {
						listView.IsVisible = false;
						_textChangedViaListSelection = false;
					} else {
						if (addMemberEntry.Text == "") {
							_selectedUser = null;
						}
						var searchResults = await UserDAL.UserSeach (addMemberEntry.Text, App.WorkoutCreatorContext.StaffMember.GymID);
						listView.ItemsSource = searchResults;
						listView.IsVisible = true;
					}

				};
				listView.ItemTapped += (sender, e) => {
					((ListView)sender).SelectedItem = null; // de-select the row
				};
			} else {

				memberSwitch.IsVisible = false;
				addMemberEntry.IsVisible = false;
				recordedAStack.IsVisible = false;
				templateSwitch.IsVisible = false;
				completedWorkoutsSwitch.IsVisible = false;
				allSwitch.IsVisible = false;
				addMemberEntry.IsVisible = false;
				addMemberLabel.IsVisible = false;
				recordedALabel.IsVisible = false;
				recordedForLabel.IsVisible = false;
				allLabel.IsVisible = false;
				MemberLabel.IsVisible = false;
				completedWorkoutsLabel.IsVisible = false;

				if (feedbackOnlyUser != null) {
					this.Title = "Log Feedback";
					_selectedUser = feedbackOnlyUser;
					_isFeedbackOnly = true;
					templateLabel.IsVisible = false;
					textLabel.IsVisible = false;
					templateNameEntry.IsVisible = false;
					editorLabel.IsVisible = false;
					templateDescriptionEntry.IsVisible = false;
					allSwitch.IsToggled = false;
					templateSwitch.IsToggled = false;
					completedWorkoutsSwitch.IsToggled = true;
					memberSwitch.IsToggled = true;

					instructionLabel.Text = "Click create to log feedback on behalf of the member.";
				}
			}



			cancel2Button.Clicked += async (sender2, args2) => {
				activityIndicator.IsRunning = false;
				activityIndicator.IsVisible = false;
				submitButton.IsEnabled = true;
				cancel2Button.IsEnabled = true;
				await Navigation.PopAsync (true);
			};

			submitButton.Clicked += async (sender2, args2) => {


				if (createWorkoutOnly == true && templateNameEntry.Text.Trim () != "") {
					await WriteToRepository (templateNameEntry, templateDescriptionEntry, false);
					return;
				} else {
					if (createWorkoutOnly == true && templateNameEntry.Text.Trim () == "") {
						DependencyService.Get<ICustomDialog> ().Display ("You must enter a name for the template", "OK");
						return;
					}
				}

				if (createWorkoutOnly == false && feedbackOnlyUser != null) {
					await WriteToRepository (templateNameEntry, templateDescriptionEntry, true);
					return;
				}

				if ((templateNameEntry.Text == null || templateNameEntry.Text.Trim () == "") && allSwitch.IsToggled == true) {
					DependencyService.Get<ICustomDialog> ().Display ("You must enter a name for the template", "OK");
				} else {
					if (memberSwitch.IsToggled && _selectedUser == null) {
						DependencyService.Get<ICustomDialog> ().Display ("Select another member or delete the member entirely. This member is not recognized.", "OK");
					} else {
						if (_selectedUser != null) {
							String[] nameArray = addMemberEntry.Text.Split (' ');
							if (nameArray.Count () > 0) {
								if (!(_selectedUser.FName == nameArray [0] && _selectedUser.LName == nameArray [1])) {
									DependencyService.Get<ICustomDialog> ().Display ("Select another member or delete the member entirely. This member is not recognized.", "OK");
								} else {

									await WriteToRepository (templateNameEntry, templateDescriptionEntry, true);
								}

							}
						} else {

							await WriteToRepository (templateNameEntry, templateDescriptionEntry, false);
						}
					}
				}
			};


		}
		void listView_ItemSelected (object sender, SelectedItemChangedEventArgs e)
		{
			if (e.SelectedItem != null) {
				_selectedUser = e.SelectedItem as User;
				_textChangedViaListSelection = true;
				addMemberEntry.Text = _selectedUser.FName + " " + _selectedUser.LName;
			}
		}
예제 #24
0
		private async void ExecuteNavigateFamilyMemberCommand(User familyUser)
		{

			if (IsBusy)
				return;

			IsBusy = true;

			Application.Current.MainPage.Navigation.RemovePage(Application.Current.MainPage.Navigation.NavigationStack.Last());


			await Application.Current.MainPage.Navigation.PushAsync(new MemberProfilePage(familyUser));




			IsBusy = false;

		}
예제 #25
0
		public ExerciseViewModel(Exercise exercise, bool isCreateWorkoutOnly = false, User isFeedbackOnlyUser = null)
        {
			if (isCreateWorkoutOnly) {
				DisplayWeight = true;
			} else {
				DisplayWeight = false;
			}

			this.ImageSource = exercise.ImageSource;

            this.Exercise = exercise;

			if(Exercise.CardioExID != 0){
				IsCardioExercise = true;
			}
        }
예제 #26
0
		public ExercisePage (ExerciseViewModel exercise, bool isExerciseEdit = false, int exid = 1, bool isCreateWorkoutOnly = false, User logFeedbackOnlyUser = null)
		{
			InitializeComponent ();

			Title = isExerciseEdit ? "Edit Exercise Prescription Details" : "Add Exercise Prescription Details";

			_viewModel = exercise;
			_isExerciseEdit = isExerciseEdit;
			this.BindingContext = _viewModel;

			if (isCreateWorkoutOnly) {
				WeightLabel.IsVisible = false;
				weightEntry.IsVisible = false;
			}

			if (_viewModel.Exercise.EquipmentType == "Hold") {
				RepsLabel.Text = "Hold (Secs): ";
			}

			if (_viewModel.Exercise.IsMask) {
				WeightLabel.Text = "Target Pins:";
			}




			if (_viewModel.Exercise.IsBodyWeight) {
				WeightLabel.IsVisible = false;

			}



			cancelButton.Clicked += (sender, args) => {
				Action cancelAction = async () => {
					//Uses session tracking
					Insights.Track ("Cancel exercise add", new Dictionary<string, string> () {
						{ "Exercise", exercise.Exercise.Exercisename },
						{ "Exercise id", exercise.Exercise.ExerciseID.ToString () }
					});

					await this.Navigation.PopAsync ();

				};
				DependencyService.Get<ICustomDialog> ().Display ("Cancel exercise add?", "No", "Yes", cancelAction);
			};

			createExerciseButton.Clicked += async (sender, args) => {
				if ((_viewModel.Sets != 0 && _viewModel.Reps != 0) || _viewModel.Duration != 0) {
					if (!_isExerciseEdit) {
						App.WorkoutCreatorContext.Exercises.Add (_viewModel);
					}
					//Uses session tracking
					Insights.Track ("Added exercise to template", new Dictionary<string, string> () {
						{ "Exercise", exercise.Exercise.Exercisename },
						{ "Exercise id", exercise.Exercise.ExerciseID.ToString () }
					});
					await this.Navigation.PopAsync ();
				} else {
					StringBuilder displayMessageSB = new StringBuilder("Exercises cannot be added with 0 ");
					if(_viewModel.IsCardioExercise){
						displayMessageSB.Append("minutes.");
					}else{
						displayMessageSB.Append("sets or 0 reps.");
					}
					DependencyService.Get<ICustomDialog> ().Display (displayMessageSB.ToString(), "OK");
				}




			};



			if (isExerciseEdit) {

				ToolbarItem cancelItem = new ToolbarItem {
					Text = "Cancel",
					Icon = Device.OnPlatform ("cancel.png", "ic_action_cancel", "Images/cancel.png"),
					Order = ToolbarItemOrder.Primary
				};

				cancelItem.Clicked += (sender, args) => {
					Action cancelAction = async () => {
						//Uses session tracking
						Insights.Track ("Cancel exercise edit", new Dictionary<string, string> () {
							{ "Exercise", exercise.Exercise.Exercisename },
							{ "Exercise id", exercise.Exercise.ExerciseID.ToString () }
						});
 
						await this.Navigation.PopAsync ();

					};
					DependencyService.Get<ICustomDialog> ().Display ("Cancel exercise edit?", "No", "Yes", cancelAction);
                   
				};
				this.ToolbarItems.Add (cancelItem);

				ToolbarItem deleteItem = new ToolbarItem {
					Text = "Delete",
					Icon = Device.OnPlatform ("discard.png", "ic_action_discard.png", "Images/delete.png"),
					Order = ToolbarItemOrder.Primary
				};

				deleteItem.Clicked += (sender, args) => {
					Action deleteAction = async() => {
						//Uses session tracking
						Insights.Track ("Deleted exercise from exercise list", new Dictionary<string, string> () {
							{ "Exercise", exercise.Exercise.Exercisename },
							{ "Exercise id", exercise.Exercise.ExerciseID.ToString () }
						});
						exercise.Delete ();
						App.WorkoutCreatorContext.Exercises.Remove (exercise);

						await this.Navigation.PopAsync ();

					};
					DependencyService.Get<ICustomDialog> ().Display ("Delete this exercise?", "No", "Yes", deleteAction, true);
				};

				this.ToolbarItems.Add (deleteItem);

			}
		}
예제 #27
0
		public MemberTemplateViewModel (WorkoutTemplate workoutTemplate, int gymID, User user)
		{
			this.WorkoutTemplate = workoutTemplate;
			this.GymID = gymID;
			this.User = user;
		}
예제 #28
0
		public mpAddNotePage (User selectedUser)
		{
			InitializeComponent ();
			ViewModel = new AddNotesViewModel (selectedUser);
			this.BindingContext = ViewModel;
		}
예제 #29
0
파일: User.cs 프로젝트: MobileFit/CoachV2
		public void CopyUserData (User userDTO)
		{
			FName = userDTO.FName;
			LName = userDTO.LName;
			GymID = userDTO.GymID;
			FullMemberName = userDTO.FName + " " + userDTO.LName;

			ProfileID = userDTO.ProfileID;
			PhoneNumber = userDTO.PhoneNumber;

			//add member profile data
			Barriers = userDTO.Barriers;
			BarriersLastUpdated = userDTO.BarriersLastUpdated;
			BirthDate = userDTO.BirthDate;
			Email = userDTO.Email;
			EnrolledFamilyMembers = userDTO.EnrolledFamilyMembers;
			Gender = userDTO.Gender;
			GoalsHistoryLastUpdated = userDTO.GoalsHistoryLastUpdated;
			GoalsSet = userDTO.GoalsSet;
			GoalsSetLastUpdated = userDTO.GoalsSetLastUpdated;
			HasGoalsHistory = userDTO.HasGoalsHistory;
			ImageURL = userDTO.ImageURL;
			LName = userDTO.LName;
			NotesLastUpdated = userDTO.NotesLastUpdated;
			PhoneNumber = userDTO.PhoneNumber;
			ProgramInterests = userDTO.ProgramInterests;
			ResponsesLastUpdated = userDTO.ResponsesLastUpdated;
			Trainer = userDTO.Trainer;
			WorkoutsAssigned = userDTO.WorkoutsAssigned;
			IsAssistUser = userDTO.IsAssistUser;
		}
예제 #30
0
		public TemplateViewModel (User selectedUser = null, TemplateViewModel templateViewModel = null)
		{
			SimpleTemplateGroups = new ObservableCollection<Grouping<string, TemplateViewModel>> ();
			if (selectedUser != null) {
				SelectedUser = selectedUser;
				ProfileID = selectedUser.ProfileID;
				if (ProfileID != 0) {
					IsAssignVisible = true;
				}
			}
			if (templateViewModel != null) {
				ParentTemplateViewModel = templateViewModel;
			}
		}