Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DBSManagementSoftwarePackage
- {
- class College
- {
- static void Main(string[] args)
- {
- int choice,menuOption;
- string switchChoice;
- bool running = true;
- Person p=new Person();
- mainmenu:
- Console.WriteLine("\n====DBS Management Software====");
- Console.WriteLine("\nPlease select an option from the following");
- Console.WriteLine("\n1: Enter Student details \n2: Enter Employee details");
- Console.Write("\nChoice: ");
- choice = int.Parse(Console.ReadLine());
- /*-------------------------------------------------------------------------------------------STUDENT MENU-------------------------------------------------------------------------------------------*/
- if (choice == 1)
- {
- StudentList sList = new StudentList();
- /* Name n1=new Name();
- n1.FirstName="John";
- n1.LastName="Baiege";
- Address a1=new Address();
- a1.HouseNo="1234";
- a1.Street="Same street";
- a1.City="Dublin";
- a1.County="Dublin";*/
- //StudentList sl1 = new StudentList("S123","Mr",n1 ,new DateTime(1982,10,03),"F", a1,"01-364899","no@email.com", "Postgrad","Law", "Full Time","Level 8",38.69M, new DateTime(2010,10,20), new DateTime(2014,10,20));
- // StudentList sl2 = new StudentList();
- //string id, string title, Name name, DateTime dob, string gender, Address address, string phone, string email, StudentStatus status, string course, string mode, string level, decimal fees, DateTime startDate, DateTime endDate
- while (running)
- {
- Console.WriteLine("\n====STUDENT MENU====");
- Console.WriteLine("\nPlease select an option from the following");
- Console.WriteLine("1: Add a record");
- Console.WriteLine("2: Find a record by Id");
- Console.WriteLine("3: Remove a record by Id");
- Console.WriteLine("4: Show all records");
- Console.WriteLine("5: Main Menu");
- Console.WriteLine("6: Quit");
- Console.Write("\nChoice: ");
- menuOption = int.Parse(Console.ReadLine());
- Console.Clear();
- switch (menuOption)
- {
- case 1:
- do
- {
- sList.AddStudent();
- Console.Write("\nPress \"Y\" to add another record or any other key to return to the Student menu: ");
- switchChoice = Console.ReadLine();
- } while (switchChoice.ToLower() == "y");
- break;
- case 2:
- do
- {
- sList.FindStudent();
- Console.Write("\nPress \"Y\" to add another record or any other key to return to the Student menu: ");
- switchChoice = Console.ReadLine();
- } while (switchChoice.ToLower() == "y");
- break;
- case 3:
- sList.RemoveStudent();
- break;
- case 4:
- sList.ShowAll();
- break;
- case 5:
- goto mainmenu;
- case 6:
- running = false;
- break;
- default: Console.WriteLine("Invalid option");
- break;
- }//end if switch-student
- }//end of while-student
- }//end of if(choice == 1)-student
- /*-------------------------------------------------------------------------------------------EMPLOYEE MENU-------------------------------------------------------------------------------------------*/
- else if (choice == 2)
- {
- Console.WriteLine("\nPlease select an option from the following");
- Console.WriteLine("\n1: Enter Staff details \n2: Enter Teacher details");
- Console.Write("\nChoice: ");
- choice = int.Parse(Console.ReadLine());
- if (choice==1)
- {
- StaffList stList = new StaffList();
- /*-------------------------------------------------------------------------------------------STAFF-------------------------------------------------------------------------------------------*/
- while (running)
- {
- Console.WriteLine("\n====STAFF MENU====");
- Console.WriteLine("\nPlease select an option from the following");
- Console.WriteLine("1: Add a record");
- Console.WriteLine("2: Find a record by Id");
- Console.WriteLine("3: Remove a record by Id");
- Console.WriteLine("4: Show all records");
- Console.WriteLine("5: Main Menu");
- Console.WriteLine("6: Quit");
- menuOption = int.Parse(Console.ReadLine());
- switch (menuOption)
- {
- case 1:
- do
- {
- stList.AddStaff();
- Console.Write("\nPress \"Y\" to add another record or any other key to return to the Staff menu: ");
- switchChoice = Console.ReadLine();
- } while (switchChoice.ToLower() == "y");
- break;
- case 2:
- stList.FindStaff();
- break;
- case 3:
- stList.RemoveStaff();
- break;
- case 4:
- stList.ShowAllStaff();
- break;
- case 5:
- Console.Clear();
- goto mainmenu;
- case 6:
- running = false;
- break;
- default: Console.WriteLine("Invalid option");
- break;
- }//end if switch-Staff
- }//end of while-Staff
- }//end of if(choice == 1)-Staff
- else if (choice==2)
- {
- TeacherList tList = new TeacherList();
- /*-------------------------------------------------------------------------------------------TEACHER-------------------------------------------------------------------------------------------*/
- while (running)
- {
- Console.WriteLine("\n====TEACHER MENU====");
- Console.WriteLine("\nPlease select an option from the following");
- Console.WriteLine("1: Add a record");
- Console.WriteLine("2: Find a record by Id");
- Console.WriteLine("3: Remove a record by Id");
- Console.WriteLine("4: Show all records");
- Console.WriteLine("5: Main Menu");
- Console.WriteLine("6: Quit");
- Console.Write("\nChoice: ");
- menuOption = int.Parse(Console.ReadLine());
- switch (menuOption)
- {
- case 1:
- do
- {
- tList.AddTeacher();
- Console.Write("\nPress \"Y\" to add another record or any other key to return to the Teacher menu: ");
- switchChoice = Console.ReadLine();
- } while (switchChoice.ToLower() == "y");
- break;
- case 2:
- tList.FindTeacher();
- break;
- case 3:
- tList.RemoveTeacher();
- break;
- case 4:
- tList.ShowAllTeachers();
- break;
- case 5:
- Console.Clear();
- goto mainmenu;
- case 6:
- running = false;
- break;
- default: Console.WriteLine("Invalid option");
- break;
- }//end if switch-teacher
- }//end of while-teacher
- }//end of if(choice == 2)-teacher
- }//end of else if(choice == 2)-Employee
- else
- {
- Console.WriteLine("Invalid option");
- }//end of else main menu
- }//end of static main
- }//end of class College
- }//end of namespace
- /* //student and teacher list created
- static List<Student> studentList = new List<Student>();
- //static List<Teacher> teacherList = new List<Teacher>();
- static void Main(string[] args)
- {
- int option; //choice;
- string inputStatus;
- bool running = true;
- Address a = new Address();
- Name n = new Name();
- Console.WriteLine("\n====DBS Management Software====");
- Console.WriteLine("\nPlease select an option from the following");
- // Console.WriteLine("\n1: Enter Student details \n2: Enter Teacher details");
- // choice = int.Parse(Console.ReadLine());
- //**** menu for student ****
- // if (choice == 1)
- //{
- while (running)
- {
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("\n====STUDENT MENU====");
- Console.WriteLine("\nPlease select an option from the following");
- Console.WriteLine("1: Add a record");
- Console.WriteLine("2: Find a record by Id");
- Console.WriteLine("3: Remove a record by Id");
- Console.WriteLine("4: Show all records");
- Console.WriteLine("5: Quit");
- option = int.Parse(Console.ReadLine());
- //string id, string title, Name name, DateTime dob, string gender, Address address,
- //string phone, string email, StudentStatus status, string course, string mode, string level, decimal fees, DateTime startDate, DateTime endDate
- //Populate records
- a.HouseNo = "12 Holywell Cresent";
- a.Street="Main Street";
- a.City = "Dublin";
- a.County = "Dublin";
- n.FirstName = "John";
- n.LastName = "Murphy";
- Student s1 = new Student();
- //StudentList studentCollection = new StudentList();
- switch (option)
- {
- case 1:
- Student s = new Student();
- //string id, string title, Name name, DateTime dob, string gender, Address address,
- //string phone, string email, StudentStatus status, string course, string mode, string level, decimal fees, DateTime startDate, DateTime endDate
- Console.WriteLine("\nPlease enter the following details\n-------------------------------------------");
- Console.Write("\nStudent Id: ");
- s.StudentId = Console.ReadLine();
- Console.Write("\nTitle: ");
- s.Title = Console.ReadLine();
- Console.Write("\nFirst Name: ");
- n.FirstName = Console.ReadLine();
- Console.Write("\nLast Name: ");
- n.LastName = Console.ReadLine();
- Console.Write("\nDate of Birth(mm/dd/yyyy): ");
- //DateTime dob=
- s.DateOfBirth = DateTime.Parse(Console.ReadLine());
- Console.Write("\nGender: ");
- s.Gender= Console.ReadLine();
- Console.Write("\nHouse Number: ");
- a.HouseNo= Console.ReadLine();
- Console.Write("\nStreet: ");
- a.Street= Console.ReadLine();
- Console.Write("\nCity: ");
- a.City= Console.ReadLine();
- Console.Write("\nCounty: ");
- a.County= Console.ReadLine();
- Console.Write("\nPhone: ");
- s.Phone = Console.ReadLine();
- Console.Write("\nEmail: ");
- s.Email = Console.ReadLine();
- Console.Write("\nStatus(Postgrad/Undergrad): ");
- inputStatus = Console.ReadLine();
- s.StudentStatus=(StudentStatus)Enum.Parse(typeof(StudentStatus),inputStatus);
- Console.Write("\nCourse: ");
- s.StudentCourseName = Console.ReadLine();
- Console.Write("\nMode(Full Time/Part Time): ");
- s.StudentCourseMode = Console.ReadLine();
- Console.Write("\nLevel(6,7,8,9): ");
- s.StudentCourseLevel = Console.ReadLine();
- Console.Write("\nFees(euro): ");
- s.StudentCourseFees = Convert.ToDecimal(Console.ReadLine());
- Console.Write("\nCourse Start Date(mm/dd/yyyy): ");
- s.CourseStartDate = DateTime.Parse(Console.ReadLine());
- Console.Write("\nCourse End Date(mm/dd/yyy): ");
- s.CourseEndDate= DateTime.Parse(Console.ReadLine());
- // studentCollection.Add(s);
- studentList.Add(s);
- Console.ForegroundColor = ConsoleColor.DarkCyan;
- Console.WriteLine("\nStudent added successfully");
- Console.ForegroundColor = ConsoleColor.DarkMagenta;
- foreach (Student st in studentList)
- {
- Console.WriteLine("\n**************************");
- Console.WriteLine(st);
- Console.WriteLine("**************************");
- }//foreach
- // do
- // {
- // Console.Write("\nPress y to add another record and q to return to the Student menu: ");
- // choice=Console.ReadLine();
- // }while(choice.ToLower() == "y");
- break;
- case 2:
- if (studentList.Count == 0)
- {
- Console.WriteLine("\nNo student records in the list. Please add a student record");
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.White;
- Console.Write("\nPlease enter a Student Id: ");
- string id = Console.ReadLine();
- foreach (Student sFind in studentList)
- {
- if (sFind.StudentId == id)
- {
- //studentCollection.Contains(sFind);
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- Console.WriteLine("\nStudent with id {0} found\n The details are as follows:", id);
- Console.ForegroundColor = ConsoleColor.DarkMagenta;
- Console.WriteLine("\n**************************");
- Console.WriteLine(sFind);
- Console.WriteLine("**************************");
- }
- }
- }
- break;
- case 3:
- // RemoveStudent();
- break;
- case 4:
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- if (studentList.Count == 0)
- {
- Console.WriteLine("\nNo student records in the list. Please add a student record"); }
- else {
- foreach (Student studentShow in studentList)
- {
- Console.WriteLine("\n**************************");
- Console.WriteLine(studentShow);
- Console.WriteLine("**************************");
- }//foreach
- }
- break;
- case 5:
- running = false;
- break;
- default:
- Console.WriteLine("Invalid option");
- break;
- }//end of switch
- }//end of while
- //}//end of if
- // //**** menu for teacher ****
- // else if (choice == 2)
- // {
- // while (running)
- // {
- // Console.WriteLine("\n====TEACHER MENU====");
- // Console.WriteLine("\nPlease select an option from the following");
- // Console.WriteLine("1: Add a record");
- // Console.WriteLine("2: Find a record by Id");
- // Console.WriteLine("3: Remove a record by Id");
- // Console.WriteLine("4: Show all records");
- // Console.WriteLine("5: Quit");
- // option = int.Parse(Console.ReadLine());
- // switch (option)
- // {
- // case 1:
- // AddTeacher();
- // break;
- // case 2:
- // FindTeacher();
- // break;
- // case 3:
- // RemoveTeacher();
- // break;
- // case 4:
- // ShowAllTeachers();
- // break;
- // case 5:
- // running = false;
- // break;
- // default: Console.WriteLine("Invalid option");
- // break;
- // }//end of switch
- // }//end of while
- // }//end of elseif
- // else
- // {
- // Console.WriteLine("Invalid option");
- // }
- //methods
- // Console.ReadLine();
- }//end of main()
- /* public void subMenu(int opt)
- {
- Console.WriteLine("Please select an option from the following");
- Console.WriteLine("1: Add a teacher");
- Console.WriteLine("2: Find a teacher by Id");
- Console.WriteLine("3: Remove a teacher by Id");
- Console.WriteLine("4: Show all teachers");
- Console.WriteLine("5: Quit");
- }*/
- //****************************STUDENT***********************************
- //*******method to Add student record********
- //static void AddStudent()
- //{
- // Student s = new Student();
- // Console.Write("\nEnter student id: ");
- // s.StudentId = Console.ReadLine();
- // //Need to compare the id in the list then display the below statements
- // Console.Write("\nEnter student name:");
- // s.Name = Console.ReadLine();
- // Console.Write("\nEnter student phone:");
- // s.Phone = Console.ReadLine();
- // Console.Write("\nEnter student email:");
- // s.Email = Console.ReadLine();
- // Console.Write("\nEnter student status(Undergrad or Postgrad): ");
- // string inputStatus = Console.ReadLine();
- // s.StudentStatus = (StudentStatus)Enum.Parse(typeof(StudentStatus), inputStatus);
- // studentList.Add(s);
- // Console.WriteLine("\nStudent added successfully");
- // ShowAll();
- //}//end of AddStudent()
- ////*******method to Find student record********
- //static void FindStudent()
- //{
- // Console.Write("\nEnter student id: ");
- // string id = Console.ReadLine();
- // foreach(Student student in studentList)
- // {
- // //studentList.Find(s.StudentId=>s.StudentId=id);
- // if(student.StudentId == id)
- // {
- // Console.WriteLine("\nStudent with id {0} found\n The details are as follows:",id);
- // Console.WriteLine("\n**************************");
- // Console.WriteLine(student);
- // Console.WriteLine("**************************");
- // }
- // else
- // {
- // Console.WriteLine("\nStudent with id {0} not found", id);
- // }
- // }
- //}//end of method Find Student()
- ////*******method to Remove student record********
- //static void RemoveStudent()
- //{
- // Console.Write("\nEnter student id: ");
- // string id = Console.ReadLine();
- // for(int i = 0; i < studentList.Count ; i++)
- // {
- // if(studentList[i].StudentId == id)
- // {
- // studentList.Remove(studentList[i]);
- // Console.WriteLine("\nStudent removed successfully");
- // }//end of if
- // else
- // {
- // Console.WriteLine("\nError! Student record with id {0} not found in the list",id);
- // }//end of else
- // }//end of for
- //}//end of RemoveStudent()
- ////*******method to Show all student records********
- //static void ShowAll()
- //{
- // foreach (Student student in studentList)
- // {
- // Console.WriteLine("\n**************************");
- // Console.WriteLine(student);
- // Console.WriteLine("**************************");
- // }//foreach
- //}//end of ShowAll
- ////****************************TEACHER***********************************
- ////*******method to teacher record********
- //static void AddTeacher()
- //{
- // Teacher t = new Teacher();
- // //Need to compare the id in the list then display the below statements
- // Console.Write("\nEnter teacher name:");
- // t.Name = Console.ReadLine();
- // Console.Write("\nEnter teacher phone:");
- // t.Phone = Console.ReadLine();
- // Console.Write("\nEnter teacher email:");
- // t.Email = Console.ReadLine();
- // Console.Write("\nEnter teacher subject taught:");
- // t.SubjectTaught = Console.ReadLine();
- // Console.Write("\nEnter salary:");
- // t.Salary = Convert.ToDecimal(Console.ReadLine());
- // teacherList.Add(t);
- // Console.WriteLine("\nStudent added successfully");
- // ShowAllTeachers();
- //}//end of AddStudent()
- ////*******method to Find teacher record********
- //static void FindTeacher()
- //{
- // Console.Write("\nEnter teacher's full name: ");
- // string teacherName = Console.ReadLine();
- // foreach (Teacher teacher in teacherList)
- // {
- // if (teacher.Name == teacherName)
- // {
- // Console.WriteLine("\nTeacher with name {0} found\n The details are as follows:", teacherName);
- // Console.WriteLine("\n**************************");
- // Console.WriteLine(teacher);
- // Console.WriteLine("**************************");
- // }
- // else
- // {
- // Console.WriteLine("\nTeacher with name {0} not found", teacherName);
- // }
- // }
- //}//end of method Find Teacher()
- ////*******method to Remove teacher record********
- //static void RemoveTeacher()
- //{
- // Console.Write("\nEnter teacher name: ");
- // string teacherName = Console.ReadLine();
- // for (int i = 0; i < teacherList.Count; i++)
- // {
- // if (teacherList[i].Name==teacherName)
- // {
- // teacherList.Remove(teacherList[i]);
- // Console.WriteLine("\nTeacher removed successfully");
- // }//end of if
- // else
- // {
- // Console.WriteLine("\nError! Teacher record with name {0} not found in the list", teacherName);
- // }//end of else
- // }//end of for
- //}//end of RemoveTeacher()
- ////*******method to Show all student records********
- //static void ShowAllTeachers()
- //{
- // foreach (Teacher teacher in teacherList)
- // {
- // Console.WriteLine("\n**************************");
- // Console.WriteLine(teacher);
- // Console.WriteLine("**************************");
- // }//foreach
- //}//end of ShowAll*/
- /* }//end of class College
- }//end of namespace
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement