示例#1
0
        public AddChildProjectsViewModel(ProjectData projectData, Goal parentGoal, GoalData goalData, TaskData taskData)
        {
            if (projectData == null)
            {
                throw new ArgumentNullException("projectData");
            }

            if (goalData == null)
            {
                throw new ArgumentNullException("goalData");
            }

            if (parentGoal == null)
            {
                throw new ArgumentNullException("parentGoal");
            }

            List <Project> unassignedProjects = projectData.GetUnassignedProjects();

            foreach (Project unassignedProject in unassignedProjects)
            {
                _unassignedProjects.Add(new ProjectViewModel(unassignedProject, projectData, taskData));
            }

            _parentGoal  = parentGoal;
            _goalData    = goalData;
            _projectData = projectData;

            base.DisplayName  = Properties.Resources.Add_Projects_DisplayName;
            base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/project.png";
        }
        public AdminViewModel(TaskData taskData, ProjectData projectData, GoalData goalData)
        {
            if (taskData == null)
            {
                throw new ArgumentNullException("taskData");
            }

            if (projectData == null)
            {
                throw new ArgumentNullException("projectData");
            }

            if (goalData == null)
            {
                throw new ArgumentNullException("goalData");
            }

            _taskData           = taskData;
            _projectData        = projectData;
            _goalData           = goalData;
            _selectedObjectType = ObjectTypes.Any;

            base.DisplayName  = Properties.Resources.Admin_DisplayName;
            base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/admin.png";
        }
        public GoalViewModel(Goal goal, GoalData goalData, ProjectData projectData, TaskData taskData)
        {
            if (goal == null)
            {
                throw new ArgumentNullException("goal");
            }

            if (goalData == null)
            {
                throw new ArgumentNullException("goalData");
            }

            if (projectData == null)
            {
                throw new ArgumentNullException("projectData");
            }

            if (taskData == null)
            {
                throw new ArgumentNullException("taskData");
            }

            _goal                = goal;
            _goalData            = goalData;
            _projectData         = projectData;
            _taskData            = taskData;
            _statusOptions       = AppInfo.Instance.StatusList;
            _selectedStatus      = _statusOptions.FirstOrDefault(s => s.StatusID == this.StatusId);
            _categoryOptions     = AppInfo.Instance.CategoryList;
            _selectedCategory    = _categoryOptions.FirstOrDefault(c => c.CategoryID == this.CategoryId);
            _isSaved             = true;
            _statusDescription   = _statusOptions.FirstOrDefault(s => s.StatusID == this.StatusId).Description;
            _categoryDescription = _categoryOptions.FirstOrDefault(c => c.CategoryID == this.CategoryId).Description;
            List <Project> childProjects = _goalData.GetChildProjects(_goal.GoalId);

            foreach (Project childProject in childProjects)
            {
                _childProjectVMs.Add(new ProjectViewModel(childProject, projectData, taskData));
            }

            _originalStatusId = StatusId;

            // Subscribe for notifications of when a new project is saved.
            _projectData.ProjectAdded   += this.OnProjectAdded;
            _projectData.ProjectUpdated += this.OnProjectUpdated;
            _projectData.ProjectDeleted += this.OnProjectDeleted;

            base.DisplayName  = Properties.Resources.Edit_Goal_DisplayName;
            base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/goal.png";
        }
示例#4
0
        /// <summary>
        /// Launches the add tasks window.
        /// </summary>
        public void AddTasks()
        {
            AddTasksView window = new AddTasksView();

            using (ProjectData pdata = new ProjectData())
            {
                using (GoalData gData = new GoalData())
                {
                    using (var viewModel = new AddTasksViewModel(_taskData, pdata, gData))
                    {
                        this.ShowWorkspaceAsDialog(window, viewModel);
                    }
                }
            }
        }
        public MainWindowViewModel()
        {
            base.DisplayName = Properties.Resources.AppName;
            _taskData        = new TaskData();
            _projectData     = new ProjectData();
            _goalData        = new GoalData();
            WorkspaceViewModel activeVM = ListActiveTasks();

            ListTasks();
            ListProjects();
            ListGoals();
            ListReports();
            ShowAdminOptions();
            this.SetActiveWorkspace(activeVM);
        }
        public GoalProgressReportViewModel(GoalProgressReport goalProgressReport)
        {
            if (goalProgressReport == null)
            {
                throw new ArgumentNullException("goalProgressReport");
            }

            _goalProgressReport = goalProgressReport;

            using (GoalData gData = new GoalData())
            {
                _goalOptions = gData.GetGoals();
            }

            base.DisplayName  = goalProgressReport.Title;
            base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/report.png";
        }
