コード例 #1
0
def al():
    print(listGenrator.addLesList())
    order = str(input("             Your username:"******"addLesson.csv", 'r') as csvFile:
                    reader = csv.DictReader(csvFile)
                    for row in reader:
                        data = dict(row)

                        if data['lesson'] != words[0]:
                            odd.append(data)

                with open('addLesson.csv', 'w') as csvFile:
                    fields = ['lesson', 'tea', 'condition']
                    writer = csv.DictWriter(csvFile, fieldnames=fields)
                    writer.writeheader()
                    writer.writerows(odd)

                break
            x += 1

    elif words[1] == 'd' or words[1] == 'D':
        odd = []
        newCon = {'condition': 'D'}
        with open("addLesson.csv", 'r') as csvFile:
            reader = csv.DictReader(csvFile)
            for row in reader:
                data = dict(row)

                if data['lesson'] == words[0]:
                    data.update(newCon)
                odd.append(data)

        with open('addLesson.csv', 'w') as csvFile:
            fields = ['lesson', 'tea', 'condition']
            writer = csv.DictWriter(csvFile, fieldnames=fields)
            writer.writeheader()
            writer.writerows(odd)
    else:
        print(error.errorsList("003"))

    return ''
コード例 #2
0
def loginChecker(user, passcode):
    if loginAdmin(user, passcode) == 1:
        adminPage.show('a', user)
    elif loginStu(user, passcode) == 1:
        stuPage.show('s', user)
    elif loginTea(user, passcode) == 1:
        teaPage.show('t', user)
    else:
        print(error.errorsList("003"))
コード例 #3
0
    print('\t' + "╔" + "═" * 62 + "╗")
    print('\t' + "║" + " " * 62 + "║")
    print('\t' + "║" + " " * 24 + "GoodUniversity" + " " * 24 + "║")
    print('\t' + "║" + " " * 62 + "║")
    print('\t' + "╠" + "═" * 62 + "╣")
    print('\t' + "║" + " " * 2 + listGenrator.lenFit(str(getTime.persianDate() + " | " + getTime.time()), 60) + "║")
    print('\t' + "╠" + "═" * 62 + "╣")
    print('\t' + "║" + "  Please choose from the menu:" + " " * 32 + "║")
    print('\t' + "║" + " " * 62 + "║")
    print('\t' + "║" + "    L : Login" + " " * 49 + "║")
    print('\t' + "║" + "    R : Register" + " " * 46 + "║")
    print('\t' + "║" + "    E : Exit" + " " * 50 + "║")
    print('\t' + "║" + " " * 62 + "║")
    print('\t' + "╚" + "═" * 62 + "╝")

    request = str(input("             Your request:"))
    if request == 'R' or request == 'r':
        typeof = str(input("             Your type:"))
        username = str(input("             Your username:"******"             Your password:"******"             Username:"******"             Password:"******"005"))
コード例 #4
0
def show(typeofUser, user):
    order = '*'
    while True:
        #Last Login
        newLastLogin = getTime.persianDate()
        odd = []
        newLast = {'lastLogin': newLastLogin}
        with open("admins.csv", 'r') as csvFile:
            reader = csv.DictReader(csvFile)
            for row in reader:
                data = dict(row)

                if data['username'] == user:
                    data.update(newLast)
                odd.append(data)

        with open('admins.csv', 'w') as csvFile:
            fields = ['username', 'pass', 'lastLogin', 'name']
            writer = csv.DictWriter(csvFile, fieldnames=fields)
            writer.writeheader()
            writer.writerows(odd)
        # End of Last Login
        os.system('cls' if os.name == 'nt' else 'clear')
        print('\n')
        print('\t' + "╔" + "═" * 62 + "╗")
        print('\t' + "║" + " " * 62 + "║")
        print('\t' + "║" + " " * 24 + "Welcome Admin" + " " * 25 + "║")
        print('\t' + "║" + " " * 62 + "║")
        print('\t' + "╠" + "═" * 62 + "╣")
        print('\t' + "║" + listGenrator.lenFit(
            str("  " + getTime.persianDate() + " | " + getTime.time()), 39) +
              listGenrator.lenFit(
                  str("Last Login: "******" ║")
        print('\t' + "╠" + "═" * 62 + "╣")
        print('\t' + "║" + "  Please choose from the menu:" + " " * 32 + "║")
        print('\t' + "║" + " " * 62 + "║")
        print('\t' + "║" + listGenrator.lenFit('    T: Teachers List', 62) +
              "║")
        print('\t' + "║" + listGenrator.lenFit('    S: Students List', 62) +
              "║")
        print('\t' + "║" + listGenrator.lenFit('    L: Lessons List', 62) +
              "║")
        print('\t' + "║" + listGenrator.lenFit('    AU: Add User', 62) + "║")
        print('\t' + "║" + listGenrator.lenFit('    AL: Add Lesson', 62) + "║")
        print('\t' + "║" + listGenrator.lenFit('    ED: Edit', 62) + "║")
        print('\t' + "║" + listGenrator.lenFit('    EP: Edit Password', 62) +
              "║")
        print('\t' + "║" + listGenrator.lenFit('    E: Exit', 62) + "║")
        print('\t' + "║" + " " * 62 + "║")
        print('\t' + "╚" + "═" * 62 + "╝")

        request = str(input("             Your request:"))
        if request == 'T' or request == 't':
            print(listGenrator.teaList())
            order = str(input("             Enter code:"))
        elif request == 'S' or request == 's':
            print(listGenrator.stuList())
            order = str(input("             Enter code:"))
        elif request == 'L' or request == 'l':
            print(listGenrator.lessonList())
            order = str(input("             Enter code:"))
        elif request == 'AU' or request == 'au':
            admin.au()
        elif request == 'AL' or request == 'al':
            admin.al()
        elif request == 'ED' or request == 'ed':
            admin.e(user)
        elif request == 'EP' or request == 'ep':
            admin.ep(user)
        elif request == 'E' or request == 'e':
            break
        else:
            print(error.errorsList("005"))

        if order == 'B' or order == 'b':
            continue

        order = '*'
コード例 #5
0
def au():
    print(listGenrator.addUserList())
    order = str(input("             Your username:"******"003"))

                odd = []
                with open("addUser.csv", 'r') as csvFile:
                    reader = csv.DictReader(csvFile)
                    for row in reader:
                        data = dict(row)

                        if data['user'] != words[0]:
                            odd.append(data)

                with open('addUser.csv', 'w') as csvFile:
                    fields = ['type', 'user', 'pass', 'condition']
                    writer = csv.DictWriter(csvFile, fieldnames=fields)
                    writer.writeheader()
                    writer.writerows(odd)

                break
            x += 1

        # odd = []
        # newCon = {'condition': 'A'}
        # with open("addUser.csv", 'r') as csvFile:
        #     reader = csv.DictReader(csvFile)
        #     for row in reader:
        #         data = dict(row)
        #
        #         if data['user'] == words[0]:
        #             data.update(newCon)
        #         odd.append(data)
        #
        # with open('addUser.csv', 'w') as csvFile:
        #     fields = ['type', 'user', 'pass', 'condition']
        #     writer = csv.DictWriter(csvFile, fieldnames=fields)
        #     writer.writeheader()
        #     writer.writerows(odd)

    elif words[1] == 'd' or words[1] == 'D':
        odd = []
        newCon = {'condition': 'D'}
        with open("addUser.csv", 'r') as csvFile:
            reader = csv.DictReader(csvFile)
            for row in reader:
                data = dict(row)

                if data['user'] == words[0]:
                    data.update(newCon)
                odd.append(data)

        with open('addUser.csv', 'w') as csvFile:
            fields = ['type', 'user', 'pass', 'condition']
            writer = csv.DictWriter(csvFile, fieldnames=fields)
            writer.writeheader()
            writer.writerows(odd)
    else:
        print(error.errorsList("003"))

    return ''
コード例 #6
0
def show(typeofUser, user):
    order = '*'
    while True:
        newLastLogin = getTime.persianDate()
        odd = []
        newLast = {'lastLogin': newLastLogin}
        with open("students.csv", 'r') as csvFile:
            reader = csv.DictReader(csvFile)
            for row in reader:
                data = dict(row)

                if data['username'] == user:
                    data.update(newLast)
                odd.append(data)

        with open('students.csv', 'w') as csvFile:
            fields = ['username', 'pass', 'lastLogin', 'name']
            writer = csv.DictWriter(csvFile, fieldnames=fields)
            writer.writeheader()
            writer.writerows(odd)
        os.system('cls' if os.name == 'nt' else 'clear')
        print('\n')
        print('\t' + "╔" + "═" * 62 + "╗")
        print('\t' + "║" + " " * 62 + "║")
        print('\t' + "║" + " " * 24 + "Welcome Admin" + " " * 25 + "║")
        print('\t' + "║" + " " * 62 + "║")
        print('\t' + "╠" + "═" * 62 + "╣")
        print(
            '\t' + "║" + listGenrator.lenFit(str("  " + getTime.persianDate() + " | " + getTime.time()),
                                             39) + listGenrator.lenFit(str("Last Login: "******" ║")
        print('\t' + "╠" + "═" * 62 + "╣")
        print('\t' + "║" + "  Please choose from the menu:" + " " * 32 + "║")
        print('\t' + "║" + " " * 62 + "║")
        print('\t' + "║" + listGenrator.lenFit('    L: Lessons', 62) + "║")
        print('\t' + "║" + listGenrator.lenFit('    LP: Pick Lessons', 62) + "║")
        print('\t' + "║" + listGenrator.lenFit('    ED: Edit', 62) + "║")
        print('\t' + "║" + listGenrator.lenFit('    EP: Edit Password', 62) + "║")
        print('\t' + "║" + listGenrator.lenFit('    E: Exit', 62) + "║")
        print('\t' + "║" + " " * 62 + "║")
        print('\t' + "╚" + "═" * 62 + "╝")

        request = str(input("             Your request:"))
        if request == 'L' or request == 'l':
            print(listGenrator.lesListStu(database.stuSearch(user)))
            order = str(input("             Enter code:"))
        elif request == 'LP' or request == 'lp':
            stu.lp(user)
        elif request == 'P' or request == 'p':
            return
        elif request == 'ED' or request == 'ed':
            stu.e(user)
        elif request == 'EP' or request == 'ep':
            stu.ep(user)
        elif request == 'E' or request == 'e':
            break
        else:
            print(error.errorsList("005"))

        if order == 'B' or order == 'b':
            continue

        order = '*'