コード例 #1
0
ファイル: Program.cs プロジェクト: arslan8512/Demo
        static void Main(string[] args)
        {
            String  path    = "D://xyz.txt";
            Program obj_pro = new Program();

            Console.Clear();
            Console.WriteLine("Press 1 FOR ENTERING STUDENTS PROFILE INFORMATION: ");
            Console.WriteLine("      2 FOR SEARCHING RECORD:  ");
            Console.WriteLine("      3 FOR DELETING A RECORD: ");
            Console.WriteLine("      4 FOR LISTING TOP 3 STUDENTS: ");
            Console.WriteLine("      5 FOR MARKING ATTENDANCE: ");
            Console.WriteLine("      6 FOR VIEWING ATTANDANCE: ");
            String choice = Console.ReadLine();

            if (choice == "1")
            {
                Student obj = new Student();
                obj.getData();
                obj.setData(path);
            }
            else if (choice == "2")
            {
                Console.Clear();
                Console.WriteLine("PRESS 1 TO SEARCH BY ID:   ");
                Console.WriteLine("      2 TO SEARCH BY NAME ");
                Console.WriteLine("      3 TO SEARCH BY SEMSTER");
                Console.WriteLine("Total Num of Students Are :");
                String searchchoice = Console.ReadLine();
                if (searchchoice == "1")
                {
                    Console.WriteLine("Enter ID :");
                    string id = Console.ReadLine();
                    obj_pro.searchById(path, id);
                }
                else if (searchchoice == "2")
                {
                    Console.WriteLine("Enter Name :");
                    string name = Console.ReadLine();
                    obj_pro.searchByName(path, name);
                }
                else if (searchchoice == "3")
                {
                    Console.WriteLine("Enter Semester :");
                    string semester = Console.ReadLine();
                    obj_pro.searchBySemester(path, semester);
                }
                else
                {
                    Console.WriteLine("Invalid choice");
                }
            }
        }