示例#7
0
        public static Project CreateNewProject(int? goalId = null)
        {
            Project newProject = new Project()
            {
                StatusId = (int)Statuses.New
            };

            if (goalId.HasValue)
            {
                using (GoalData goalData = new GoalData())
                {
                    newProject.ParentGoal = goalData.GetGoalByGoalId(goalId.Value);
                }
            }

            return newProject;
        }
        public GoalTreeNodeViewModel(Goal goal, GoalData goalData, ITreeNodeContainerViewModel parent)
        {
            if (goal == null)
            {
                throw new ArgumentNullException("goal");
            }

            _goal = goal;

            List <Project> childProjects = goalData.GetChildProjectsContainingInactiveTasks(goal.GoalId);

            using (ProjectData pData = new ProjectData())
            {
                foreach (Project childProject in childProjects)
                {
                    _childNodes.Add(new ProjectTreeNodeViewModel(childProject, pData, this));
                }
            }

            _parent = parent;
        }
示例#9
0
        public override FlowDocument Build()
        {
            FlowDocument flowDocument = base.Build();

            Dictionary <string, Tuple <string, string> > columnDefinitions = new Dictionary <string, Tuple <string, string> >()
            {
                { "Title", new Tuple <string, string>("Title", null) },
                { "StatusDescription", new Tuple <string, string>("Status", null) },
                { "CategoryDescription", new Tuple <string, string>("Category", null) },
                { "CreatedDate", new Tuple <string, string>("Date Created", null) },
                { "CompletedDate", new Tuple <string, string>("Date Completed", null) }
            };

            using (GoalData gData = new GoalData())
            {
                using (ProjectData pData = new ProjectData())
                {
                    using (TaskData tData = new TaskData())
                    {
                        List <Goal>          completedGoals = gData.GetCompletedGoalsByDate(StartDate, EndDate);
                        List <GoalViewModel> rowData        = new List <GoalViewModel>();
                        foreach (Goal goal in completedGoals)
                        {
                            rowData.Add(new GoalViewModel(goal, gData, pData, tData));
                        }

                        flowDocument.Blocks.Add(FlowDocumentHelper.BuildTable <GoalViewModel>(columnDefinitions, rowData));

                        foreach (GoalViewModel goalVm in rowData)
                        {
                            goalVm.Dispose();
                        }
                    }
                }
            }

            return(flowDocument);
        }
