/// <summary> /// Constructor for easily creating entries. /// </summary> /// <param name="id">The ID for the entry.</param> /// <param name="year">The year (1 through 9999) for the entry date.</param> /// <param name="month">The month (1 through 12) for the entry month.</param> /// <param name="day">The day (1 through the number of days for the month) for the entry day.</param> /// <param name="activityType">The activity type for the entry.</param> /// <param name="duration">The duration for the entry (in minutes).</param> /// <param name="intensity">The intensity for the entry.</param> /// <param name="exclude">Whether or not the entry should be excluded when calculating the total fitness activity.</param> /// <param name="notes">The notes for the entry.</param> public Entry(int id, int year, int month, int day, Activity.ActivityType activityType, double duration, IntensityLevel intensity = IntensityLevel.Medium, bool exclude = false, string notes = null) { Id = id; Date = new DateTime(year, month, day); ActivityId = (int)activityType; Duration = duration; Intensity = intensity; Exclude = exclude; Notes = notes; }
private void RadioWater_Click(object sender, RoutedEventArgs e) { FilteredList.Clear(); Activity.ActivityType W = 0; foreach (var item in ActivityList) { W = item._ActivityType; if (W == Activity.ActivityType.Water) { FilteredList.Add(item); } lstbxActivities.ItemsSource = FilteredList; } }
private void RadioAll_Click(object sender, RoutedEventArgs e) { FilteredList.Clear(); Activity.ActivityType Al = 0; foreach (var item in ActivityList) { Al = item._ActivityType; if (Al == Activity.ActivityType.All) { FilteredList.Add(item); } lstbxActivities.ItemsSource = ActivityList; } }
public void ButtonSelectActivity_Click(object sender, RoutedEventArgs e) { //determine what is selected Activity selected = lstbxActivities.SelectedItem as Activity; //null check - make sure something selected if (selected != null) { bool conflict = false; //loop foreach (Activity activity in SelectedList) { if (activity.ActivityDate == selected.ActivityDate) { conflict = true; MessageBox.Show("You have already selected an activity for that day."); } } if (conflict == false) { ActivityList.Remove(selected); SelectedList.Add(selected); lstbxActivities.ItemsSource = null; lstbxActivities.ItemsSource = ActivityList; } if (RadioAll.IsChecked == true) { lstbxActivities.ItemsSource = ActivityList; } else if (RadioLand.IsChecked == true) { FilteredList.Clear(); Activity.ActivityType L = 0; foreach (var item in ActivityList) { L = item._ActivityType; if (L == Activity.ActivityType.Land) { FilteredList.Add(item); } lstbxActivities.ItemsSource = FilteredList; } } else if (RadioWater.IsChecked == true) { FilteredList.Clear(); Activity.ActivityType W = 0; foreach (var item in ActivityList) { W = item._ActivityType; if (W == Activity.ActivityType.Water) { FilteredList.Add(item); } lstbxActivities.ItemsSource = FilteredList; } } else if (RadioAir.IsChecked == true) { FilteredList.Clear(); Activity.ActivityType A = 0; foreach (var item in ActivityList) { A = item._ActivityType; if (A == Activity.ActivityType.Air) { FilteredList.Add(item); } lstbxActivities.ItemsSource = FilteredList; } } lstbxSelected.ItemsSource = SelectedList.OrderBy(act => act.ActivityDate); foreach (var item in SelectedList) { decimal C = item.Cost; totalCost += C; } txtblk_cost.Text = totalCost.ToString("C"); if (lstbxActivities.ItemsSource == FilteredList) { lstbxActivities.ItemsSource = FilteredList.OrderBy(act => act.ActivityDate); } else if (lstbxActivities.ItemsSource == ActivityList) { lstbxActivities.ItemsSource = ActivityList.OrderBy(act => act.ActivityDate); } } else { MessageBox.Show("Please select an activity."); } }
private void BtnUnselectActivity_Click(object sender, RoutedEventArgs e) { Activity selected = lstbxSelected.SelectedItem as Activity; if (selected != null) { ActivityList.Add(selected); SelectedList.Remove(selected); lstbxActivities.ItemsSource = null; lstbxActivities.ItemsSource = ActivityList; if (RadioAll.IsChecked == true) { lstbxActivities.ItemsSource = ActivityList; } else if (RadioLand.IsChecked == true) { FilteredList.Clear(); Activity.ActivityType L = 0; foreach (var item in ActivityList) { L = item._ActivityType; if (L == Activity.ActivityType.Land) { FilteredList.Add(item); } lstbxActivities.ItemsSource = FilteredList; } } else if (RadioWater.IsChecked == true) { FilteredList.Clear(); Activity.ActivityType W = 0; foreach (var item in ActivityList) { W = item._ActivityType; if (W == Activity.ActivityType.Water) { FilteredList.Add(item); } lstbxActivities.ItemsSource = FilteredList; } } else if (RadioAir.IsChecked == true) { FilteredList.Clear(); Activity.ActivityType A = 0; foreach (var item in ActivityList) { A = item._ActivityType; if (A == Activity.ActivityType.Air) { FilteredList.Add(item); } lstbxActivities.ItemsSource = FilteredList; } } lstbxSelected.ItemsSource = SelectedList.OrderBy(act => act.ActivityDate); if (lstbxActivities.ItemsSource == FilteredList) { lstbxActivities.ItemsSource = FilteredList.OrderBy(act => act.ActivityDate); } else if (lstbxActivities.ItemsSource == ActivityList) { lstbxActivities.ItemsSource = ActivityList.OrderBy(act => act.ActivityDate); } totalCost = 0; foreach (var item in SelectedList) { decimal C = item.Cost; totalCost += C; } txtblk_cost.Text = totalCost.ToString("C"); } }