コード例 #1
0
ファイル: Program.cs プロジェクト: lorneroy/CSharpClass
        static void TestProject()
        {
            DataAccessLayer.Project objP = new DataAccessLayer.Project();
            int NewID, RC;
            RC = objP.InsProject("testName", "testDescription", out NewID);
            Console.WriteLine("RC: {0} and NewID: {1}", RC, NewID);

            foreach (Project prjt in objP.SelProjects())
            {
                Console.WriteLine("Project ID: {0}, Project Name: {1}, Project Description: {2}", prjt.ProjectID, prjt.ProjectName, prjt.ProjectDescription);
            }

            RC = objP.UpdProject(NewID, "testname2", "testDescription2");

            Console.WriteLine("RC: {0} on update call", RC);

            foreach (Project prjt in objP.SelProjects())
            {
                Console.WriteLine("Project ID: {0}, Project Name: {1}, Project Description: {2}", prjt.ProjectID, prjt.ProjectName, prjt.ProjectDescription);
            }

            RC = objP.DelProject(NewID);

            Console.WriteLine("RC: {0} on delete call", RC);

            foreach (Project prjt in objP.SelProjects())
            {
                Console.WriteLine("Project ID: {0}, Project Name: {1}, Project Description: {2}", prjt.ProjectID, prjt.ProjectName, prjt.ProjectDescription);
            }

        }
コード例 #2
0
ファイル: Program.cs プロジェクト: lorneroy/CSharpClass
        static void TestEmployeeProjectHour()
        {
            DataAccessLayer.EmployeeProjectHour objEph = new DataAccessLayer.EmployeeProjectHour();
            int RC;
            DateTime dt = DateTime.Now;
            int newEmployeeID;
            int newProjectID;


            foreach (EmployeeProjectHour prjt in objEph.SelEmployeeProjectHours())
            {
                Console.WriteLine("Employee ID: {0}, Employee Name {1}, Project ID: {2}, Project Name: {3}, Date: {4}, Hours: {5}", prjt.EmployeeID, prjt.EmployeeName, prjt.ProjectID, prjt.ProjectName, prjt.Date, prjt.Hours);
            }

            //create an employee and a project to insert
            Employee objEmpl = new Employee();
            objEmpl.InsEmployee("bob dobalina",out newEmployeeID);

            Project objProj = new Project();
            objProj.InsProject("recording","", out newProjectID);

            RC = objEph.InsEmployeeProjectHours(newEmployeeID, newProjectID, dt, 42); 

            Console.WriteLine();
            Console.WriteLine("RC: {0}", RC);

            foreach (EmployeeProjectHour prjt in objEph.SelEmployeeProjectHours())
            {
                Console.WriteLine("Employee ID: {0}, Employee Name {1}, Project ID: {2}, Project Name: {3}, Date: {4}, Hours: {5}", prjt.EmployeeID, prjt.EmployeeName, prjt.ProjectID, prjt.ProjectName, prjt.Date, prjt.Hours);
            }

            RC = objEph.UpdEmployeeProjectHours(newEmployeeID, newProjectID, dt, 104); 

            Console.WriteLine();
            Console.WriteLine("RC: {0}", RC);

            foreach (EmployeeProjectHour prjt in objEph.SelEmployeeProjectHours())
            {
                Console.WriteLine("Employee ID: {0}, Employee Name {1}, Project ID: {2}, Project Name: {3}, Date: {4}, Hours: {5}", prjt.EmployeeID, prjt.EmployeeName, prjt.ProjectID, prjt.ProjectName, prjt.Date, prjt.Hours);
            }

            RC = objEph.DelEmployeeProjectHours(newEmployeeID, newProjectID, dt); 

            Console.WriteLine();
            Console.WriteLine("RC: {0}", RC);

            foreach (EmployeeProjectHour prjt in objEph.SelEmployeeProjectHours())
            {
                Console.WriteLine("Employee ID: {0}, Employee Name {1}, Project ID: {2}, Project Name: {3}, Date: {4}, Hours: {5}", prjt.EmployeeID, prjt.EmployeeName, prjt.ProjectID, prjt.ProjectName, prjt.Date, prjt.Hours);
            }

            objEmpl.DelEmployee(newEmployeeID);
            objProj.DelProject(newProjectID);

        }