Ejemplo n.º 1
0
        public override FlowDocument Build()
        {
            FlowDocument flowDocument = new FlowDocument();

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

            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) },
                { "PriorityDescription", new Tuple <string, string>("Priority", null) },
                { "CreatedDate", new Tuple <string, string>("Date Created", null) },
                { "CompletedDate", new Tuple <string, string>("Date Completed", null) }
            };

            using (TaskData tData = new TaskData())
            {
                List <Task>          activeTasks = tData.GetActiveTasks();
                List <TaskViewModel> rowData     = new List <TaskViewModel>();
                foreach (Task task in activeTasks)
                {
                    rowData.Add(new TaskViewModel(task, tData));
                }

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

                foreach (TaskViewModel taskVm in rowData)
                {
                    taskVm.Dispose();
                }
            }

            return(flowDocument);
        }
Ejemplo n.º 2
0
        public override FlowDocument Build()
        {
            FlowDocument flowDocument = new FlowDocument();

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

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

            startTitleSpan.Inlines.Add("Start Date: ");
            startTitleSpan.FontWeight = FontWeights.Bold;
            Span startValueSpan = new Span();

            startValueSpan.Inlines.Add(StartDate.ToShortDateString());
            Span endTitleSpan = new Span();

            endTitleSpan.Inlines.Add("     End Date: ");
            endTitleSpan.FontWeight = FontWeights.Bold;
            Span endValueSpan = new Span();

            endValueSpan.Inlines.Add(EndDate.ToShortDateString());
            criteriaPara.Inlines.Add(startTitleSpan);
            criteriaPara.Inlines.Add(startValueSpan);
            criteriaPara.Inlines.Add(endTitleSpan);
            criteriaPara.Inlines.Add(endValueSpan);
            flowDocument.Blocks.Add(criteriaPara);

            return(flowDocument);
        }
        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(SelectedProject.Title);
            Span dateTitleSpan = new Span();

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

            dateValueSpan.Inlines.Add(SelectedProject.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>("Task Title", null) },
                { "StatusDescription", new Tuple <string, string>("Status", null) },
                { "PriorityDescription", new Tuple <string, string>("Priority", null) },
                { "CreatedDate", new Tuple <string, string>("Date Created", null) },
                { "CompletedDate", new Tuple <string, string>("Date Completed", null) }
            };

            using (TaskData tData = new TaskData())
            {
                using (ProjectData pData = new ProjectData())
                {
                    List <Task>          childTasks = pData.GetChildTasks(SelectedProject.ProjectId);
                    List <TaskViewModel> rowData    = new List <TaskViewModel>();
                    foreach (Task task in childTasks)
                    {
                        rowData.Add(new TaskViewModel(task, tData));
                    }

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

                    foreach (TaskViewModel taskVm in rowData)
                    {
                        taskVm.Dispose();
                    }
                }
            }

            return(flowDocument);
        }
        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);
        }