Exemple #1
0
        public Model()
        {
            _userList = new List <User>();

            Project project1 = new Project();

            project1.ProjectName        = "Project1";
            project1.ProjectDescription = "Project1 123";

            Requirement requirement1 = new Requirement();

            requirement1.RequirementName        = "Re1";
            requirement1.RequirementDescription = "Re1 123";
            project1.AddRequirement(requirement1);
            Test test1 = new Test();

            test1.testName        = "Te1";
            test1.testDescription = "Te1 123";
            project1.AddTest(test1);
            Test test2 = new Test();

            test2.testName        = "Te2";
            test2.testDescription = "Te2 123";
            project1.AddTest(test2);

            Project project2 = new Project();

            project2.ProjectName        = "Project2";
            project2.ProjectDescription = "Project2 456";

            Project project3 = new Project();

            project3.ProjectName        = "Project3";
            project3.ProjectDescription = "Project3 789";
            Requirement requirement2 = new Requirement();

            requirement2.RequirementName        = "Re3";
            requirement2.RequirementDescription = "Re3 123";
            project3.AddRequirement(requirement2);
            Requirement requirement3 = new Requirement();

            requirement3.RequirementName        = "Re4";
            requirement3.RequirementDescription = "Re4 456";
            project3.AddRequirement(requirement3);
            Requirement requirement4 = new Requirement();

            requirement4.RequirementName        = "Re5";
            requirement4.RequirementDescription = "Re5 789";
            project3.AddRequirement(requirement4);
            Requirement requirement5 = new Requirement();

            requirement5.RequirementName        = "Re6";
            requirement5.RequirementDescription = "Re6 012";
            project3.AddRequirement(requirement5);
            Test test3 = new Test();

            test3.testName        = "Te3";
            test3.testDescription = "Te3 123";
            test3.AddRequirement(requirement3);
            test3.AddRequirement(requirement5);
            project3.AddTest(test3);
            Test test4 = new Test();

            test4.testName        = "Te4";
            test4.testDescription = "Te4 456";
            test4.AddRequirement(requirement4);
            test4.AddRequirement(requirement5);
            project3.AddTest(test4);

            User user1 = new User();

            user1.UserAccount  = "admin";
            user1.UserPassword = "******";
            user1.UserIdentity = "Manager";
            user1.addProject(project1);
            user1.addProject(project2);
            user1.addProject(project3);

            _userList.Add(user1);
        }
        public ManagerCollecter()
        {
            _userManage        = new UserManager();
            _projectManage     = new ProjectManager();
            _requirementManage = new RequirementManager();
            _testManage        = new TestManager();

            DataTable      projectTable = DBManager.GetProjects();
            List <Project> projects     = new List <Project>();

            foreach (DataRow projectRow in projectTable.Rows)
            {
                Project project = new Project();
                project.ProjectName        = projectRow["ProjectName"].ToString();
                project.ProjectDescription = projectRow["ProjectDescription"].ToString();
                projects.Add(project);

                DataTable requirementTable = DBManager.GetRequirementByProjectId((int)projectRow["Id"]);
                foreach (DataRow reqRow in requirementTable.Rows)
                {
                    Requirement requirement = new Requirement();
                    requirement.RequirementName        = reqRow["RequirementName"].ToString();
                    requirement.RequirementDescription = reqRow["RequirementDescription"].ToString();
                    requirement.Project = project;
                    _requirementManage.addRequirement(requirement);
                }

                DataTable testTable = DBManager.GetTestByProjectId((int)projectRow["Id"]);
                foreach (DataRow testRow in testTable.Rows)
                {
                    Test test = new Test();
                    test.TestName        = testRow["TestName"].ToString();
                    test.TestDescription = testRow["TestDescription"].ToString();
                    test.Project         = project;

                    List <Requirement> requirementsMap         = new List <Requirement>();
                    DataTable          testMapRequirementTable = DBManager.GetTestMapRequirementByTestId((int)testRow["Id"]);
                    foreach (DataRow testMapReq in testMapRequirementTable.Rows)
                    {
                        Requirement reqRelateTest = _requirementManage.GetRequirements(project).Find(c => (c.RequirementName == testMapReq["RequirementName"].ToString()));
                        requirementsMap.Add(reqRelateTest);
                        _testManage.addTest(test, reqRelateTest, (testMapReq["IsCompleted"].ToString() == "True") ? true : false);
                    }
                }
            }

            DataTable userTable = DBManager.GetUsers();

            foreach (DataRow userDataRow in userTable.Rows)
            {
                User user = new User();
                user.UserAccount  = userDataRow["Account"].ToString();
                user.UserPassword = userDataRow["Password"].ToString();
                user.UserIdentity = userDataRow["Title"].ToString();
                DataTable userInProjectTable = DBManager.GetProjectByUserAccount(user.UserAccount);

                foreach (DataRow projectRow in userInProjectTable.Rows)
                {
                    Project project = projects.Find(c => (c.ProjectName == projectRow["ProjectName"].ToString() && c.ProjectDescription == projectRow["ProjectDescription"].ToString()));
                    _projectManage.addProject(user, project);
                }
                _userManage.addUser(user);
            }
        }
Exemple #3
0
 public void AddRequirement(Requirement requirement)
 {
     _requirements.Add(requirement);
 }
Exemple #4
0
 public void deleteRequirement(Requirement requirement)
 {
     _requirements.Remove(requirement);
 }
 public TestMapRequirement(Test test, Requirement req, bool isComplete)
 {
     _test        = test;
     _requirement = req;
     _isComplete  = isComplete;
 }
Exemple #6
0
 public void editRequirement(Requirement requirement)
 {
 }
Exemple #7
0
 public void updateTestMapRequirementIsComplete(Test test, Requirement req, bool isComplete)
 {
     _tests.Find(c => c.Test == test && c.Requirement == req).IsComplete = isComplete;
 }
Exemple #8
0
 public bool getTestMapRequirementIsComplete(Test test, Requirement req)
 {
     return(_tests.Find(c => c.Test == test && c.Requirement == req).IsComplete);
 }
Exemple #9
0
 public void addTest(Test test, Requirement requirement, bool isComplete)
 {
     _tests.Add(new TestMapRequirement(test, requirement, isComplete));
 }
 public ShowAddRequirementDialog(Requirement requirement)
 {
     InitializeComponent();
     _requirementNameTxt.Text        = requirement.RequirementName;
     _requirementDescriptionTxt.Text = requirement.RequirementDescription;
 }