コード例 #1
0
ファイル: Example.cs プロジェクト: kidroca/Students-Generator
        static void Main()
        {
            var generator = new SimpleGenerator();

            IList <Student> students = generator.Genereate(10);

            Console.WriteLine("Working with this set of students:\n");

            foreach (var s in students)
            {
                Console.WriteLine(s);
                Console.WriteLine("Group: {0}\n", s.GroupNumber);
            }

            var textDocParser = new TextDocumentParser();

            IList <XcelStudent> xcelStudents =
                textDocParser.Genereate(10, 10).Cast <XcelStudent>().ToList();

            foreach (var s in xcelStudents)
            {
                Console.WriteLine(s);
                Console.WriteLine("Type: {0}\n", s.StudentType);
            }
        }
コード例 #2
0
ファイル: Example.cs プロジェクト: kidroca/Students-Generator
        static void Main()
        {
            var generator = new SimpleGenerator();

            IList<Student> students = generator.Genereate(10);

            Console.WriteLine("Working with this set of students:\n");

            foreach (var s in students)
            {
                Console.WriteLine(s);
                Console.WriteLine("Group: {0}\n", s.GroupNumber);
            }

            var textDocParser = new TextDocumentParser();

            IList<XcelStudent> xcelStudents =
                textDocParser.Genereate(10, 10).Cast<XcelStudent>().ToList();

            foreach (var s in xcelStudents)
            {
                Console.WriteLine(s);
                Console.WriteLine("Type: {0}\n", s.StudentType);
            }
        }
コード例 #3
0
        static void Main()
        {
            helper.ConsoleMio.Setup();
            helper.ConsoleMio.PrintHeading("LINQ to Excel ");

            var studentsExtractor = new TextDocumentParser();

            IList <XcelStudent> students =
                studentsExtractor.Genereate(1000).Cast <XcelStudent>().ToList();

            var sheet = new Worksheet("Online Students");

            string[] sheetHeader = studentsExtractor.HeaderLine;

            for (int i = 0; i < sheetHeader.Length; i++)
            {
                sheet.Cells[0, i] = new Cell(sheetHeader[i]);
            }

            // Add the result filed in the end
            sheet.Cells[0, sheetHeader.Length] = new Cell("Result");

            helper.ConsoleMio.PrintColorText("Proccessing information...\n\n", ConsoleColor.DarkCyan);
            var onlineStudents = students
                                 .Where(student => student.StudentType == StudentType.Online)
                                 .OrderByDescending(student => student.CalculateResult())
                                 .ToArray();

            for (int i = 0; i < onlineStudents.Length; i++)
            {
                XcelStudent student = onlineStudents[i];
                AddStudentDataToSheet(sheet, i + 1, student);
            }

            var workbook = new Workbook();

            workbook.Worksheets.Add(sheet);

            helper.ConsoleMio.PrintColorText(
                "Query Completed\n", ConsoleColor.Green);

            string saveLocation = helper.SelectSaveLocation("Xcel Files|*.xls");

            workbook.Save(saveLocation);

            helper.ConsoleMio.PrintColorText("Done", ConsoleColor.Green);

            helper.ConsoleMio.Restart(Main);
        }
コード例 #4
0
        static void Main()
        {
            helper.ConsoleMio.Setup();
            helper.ConsoleMio.PrintHeading("LINQ to Excel ");

            var studentsExtractor = new TextDocumentParser();

            IList<XcelStudent> students =
                studentsExtractor.Genereate(1000).Cast<XcelStudent>().ToList();

            var sheet = new Worksheet("Online Students");
            string[] sheetHeader = studentsExtractor.HeaderLine;

            for (int i = 0; i < sheetHeader.Length; i++)
            {
                sheet.Cells[0, i] = new Cell(sheetHeader[i]);
            }

            // Add the result filed in the end
            sheet.Cells[0, sheetHeader.Length] = new Cell("Result");

            helper.ConsoleMio.PrintColorText("Proccessing information...\n\n", ConsoleColor.DarkCyan);
            var onlineStudents = students
                .Where(student => student.StudentType == StudentType.Online)
                .OrderByDescending(student => student.CalculateResult())
                .ToArray();

            for (int i = 0; i < onlineStudents.Length; i++)
            {
                XcelStudent student = onlineStudents[i];
                AddStudentDataToSheet(sheet, i + 1, student);
            }

            var workbook = new Workbook();
            workbook.Worksheets.Add(sheet);

            helper.ConsoleMio.PrintColorText(
                "Query Completed\n", ConsoleColor.Green);

            string saveLocation = helper.SelectSaveLocation("Xcel Files|*.xls");
            workbook.Save(saveLocation);

            helper.ConsoleMio.PrintColorText("Done", ConsoleColor.Green);

            helper.ConsoleMio.Restart(Main);
        }