コード例 #1
0
        /// <summary>
        /// This method violate Open Closed principle
        /// </summary>
        public static void OCPrincipleProb()
        {
            Console.WriteLine("report generation started...");
            ReportGeneration report = new ReportGeneration();

            report.GenerateReport((int)ReportType.CSV);
            report.GenerateReport((int)ReportType.Excel);
            report.GenerateReport((int)ReportType.PDF);
            report.GenerateReport((int)ReportType.WORD);
            Console.WriteLine("report generated...");
        }
コード例 #2
0
        /// <summary>
        /// This method achive Single responsibility principle
        /// </summary>
        public static void SRPrincipleResolve()
        {
            EmployeeV2 emp = new EmployeeV2();

            emp.deleteAllEmp();
            Console.WriteLine("employee records deleted...");
            emp.EmpName     = "Sandeep Tathe";
            emp.Designation = "Specialist";
            emp.insertEmployee(emp);
            emp.EmpName     = "Yogiraj Deshpande";
            emp.Designation = "Senior Consultant";
            emp.insertEmployee(emp);
            Console.WriteLine("employee records inserted...");

            Console.WriteLine("report generation started...");
            ReportGeneration report = new ReportGeneration();

            report.GenerateReport((int)ReportType.CSV);
            Console.WriteLine("report generated...");
        }