Esempio n. 1
0
 public Student(int admNo)
 {
     this.db          = new database();
     this.admNo       = admNo;
     this.name        = db.getStudent(admNo.ToString(), "Name");
     this.payments    = new Payments(admNo);
     this.yearofstudy = int.Parse(db.getStudent(admNo.ToString(), "Year"));
 }
Esempio n. 2
0
 public Courses(String Name, int id, double Cost)
 {
     db        = new database();
     this.Name = Name;
     this.id   = id;
     this.Cost = Cost;
     db.addCourse(id, Name, Cost);
 }
Esempio n. 3
0
 public Student(int admNo, String name, int yearofstudy)
 {
     this.name        = name;
     this.admNo       = admNo;
     this.payments    = new Payments(admNo);
     this.yearofstudy = yearofstudy;
     this.db          = new database();
     db.addStudent(admNo, name, yearofstudy);
 }
Esempio n. 4
0
        static void ManageCourses()
        {
Options:
            Console.WriteLine("Please Choose an Option\n1. Add Course\n2. Change Cost\n3. View Courses\n4. Exit");
            database db     = new database();
            int      choice = int.Parse(Console.ReadLine());

            switch (choice)
            {
            case 1:
                int code = db.getNewCode();
                Console.WriteLine("Course code is " + code);
                Console.WriteLine("Course Name: ");
                String Name = Console.ReadLine();
                Console.WriteLine("Course Cost: ");
                double  Cost   = double.Parse(Console.ReadLine());
                Courses course = new Courses(Name, code, Cost);
                break;

            case 2:
                Console.WriteLine("Please Choose a Course");
                Dictionary <int, Courses> coses = db.getCourses();
                foreach (KeyValuePair <int, Courses> cos in coses)
                {
                    Console.WriteLine(cos.Key + ". " + cos.Value.getName() + " Cost: " + cos.Value.getCost());
                }
                choice = int.Parse(Console.ReadLine());
                Courses cs = new Courses(choice);
                Console.WriteLine("New Amount: ");
                double newamt = double.Parse(Console.ReadLine());
                db.updatecost(cs, newamt);
                Console.WriteLine("Course Updated");
                break;

            case 3:
                Console.WriteLine("Here is a list of the courses.");
                Dictionary <int, Courses> Courses = db.getCourses();
                foreach (KeyValuePair <int, Courses> cos in Courses)
                {
                    Console.WriteLine(cos.Key + ". " + cos.Value.getName() + " Cost: " + cos.Value.getCost());
                }
                Console.ReadLine();
                break;

            default:
                goto Exits;
            }

            Console.WriteLine("Press any key to continue");
            Console.ReadLine();
            goto Options;


Exits:
            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }
Esempio n. 5
0
        static void ManageOperations(Student stud)
        {
            vdcoursechooser           cschoice = new vdcoursechooser(CourseChooser);
            String                    temp;
            database                  db = new database();
            int                       choice;
            Dictionary <int, Courses> Courses = db.getCourses();

Options:
            Console.Write("Please Choose an Option\n1. Register Course\n2. Pay For Courses\n3. View Courses\n4. View Admission Details\n5. Check if eligible For Library Access \n6. Check if eligible for exams\n7. Exit\nAnswer:");
            temp   = Console.ReadLine();
            choice = int.Parse(temp);
            //evaluate chosen option
            switch (choice)
            {
            case 1:
                int choice1;
                // Choose A Course to register
                Console.WriteLine("Choose Course:\n");
                foreach (KeyValuePair <int, Courses> cos in Courses)
                {
                    Console.WriteLine(cos.Key + ". " + cos.Value.getName() + " Cost: " + cos.Value.getCost());
                }
                temp    = Console.ReadLine();
                choice1 = int.Parse(temp);
                //Register course and bill student
                cschoice(Courses[choice1], ref stud);
                break;

            case 2:
                int choice2;
                Dictionary <int, Courses> UPCourses = stud.payments.getUnpaid();
                if (UPCourses.Count() == 0)
                {
                    Console.WriteLine("There are none:\n");
                    break;
                }
                Console.WriteLine("Choose Course:\n");
                //get all unpaid courses
                foreach (KeyValuePair <int, Courses> i in UPCourses)
                {
                    Console.Write(i.Key + ". " + i.Value.getName() + " - Cost: " + i.Value.getCost() + "\n");
                }
                Console.Write("Answer:");
                temp    = (String)Console.ReadLine();
                choice2 = int.Parse(temp);

                //pay for the unpaid course
                Courses thecourse = UPCourses[choice2];

                stud.payments.pay(thecourse);
                Console.WriteLine(thecourse.getName() + " has now been paid for, remaining balance is " + stud.payments.getTotal());


                break;

            case 3:
                //get all courses, grouped by those paid for and those not paid for
                Console.Write(stud.listCourses());
                break;

            case 4:
                //Show all student details
                Console.WriteLine("Student Name: " + stud.getName());
                Console.WriteLine("Student Admisson Number : " + stud.getAdmNo());
                Console.WriteLine("Year of Study: " + stud.getYear());
                Console.WriteLine("Balance: " + stud.payments.getTotal());
                break;

            case 5:
                if (stud.payments.getTotal() > 0)
                {
                    Console.WriteLine("Cannot Access Library, Pending Fees");
                }
                else
                {
                    Console.WriteLine("Can Access Library,No pending Fees");
                }
                break;

            case 6:
                if (stud.payments.getTotal() > 0)
                {
                    Console.WriteLine("Pending Fees, Advise " + stud.getName() + " clear all balance before sitting for exams");
                }
                else
                {
                    Console.WriteLine("Student is eligible for exams");
                }
                break;

            default:
                goto Exits;
            }

            Console.WriteLine("Press any key to continue");
            Console.ReadLine();
            goto Options;


Exits:
            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }
Esempio n. 6
0
 //intialise list of paid and unpaid courses
 public Payments(int admNo)
 {
     this.admNo = admNo;
     db         = new database();
 }