private void btn_DeleteProject_Click(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show( string.Format("{0}{1}", ResourceStringManager.GetResourceByKey("ConfirmDeleteMessageBoxMessage"), this.SelectedProject.Name), ResourceStringManager.GetResourceByKey("ConfirmDeleteMessageBoxTitle"), System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { var projectLogic = new ProjectLogic(); try { projectLogic.DeleteProject(this.SelectedProject.Id); } catch (Exception ex) { Logger.LogException(ex); MessageBox.Show(ResourceStringManager.GetResourceByKey("DeleteProjectFailedTitle"), ResourceStringManager.GetResourceByKey("DeleteProjectFailedMessage"), MessageBoxButton.OK, MessageBoxImage.Error); } projectLogic.Dispose(); this.lv_Projects.SelectedItem = null; this.Load(); this.RefreshBindings(this.PagingManager.CurrentPage); } }
private void LoadProjects() { var projectLogic = new ProjectLogic(); this.ProjectViewModels = projectLogic.GetAllProjects().Where(p => p.ProjectStatus != EnumDefinition.ProjectStatus.Archived) .Select(p => new ProjectViewModel(p)) .ToList(); projectLogic.Dispose(); this.ProjectViewModels.Add(new ProjectViewModel { Id = 0, Name = ResourceStringManager.GetResourceByKey("All") }); }
private void LoadSubtasksForAssignment(int assignment_id) { var subtaskLogic = new SubtaskLogic(); this.SubtaskViewModels = subtaskLogic.GetByAssignmentId(assignment_id) .Select(s => new SubtaskComboBoxViewModel(s)) .ToList(); subtaskLogic.Dispose(); this.SubtaskViewModels.Add(new SubtaskComboBoxViewModel { Id = 0, Name = ResourceStringManager.GetResourceByKey("All") }); this.cb_SubtaskFilter.SelectedItem = this.SubtaskViewModels.Single(s => s.Id == 0); }
private void LoadAssignmentsForProject(int project_id) { var assignmentLogic = new AssignmentLogic(); this.AssignmentViewModels = assignmentLogic.GetAssignmentsByProjectId(project_id) .Select(a => new AssignmentViewModel(a)) .ToList(); assignmentLogic.Dispose(); this.AssignmentViewModels.Add(new AssignmentViewModel { Id = 0, Name = ResourceStringManager.GetResourceByKey("All") }); this.cb_AssignmentFilter.SelectedItem = this.AssignmentViewModels.Single(a => a.Id == 0); }
private void btn_DeleteEntry_Click(object sender, System.Windows.RoutedEventArgs e) { var result = MessageBox.Show(ResourceStringManager.GetResourceByKey("ConfirmDeleteMessage"), ResourceStringManager.GetResourceByKey("ConfirmDeleteTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { var entryLogic = new EntryLogic(); entryLogic.DeleteEntry(SelectedEntry.Id); entryLogic.Dispose(); } Load(); this.RefreshBindings(this.PagingManager.CurrentPage); }
private string[] ResolveWeekdayNames(IEnumerable <MostProductiveWeekDaysViewModel> viewModels) { var labels = new List <string>(); foreach (var vm in viewModels) { string formattedAvgHours = string.Format("{0}(Ø {1:0.00}h){2}(Total: {3:0.00}h)", System.Environment.NewLine, vm.AverageHours, System.Environment.NewLine, vm.TotalHours); labels.Add(ResourceStringManager.GetResourceByKey(vm.Day.ToString()) + formattedAvgHours); } return(labels.ToArray()); }
private void LoadProjectViewModels() { var projectLogic = new ProjectLogic(); this.ProjectViewModels = projectLogic.GetAllProjects() .Where(p => p.ProjectStatus == EnumDefinition.ProjectStatus.Active) .Select(p => new Projects.ProjectViewModel(p)).ToList(); string projectAllSelectItemName = ResourceStringManager.GetResourceByKey("ProjectsAll"); this.ProjectViewModels.Insert(0, new Projects.ProjectViewModel { Name = projectAllSelectItemName, Id = 0 }); this.cb_ProjectSelection.ItemsSource = this.ProjectViewModels; this.cb_ProjectSelection.SelectedItem = this.ProjectViewModels.Where(p => p.Id == 0); }
public AddEntry(int projectId, int assignmentId) { InitializeComponent(); this.project_id = projectId; this.assignment_id = assignmentId; timer = new DispatcherTimer(DispatcherPriority.Send); timer.Interval = new TimeSpan(0, 0, 1); this.btn_StartStop.Content = ResourceStringManager.GetResourceByKey("ButtonTextStart"); this.Load(); this.cb_Subtask.SelectedItem = this.SubtaskViewModels.FirstOrDefault(s => s.Id > 0); if (!this.SubtaskViewModels.Any()) { this.chebo_FinishesSubtask.IsEnabled = false; } }
public void StartStopTimer() { if (!timer.IsEnabled) { this.started = DateTime.Now; timer.Start(); timer.Tick += Timer_Elapsed; this.btn_StartStop.Background = Brushes.DarkRed; this.btn_StartStop.Content = ResourceStringManager.GetResourceByKey("ButtonTextStop"); } else { timer.Tick -= Timer_Elapsed; timer.Stop(); timer.IsEnabled = false; this.btn_StartStop.Content = ResourceStringManager.GetResourceByKey("ButtonTextStart"); this.btn_StartStop.Background = Brushes.Green; } }