//runs the payment history
        private static void RunPaymentHistory()
        {
            long student_id;

            if (_studentViewer == null)
            {
                _studentViewer = new StudentViewer();
            }
            if (_paymentHistoryViewer == null)
            {
                _paymentHistoryViewer = new PaymentHistoryViewer();
            }

            IList <StudentViewModel> student;


            WriteHeader();

            Console.WriteLine("Enter student ID: ");
            string str_student_id = (Console.ReadLine());

            student_id = Convert.ToInt64(str_student_id);


            //display student name and ask for confirmation

            string student_name = _studentViewer.GetStudent(student_id);

            Console.WriteLine("Student name: {0}", student_name);

            CommandPrompt("Is this correct? (Y/N)");
            string str_response = Console.ReadLine();

            if (str_response.ToLower() == "y")
            {
                IList <PaymentViewModel> histories = _paymentHistoryViewer.GetPaymentHistory(student_id);

                //display payment history


                Console.Clear();
                Console.WriteLine("Payment History for " + student_name);
                Console.WriteLine("###############################################################################################");
                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine();

                //get data
                Console.WriteLine("{0,-30} {1,9}", "Payment Date", "Payment Amount");
                foreach (PaymentViewModel history in histories)
                {
                    PrintOutSummaryLine(history);
                }
                Console.WriteLine("Press any key...");
                Console.ReadKey();
                return;
            }
            //}
        }
Exemple #2
0
        //runs the payment history
        private static void RunPaymentHistory()
        {
            long student_id;

            if (_studentViewer == null)
            {
                _studentViewer = new StudentViewer();
            }
            if (_paymentHistoryViewer == null)
            {
                _paymentHistoryViewer = new PaymentHistoryViewer();
            }

            IList <StudentViewModel> student;

            //IList<PaymentHistoryViewModel> history;

            WriteHeader();

            Console.WriteLine("Enter student ID: ");
            string str_student_id = (Console.ReadLine());

            //validate student ID
            if (!Int64.TryParse(str_student_id, out student_id) || !student.Contains(student_id))
            {
                Console.WriteLine("Invalid student ID.  Press any key...");
                Console.ReadKey();
                return;
            }
            else
            {
                //display student name and ask for confirmation
                student = _studentViewer.GetStudent(student_id);
                Console.WriteLine("Student name: {0} {1}", student.first_name, student.last_name);

                CommandPrompt("Is this correct? (Y/N)");
                string str_response = Console.ReadLine();
                if (str_response.ToLower() == "y")
                {
                    IList <PaymentViewModel> histories = _paymentHistoryViewer.GetPaymentHistory(student_id);

                    //display payment history
                    //history = _paymentHistoryViewer.GetPaymentHistory(student_id);

                    Console.Clear();
                    Console.WriteLine("Payment History for " + student.first_name + student.last_name);
                    Console.WriteLine("###############################################################################################");
                    Console.WriteLine();
                    Console.WriteLine();
                    Console.WriteLine();

                    //get data
                    Console.WriteLine("{0,-30} {1,9}", "Payment Date", "Payment Amount");
                    //TODO
                    foreach (PaymentViewModel history in histories)
                    {
                        PrintOutSummaryLine(history);
                    }
                }
            }
        }