Ejemplo n.º 1
0
        /// <summary>
        /// GetProject
        /// </summary>
        /// <param name="projectID">int</param>
        /// <returns>Project</returns>
        public static Project GetProject(int projectID)
        {
            try
            {   // get the project info from database.
                using (var db = new ProjectManagerEntities())
                {
                    var query = (from p in db.ProjectDALs
                                 where p.ProjectID == projectID
                                select p).FirstOrDefault();

                    if (query != null)
                    {
                        var proj = new Project
                                 (
                                      query.ProjectID,
                                      query.Name,
                                      DateTime.Parse(query.StartDate.ToString()),
                                      DateTime.Parse(query.EndDate.ToString()),
                                      query.Status,
                                      query.Description,
                                      query.ProjectCategoryID.ToString(),
                                      DateTime.Parse(query.DueDate.ToString())
                                 );

                        return proj;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return null;
        }
        public void SummaryForProjectTest()
        {
            IssuePriorityReport target = new IssuePriorityReport(); // TODO: Initialize to an appropriate value
            Project project = new Project(1, "Test", DateTime.Now, DateTime.Now.AddDays(1), "", "", "", DateTime.Now.AddDays(1));

            TableRow[] result = target.SummaryForProject(null);
            Assert.AreEqual(result.Length, 0);

            result = target.SummaryForProject(project);
            Assert.AreEqual(result.Length, 5);
            Assert.AreEqual("Issues by Priority", result[0].Cells[0].Text);
            Assert.AreEqual("Priority", result[1].Cells[0].Text);
            Assert.AreEqual("Count", result[1].Cells[1].Text);
            Assert.AreEqual("High", result[2].Cells[0].Text);
            Assert.AreEqual("Medium", result[3].Cells[0].Text);
            Assert.AreEqual("Low", result[4].Cells[0].Text);
            Assert.AreEqual("0", result[2].Cells[1].Text);
            Assert.AreEqual("0", result[3].Cells[1].Text);
            Assert.AreEqual("0", result[4].Cells[1].Text);

            project.AddIssue(CreateIssue(Issue.IssuePriority.High));
            result = target.SummaryForProject(project);
            Assert.AreEqual("1", result[2].Cells[1].Text);

            project.AddIssue(CreateIssue(Issue.IssuePriority.Medium));
            result = target.SummaryForProject(project);
            Assert.AreEqual("1", result[3].Cells[1].Text);

            project.AddIssue(CreateIssue(Issue.IssuePriority.Low));
            result = target.SummaryForProject(project);
            Assert.AreEqual("1", result[4].Cells[1].Text);
        }
Ejemplo n.º 3
0
 public void DisplayTest()
 {
     ProjectSummary target = new ProjectSummary();
     Project project = new Project(0, "Name", DateTime.Now, DateTime.Now, "", "", "", DateTime.Now);
     Control control = target.Display(project, new DateRange(DateTime.Now, DateTime.Now));
     Assert.IsInstanceOfType(control, typeof(Table));
     Table table = control as Table;
     Assert.AreEqual(9, table.Rows.Count);
 }
Ejemplo n.º 4
0
 protected void ProjectNames_SelectedIndexChanged(object sender, EventArgs e)
 {
     List<Project> projects = ProjectManagerBLL.ProjectBLL.GetProjectList();
     if (projects.Count > 0)
     {
         selectedProject = null;
         foreach (var project in projects)
         {
             if (project.ToString() == ProjectNames.SelectedItem.Text)
             {
                 selectedProject = project;
             }
         }
     }
     ContentPanel.Visible = selectedProject != null;
     ContentPanel.Controls.Clear();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// GetProjectList
        /// </summary>
        /// <returns>List<IssueModel></returns>
        public static List<Project> GetProjectList()
        {
            List<Project> projects = new List<Project>();

            try
            {
                using (var db = new ProjectManagerEntities())
                {
                    var query = from p in db.ProjectDALs
                                select p;

                    // get the list of projects.
                    foreach (var q in query)
                    {
                        var proj = new Project
                                 (
                                      q.ProjectID,
                                      q.Name,
                                      DateTime.Parse(q.StartDate.ToString()),
                                      DateTime.Parse(q.EndDate.ToString()),
                                      q.Status,
                                      q.Description,
                                      q.ProjectCategoryID.ToString(),
                                      DateTime.Parse(q.DueDate.ToString())
                                 );
                        var issueDals = new IssueDAL();
                        // get the list of issues for the specific projectID.
                        proj.Issues = issueDals.GetIssueList(proj.ProjectID);
                        // add to the project list
                        projects.Add(proj);

                    }

                }

            }
            catch (Exception)
            {
                throw;
            }
            return projects;
        }
Ejemplo n.º 6
0
        public void SummaryForProjectTest()
        {
            IssueStatus target = new IssueStatus();
            Project project = null;
            TableRow[] actual = target.SummaryForProject(project);
            Assert.AreEqual(actual.Length, 0);

            project = new Project(1, "Test", DateTime.Now.Subtract(TimeSpan.FromDays(5)), DateTime.Now, "Status", "Description", "Category", DateTime.Now);
            actual = target.SummaryForProject(project);
            Assert.AreEqual(actual.Length, 4);
            Assert.AreEqual(actual[2].Cells[1].Text, "0");
            Assert.AreEqual(actual[3].Cells[1].Text, "0");

            project.AddIssue(new Issue());
            Issue issue = new Issue();
            issue.UpdateStatus(Issue.IssueStatus.Resolved, DateTime.Now);
            project.AddIssue(issue);
            actual = target.SummaryForProject(project);
            Assert.AreEqual(actual.Length, 4);
            Assert.AreEqual(actual[2].Cells[1].Text, "1");
            Assert.AreEqual(actual[3].Cells[1].Text, "1");
        }
 private void AddIssues(Project project, int high, int medium, int low)
 {
     AddIssuePriorityCount(project, high, Issue.IssuePriority.High);
     AddIssuePriorityCount(project, medium, Issue.IssuePriority.Medium);
     AddIssuePriorityCount(project, low, Issue.IssuePriority.Low);
 }
 private static void AddIssuePriorityCount(Project project, int count, Issue.IssuePriority priority)
 {
     for (int i = 0; i < count; i++)
     {
         Issue issue = new Issue();
         issue.CurrentPriority = priority;
         project.AddIssue(issue);
     }
 }
        public void DisplayTest()
        {
            IssuesByUserGraph target = new IssuesByUserGraph();
            Project project = new Project(1, "Test", DateTime.Now, DateTime.Now.AddDays(1), "", "", "", DateTime.Now.AddDays(1));
            DateRange range = new DateRange(DateTime.Now.Subtract(TimeSpan.FromDays(10)), DateTime.Now);

            Control actual = target.Display(project, range);
            Assert.IsInstanceOfType(actual, typeof(Chart));

            Chart chart = actual as Chart;
            Assert.AreEqual(1, chart.Series.Count);
            Assert.AreEqual(0, chart.Series[0].Points.Count);
            Assert.AreEqual(1, chart.Legends.Count);
            Assert.AreEqual(1, chart.Titles.Count);
        }
Ejemplo n.º 10
0
 public void EvaluateProjectTest()
 {
     IssuesByUserGraph_Accessor target = new IssuesByUserGraph_Accessor(); // TODO: Initialize to an appropriate value
     Project project = new Project(1, "Test", DateTime.Now, DateTime.Now.AddDays(1), "", "", "", DateTime.Now.AddDays(1));
     DateRange range = new DateRange(DateTime.Now, DateTime.Now);
     List<Series> actual = target.EvaluateProject(project, range);
     Assert.AreEqual(1, actual.Count);
     Assert.AreEqual(0, actual[0].Points.Count);
 }
Ejemplo n.º 11
0
 public void ProjectConstructorInvalidName()
 {
     Project project = new Project(1, "", new DateTime(2013, 5, 25), new DateTime(2013, 5, 26), "Open", "", "", new DateTime(2013, 5, 27));
 }
 private static void AddIssues(Project project, int resolved, int unresolved)
 {
     Issue issue;
     for (int i = 0; i < resolved; i++)
     {
         issue = new Issue();
         issue.CurrentStatus = Issue.IssueStatus.Resolved;
         project.Issues.Add(issue);
     }
     for (int i = 0; i < unresolved; i++)
     {
         issue = new Issue();
         issue.CurrentStatus = Issue.IssueStatus.Unresolved;
         project.Issues.Add(issue);
     }
 }
Ejemplo n.º 13
0
        public void SummaryForProjectTest()
        {
            IssuesByUser target = new IssuesByUser();
            Project project = null;
            TableRow[] actual = target.SummaryForProject(project);
            Assert.AreEqual(actual.Length, 0);

            project = new Project(1, "Test", DateTime.Now.Subtract(TimeSpan.FromDays(5)), DateTime.Now, "Status", "Description", "Category", DateTime.Now);
            actual = target.SummaryForProject(project);
            Assert.AreEqual(actual.Length, 0);

            project = CreateInitialProject();
            actual = target.SummaryForProject(project);
            Assert.AreEqual(3, actual.Length);
            Assert.AreEqual("User1", actual[2].Cells[0].Text);
            Assert.AreEqual("1", actual[2].Cells[1].Text);

            project = CreateSecondTestProject();
            actual = target.SummaryForProject(project);
            Assert.AreEqual(actual.Length, 4);
            Assert.AreEqual(actual[2].Cells[0].Text, "User2");
            Assert.AreEqual(actual[2].Cells[1].Text, "2");
            Assert.AreEqual(actual[3].Cells[0].Text, "User1");
            Assert.AreEqual(actual[3].Cells[1].Text, "1");
        }
Ejemplo n.º 14
0
 private Project CreateInitialProject()
 {
     Project project = new Project(1, "Test", DateTime.Now.Subtract(TimeSpan.FromDays(5)), DateTime.Now, "Status", "Description", "Category", DateTime.Now);
     Issue issue = new Issue();
     issue.Assignee = new User(0, "User1", "", "", "", "", "", "", "", "");
     project.AddIssue(issue);
     return project;
 }