Example #1
0
 def student_view(self, user_info):
     '''
      学生模块:注册
     '''
     menu = '''
     选择操作内容<按q退出系统>:
     1. 注册<重复>
     2. 交学费
     3. 换班
     '''
     while True:
         print("欢迎:", Tools.pr_color(user_info["name"]), "学员")
         print(menu)
         choice = input(">> ")
         if choice == '1':
             print("开始后注册了")
         elif choice == '2':
             print("交学费?不肯能,这辈子都不可能交学费!")
         elif choice == '3':
             print("报了名还想换班?不可能的")
             self.w.pr_grade_bystudentId(user_info["id"])
         elif choice == 'q':
             self.w.save_data()
             print("byebye!!!")
             exit(0)
         else:
             print("您的输入有误!")
Example #2
0
    def teacher_view(self, user_info):
        '''
            1.查看班级信息
            2.查看学生信息(先班级后学生)
        '''
        menu = '''
           选择操作内容<按q退出系统>:
           1. 查看班级信息
           2. 查看学生信息

           '''
        print("欢迎:", Tools.pr_color(user_info["name"]), "老师")
        while True:
            print(menu)
            choice = input(">> ")
            if choice == '1':
                self.w.pr_grade_byteacherId(user_info["id"])
            elif choice == '2':
                self.w.pr_student_byteacherId(user_info["id"])
Example #3
0
 def pr_school(self):
     school_list = self.db.get_school_All()
     for index, school in enumerate(school_list):
         print(Tools.pr_color(str(index)), school)
Example #4
0
 def pr_all(self):
     for item, item_list in self.db.data.items():
         print(Tools.pr_color(item, color=34), ":")
         for obj in item_list:
             print(obj)
         print("=" * 50)
Example #5
0
 def pr_student_bygradeId(self, grade_id):
     student_list = self.db.get_student_by_userId(grade_id)
     for index, student in enumerate(student_list):
         print(Tools.pr_color(str(index)), student_list)
Example #6
0
 def pr_grade_bystudentId(self, student_id):
     grade_id = self.db.get_grade_bystudentId(student_id)
     grade = self.db.get_grade_bygradeId(grade_id)
     print(Tools.pr_color(str(grade), color=34))
Example #7
0
 def pr_grade_byteacherId(self, teacher_id):
     grade_list = self.db.get_grades_byteacherId(teacher_id)
     for index, grade in enumerate(grade_list):
         print(Tools.pr_color(str(index)), grade)
Example #8
0
 def pr_grade_byschoolId(self, school_id):
     grade_list = self.db.get_grades_byschoolId(school_id)
     for index, grade in enumerate(grade_list):
         print(Tools.pr_color(str(index)), grade)
Example #9
0
 def pr_course_byschoolId(self, school_id):
     course_list = self.db.get_courses_byschoolId(school_id)
     for index, course in enumerate(course_list):
         print(Tools.pr_color(str(index)), course)
Example #10
0
 def pr_teachers_byschoolId(self, school_id):
     teacher_list = self.db.get_teachers_byschoolId(school_id)
     for index, teacher in enumerate(teacher_list):
         print(Tools.pr_color(str(index)), teacher)
Example #11
0
    def manager_view(self, user_info):
        '''
         创建学校,讲师,课程,班级
        '''
        menu = '''
        选择操作内容<按q退出系统>:
        1. 创建学校
        2. 创建课程
        3. 创建老师
        4. 创建班级
        '''
        print("欢迎:", Tools.pr_color(user_info["name"]))
        while True:
            print(menu)
            choice = input(">> ")
            if choice == '1':
                print("开始创建学校=========")
                name = input("请输入学校>>")
                addr = input("请输入地址>>")
                self.w.create_school(name, addr)
            elif choice == '2':
                print("开始创建课程=========")
                self.w.pr_school()
                school_seqid = int(input("请选择学校(输入序列号)>>"))
                school_id = self.w.get_schoolId_by_squenceid(school_seqid)
                name = input("请输入课程名>>")
                price = input("请输入课程价格>>")
                period = input("请输入课程学时>>")

                self.w.create_course(name, price, period, school_id)
            elif choice == '3':
                print("开始创建老师=========")
                self.w.pr_school()
                school_seqid = int(input("请选择学校(输入序列号)>>"))
                school_id = self.w.get_schoolId_by_squenceid(school_seqid)
                user_id = input("用户名>")
                user_pwd = input("密码>")
                name = input("老师名称>>")
                age = input("老师年龄>>")
                salary = input("薪资>>")
                self.w.create_teacher(user_id, user_pwd, school_id, name, age,
                                      salary)
            elif choice == '4':
                print("开始创建班级=========")
                self.w.pr_school()
                school_seqid = int(input("请选择学校(输入序列号)>>"))
                school_id = self.w.get_schoolId_by_squenceid(school_seqid)
                self.w.pr_teachers_byschoolId(school_id)
                teacher_seqid = int(input("请选择代课老师>>"))
                teacher_id = self.w.get_teacherId_by_squenceid(teacher_seqid)
                self.w.pr_course_byschoolId(school_id)
                course_seqid = int(input("请选择课程:>>"))
                course_id = self.w.get_courseId_by_squenceid(course_seqid)
                name = input("班级名称>>")
                start_time = input("开班日期>>")
                self.w.create_grade(name, start_time, teacher_id, course_id,
                                    school_id)
            elif choice == 'q':
                self.w.save_data()
                self.w.pr_all()
                print("byebye!!!")
                exit(0)
            else:
                print("您的输入有误!")