示例#1
0
        public void Lessons(List <MainStudent> students, MainStudent student, int order = 0)
        {
            Menu menu = new Menu();

            foreach (Lesson lesson in student.Lessons)
            {
                Console.WriteLine(" Name : {0} | Code : {1} | Unit : {2} | Score : {3}",
                                  lesson.Name, lesson.Code, lesson.Unit, lesson.Score);
            }
            switch (order)
            {
            case 0:
                break;

            case 1:
                AddLesson(student.Lessons);
                break;

            case 2:
                Console.WriteLine("Please Enter Lesson Code:");
                int    code   = int.Parse(Console.ReadLine());
                Lesson lesson = student.Lessons.Find(x => x.Code == code);
                EditLesson(student.Lessons, lesson);
                break;

            default:
                Console.WriteLine("\n!!!please choose from the items!!!");
                Console.ReadKey();
                break;
            }
            menu.Lessons();
            order = int.Parse(Console.ReadLine());
            Console.Clear();
            Lessons(students, student, order);
        }
        /// <summary>
        /// Hàm thay đổi màn hình
        /// </summary>
        /// <param name="screenID">ID của màn hình</param>
        public static void ChangeScreen(ScreenID screenID)
        {
            //Nếu màn hình muốn thay đổi chính là màn hình hiện tại thỉ bỏ qua
            if (GetCurrentScreen() == screenID)
            {
                return;
            }

            //Lấy ra tên của màn hình
            string screenName = GetScreenName(screenID);

            //Lấy ra handle của màn hình
            UserControl userControl = GetIntanceScreen(screenID);

            //Lấy ra form main hiện hành
            MainStudent mainStudent = Program.MainForm as MainStudent;

            if (mainStudent != null)
            {
                //Thay đổi màn hình
                mainStudent.ChangeControlOfPanel(userControl);

                //Thông báo đến cho các màn hình khác là có sự thay đổi màn hình
                SendInternalEvent(new GuiEventID()
                {
                    ID = GuiEventID.EventID.ChangeScreen
                }, screenName);
            }
        }
示例#3
0
        public void ShowList(List <MainStudent> students, int action = 0)
        {
            Menu menu = new Menu();

            if (action != 1)
            {
                foreach (MainStudent st in students.OrderBy(p => p.Number))
                {
                    Console.WriteLine("ID : {0} | FullName : {1} | Study : {2} | Level : {3} | Lessons : {4} | Scores : {5} | Average : {6}",
                                      st.Number, st.Name, st.Study, st.Level, st.Lessons.Count, st.Scores, st.Average);
                }
            }
            switch (action)
            {
            case 0:
                break;

            case 1:
                Console.Clear();
                Sort(students);
                break;

            case 2:
                Add(students);
                break;

            case 3:
                Console.WriteLine("Please Enter Student ID:");
                UInt64      id      = UInt64.Parse(Console.ReadLine());
                MainStudent student = students.Find(x => x.Number == id);
                Edit(students, student);
                break;

            case 4:
                Delete(students);
                break;

            case 5:
                Console.Clear();
                Show(students);
                break;

            default:
                Console.WriteLine("\n!!!please choose from the items!!!");
                Console.ReadKey();
                break;
            }
            menu.Student();
            action = int.Parse(Console.ReadLine());
            Console.Clear();
            ShowList(students, action);
        }
示例#4
0
        public void Show(List <MainStudent> students)
        {
            Console.WriteLine("Please Enter Student ID:");
            UInt64      id      = UInt64.Parse(Console.ReadLine());
            MainStudent student = students.Find(x => x.Number == id);

            Console.WriteLine("Student Info:\n ID : {0} \n FullName : {1} \n Study : {2} \n Level : {3} \n Lessons : {4} \n Scores : {5} \n Average : {6}",
                              student.Number, student.Name, student.Study, student.Level, student.Lessons.Count, student.Scores, student.Average);
            Console.WriteLine("Student Lessons:");
            foreach (Lesson lesson in student.Lessons)
            {
                Console.WriteLine(" Name : {0} | Code : {1} | Unit : {2} | Score : {3}",
                                  lesson.Name, lesson.Code, lesson.Unit, lesson.Score);
            }
        }
