コード例 #1
0
ファイル: HomeController.cs プロジェクト: ZandileN/Elearning
        public ActionResult Index()
        {

            PolicyDAOImpl policy = new PolicyDAOImpl();
            ICollection<Policy> policyList = policy.FindAll();

            return View(policyList);
        }
コード例 #2
0
ファイル: DepartmentTest.cs プロジェクト: ZandileN/Elearning
        public void TestInsertDepartment()
        {

            Department d = new Department()
            {

                DepartmentID = 1,
                DepartmentName = "IS",
                Description = "Information Technology"


            };

            using (DepartmentDAOImpl daoImpl = new DepartmentDAOImpl())
            {
                bool isPer = daoImpl.Persist(d);

                Assert.IsTrue(isPer);

            }

            Policy policy = new Policy()
            {
                PolicyID = 1,
                Version = 1,
                DepartmentID = d.DepartmentID, 
                PolicyName = "MoonLight",
                Description = "The Policy about having business outside PetroSA",
                DocumentBlob = "www/intranet/petrosa/policies/veri",


            };

            using (PolicyDAOImpl daoImpl = new PolicyDAOImpl())
            {
                bool isPer = daoImpl.Persist(policy);

                Assert.IsTrue(isPer);

            }
          
         
          
        }
コード例 #3
0
ファイル: PositionTest.cs プロジェクト: ZandileN/Elearning
        public void TestInsertPosition()
        {

            Policy policy = new Policy()
            {
                PolicyID = 2,
                Version = 1,
                PolicyName = "Time",
                Description = "The Policy about PetroSA's Time schedule",
                DocumentBlob = "www/intranet/petrosa/policies/Time",


            };

            using (PolicyDAOImpl daoImpl = new PolicyDAOImpl())
            {
                bool isPer = daoImpl.Persist(policy);

                Assert.IsTrue(isPer);

            }

            Position pos = new Position()
            {

                PositionID = 1,
                PolicyID = policy.PolicyID,
                Version = policy.Version,
                PositionName = "Finance Services Manager",
                Description = "Takes care of Money",

            };

            using (PositionDAOImpl daoImpl = new PositionDAOImpl())
            {
                bool isPer = daoImpl.Persist(pos);

                Assert.IsTrue(isPer);

            }


        }
コード例 #4
0
ファイル: ScoreTest.cs プロジェクト: ZandileN/Elearning
        public void TestInsertScore()
        {

            Employee e = new Employee()
            {

                EmployeeID = 3,
                Firstname = "Lola",
                Lastname = "Wadsen",
                PersonnelNum = 3366,
                JobTitle = "IS Infrustruture Manager",
                Position = "Finance Services Manager",
                ExitDate = null,
                HireDate = null,


            };

            using (EmployeeDAOImpl daoImpl = new EmployeeDAOImpl())
            {
                bool isPer = daoImpl.Persist(e);

                Assert.IsTrue(isPer);

            }



            Answer a = new Answer()
            {
                AnswerID = "a",
                Option1 = "2",
                Option2 = "3",
                Option3 = "9",
                Option4 = "21",

            };

            using (AnswerDAOImpl daoImpl = new AnswerDAOImpl())
            {
                bool isPer = daoImpl.Persist(a);

                Assert.IsTrue(isPer);

            }


            Policy policy = new Policy()
            {
                PolicyID = 2,
                Version = 1,
                PolicyName = "Leave",
                Description = "The Policy about Leave",
                DocumentBlob = "www/intranet/petrosa/policies/Leave",


            };

            using (PolicyDAOImpl daoImpl = new PolicyDAOImpl())
            {
                bool isPer = daoImpl.Persist(policy);

                Assert.IsTrue(isPer);

            }



            Question question = new Question()
            {
                QuestionID = 1,
                PolicyID = policy.PolicyID,
                Version = policy.Version,
                Description = "how many companies are you allowes to have ouside petrosa",

            };

            using (QuestionDAOImpl daoImpl = new QuestionDAOImpl())
            {
                bool isPer = daoImpl.Persist(question);

                Assert.IsTrue(isPer);

            }
            

            Score s = new Score()
            {

                ScoreID = 1,
                EmployeeID = e.EmployeeID,
                QuestionID = question.QuestionID,
                Mark = 70,
                Date = new DateTime(),
                Status = "Not Certified",
                Page = 20,
                Attempt = 2,


            };



            using (ScoreDAOImpl daoImpl = new ScoreDAOImpl())
            {
                bool isPer = daoImpl.Persist(s);

                Assert.IsTrue(isPer);

            }

        }