示例#10
0
        public AddTasksViewModel(TaskData taskData, ProjectData projectData, GoalData goalData)
        {
            if (taskData == null)
            {
                throw new ArgumentNullException("taskData");
            }

            if (projectData == null)
            {
                throw new ArgumentNullException("projectData");
            }

            if (goalData == null)
            {
                throw new ArgumentNullException("goalData");
            }

            List <Goal> allGoals = goalData.GetGoalsContainingInactiveTasks();

            foreach (Goal goalObj in allGoals)
            {
                _root.ChildNodes.Add(new GoalTreeNodeViewModel(goalObj, goalData, _root));
            }

            UnassignedTreeNodeViewModel unassigned = new UnassignedTreeNodeViewModel(taskData, projectData, _root);

            if (unassigned.ChildNodes.Count > 0)
            {
                _root.ChildNodes.Add(unassigned);
            }

            _taskData = taskData;

            base.DisplayName  = Properties.Resources.Add_Tasks_DisplayName;
            base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/task.png";
        }
        public override FlowDocument Build()
        {
            FlowDocument flowDocument = new FlowDocument();

            flowDocument.Blocks.Add(FlowDocumentHelper.BuildTitle(Title));

            Paragraph criteriaPara = new Paragraph();
            Span      titleSpan    = new Span();

            titleSpan.Inlines.Add("Title: ");
            titleSpan.FontWeight = FontWeights.Bold;
            Span titleValueSpan = new Span();

            titleValueSpan.Inlines.Add(SelectedGoal.Title);
            Span dateTitleSpan = new Span();

            dateTitleSpan.Inlines.Add("     Date Created: ");
            dateTitleSpan.FontWeight = FontWeights.Bold;
            Span dateValueSpan = new Span();

            dateValueSpan.Inlines.Add(SelectedGoal.CreatedDate.ToShortDateString());
            criteriaPara.Inlines.Add(titleSpan);
            criteriaPara.Inlines.Add(titleValueSpan);
            criteriaPara.Inlines.Add(dateTitleSpan);
            criteriaPara.Inlines.Add(dateValueSpan);
            flowDocument.Blocks.Add(criteriaPara);

            Dictionary <string, Tuple <string, string> > columnDefinitions = new Dictionary <string, Tuple <string, string> >()
            {
                { "Title", new Tuple <string, string>("Project Title", null) },
                { "StatusDescription", new Tuple <string, string>("Status", null) },
                { "EstimatedCost", new Tuple <string, string>("Estimated Cost", "0:C") },
                { "CreatedDate", new Tuple <string, string>("Date Created", null) },
                { "CompletedDate", new Tuple <string, string>("Date Completed", null) }
            };

            using (ProjectData pData = new ProjectData())
            {
                using (TaskData tData = new TaskData())
                {
                    using (GoalData gData = new GoalData())
                    {
                        List <Project>          childProjects = gData.GetChildProjects(SelectedGoal.GoalId);
                        List <ProjectViewModel> rowData       = new List <ProjectViewModel>();
                        foreach (Project project in childProjects)
                        {
                            rowData.Add(new ProjectViewModel(project, pData, tData));
                        }

                        flowDocument.Blocks.Add(FlowDocumentHelper.BuildTable <ProjectViewModel>(columnDefinitions, rowData));

                        foreach (ProjectViewModel projectVm in rowData)
                        {
                            projectVm.Dispose();
                        }
                    }
                }
            }

            return(flowDocument);
        }
        public AllGoalsViewModel(GoalData goalData, ProjectData projectData, TaskData taskData)
        {
            if (goalData == null)
            {
                throw new ArgumentNullException("goalData");
            }

            if (projectData == null)
            {
                throw new ArgumentNullException("projectData");
            }

            if (taskData == null)
            {
                throw new ArgumentNullException("taskData");
            }

            base.DisplayName  = Properties.Resources.Goals_DisplayName;
            base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/goal.png";

            _goalData    = goalData;
            _projectData = projectData;
            _taskData    = taskData;

            // Subscribe for notifications of when a new goal is saved.
            _goalData.GoalAdded   += this.OnGoalAdded;
            _goalData.GoalUpdated += this.OnGoalUpdated;
            _goalData.GoalDeleted += this.OnGoalDeleted;

            // Populate the AllGoals collection with GoalViewModels.
            this.AllGoals = new ObservableCollection <GoalViewModel>();
            this.AllGoals.CollectionChanged += this.OnCollectionChanged;

            this.PageFirst();

            SortColumns.Add(new SortableProperty()
            {
                Description = "Title", Name = "Title"
            });
            SortColumns.Add(new SortableProperty()
            {
                Description = "Status", Name = "StatusId"
            });
            SortColumns.Add(new SortableProperty()
            {
                Description = "Category", Name = "CategoryId"
            });
            SortColumns.Add(new SortableProperty()
            {
                Description = "Date Created", Name = "CreatedDate"
            });
            SortColumns.Add(new SortableProperty()
            {
                Description = "Date Completed", Name = "CompletedDate"
            });

            SelectedSortColumn = SortColumns.FirstOrDefault();

            // select the first goal
            GoalViewModel firstGoal = AllGoals.FirstOrDefault();

            if (firstGoal != null)
            {
                firstGoal.IsSelected = true;
            }
        }