示例#5
0
        public void Add(List <MainStudent> students)
        {
            MainStudent student = new MainStudent();

            Console.WriteLine("Please Enter Student ID:");
            student.Number = UInt64.Parse(Console.ReadLine());
            Console.WriteLine("Please Enter Student Full Name:");
            student.Name = Console.ReadLine();
            Console.WriteLine("Please Enter Student Study:");
            student.Study = Console.ReadLine();
            Console.WriteLine("Please Enter Student Level:");
            student.Level = Console.ReadLine();
            students.Add(student);
            Console.WriteLine("Student Added");
            Console.ReadKey();
        }
示例#6
0
        private void OnDangNhapClick(object sender, EventArgs e)
        {
            tkAttribute.TenDangNhap = _txtTenDangNhap.Text.Trim();
            tkAttribute.MatKhau     = _txtMatKhau.Text.Trim();

            if (_txtTenDangNhap.Text != string.Empty || _txtMatKhau.Text != string.Empty)
            {
                if (_isFirstRun)
                {
                    _isFirstRun = false;
                    Thread thread = new Thread(InitDatabase);
                    thread.Start();
                }
                if (dnController.GetTaiKhoan(tkAttribute).Rows.Count != 0)
                {
                    MainStudent.quyen    = dnController.GetQuyen(tkAttribute).Rows[0][0].ToString();
                    MainStudent.pass     = dnController.GetTaiKhoan(tkAttribute).Rows[0][1].ToString();
                    MainStudent.taiKhoan = dnController.GetTaiKhoan(tkAttribute).Rows[0][0].ToString();

                    if (MainStudent.quyen == "SV")
                    {
                        MainStudent.userName = dnController.GetUserNameSinhVien(tkAttribute).Rows[0][0].ToString();
                    }
                    if (MainStudent.quyen == "GV")
                    {
                        MainStudent.userName = dnController.GetUserNameGiaoVien(tkAttribute).Rows[0][0].ToString();
                    }
                    if (MainStudent.quyen == "admin")
                    {
                        MainStudent.userName = dnController.GetTaiKhoan(tkAttribute).Rows[0][0].ToString();
                    }
                    MainStudent mainStudent = new MainStudent();
                    mainStudent.Show();
                    this.Hide();
                }
                else
                {
                    MessageDialog messageDialog = new MessageDialog(@"Bạn nhập sai thông tin tài khoản!", MessageDialog.DialogType.Ok);
                    messageDialog.ShowDialog();
                }
            }
            else
            {
                MessageDialog messageDialog = new MessageDialog(@"Bạn chưa nhập thông tin đăng nhập!", MessageDialog.DialogType.Ok);
                messageDialog.ShowDialog();
            }
        }
示例#7
0
        public void Edit(List <MainStudent> students, MainStudent student, int order = 0)
        {
            Menu menu = new Menu();

            switch (order)
            {
            case 0:
                break;

            case 1:
                Console.WriteLine("Please Enter Student ID:");
                student.Number = UInt64.Parse(Console.ReadLine());
                break;

            case 2:
                Console.WriteLine("Please Enter Student Full Name:");
                student.Name = Console.ReadLine();
                break;

            case 3:
                Console.WriteLine("Please Enter Student Study:");
                student.Study = Console.ReadLine();
                break;

            case 4:
                Console.WriteLine("Please Enter Student Level:");
                student.Level = Console.ReadLine();
                break;

            case 5:
                Lessons(students, student);
                break;

            default:
                Console.WriteLine("\n!!!please choose from the items!!!");
                Console.ReadKey();
                break;
            }
            menu.EditStudent();
            order = int.Parse(Console.ReadLine());
            Console.Clear();
            Edit(students, student, order);
        }
        public static MainStudent GetMainStuden()
        {
            MainStudent mainStudent = Program.MainForm as MainStudent;

            return(mainStudent);
        }