Example #1
0
def deleteScheduleAction(request):

    username = request.GET['username']
    date = request.GET['date']

    db = ScheduleDBServices()
    db.open()
    db.delete(username, date)
    db.close()

    return render(request, 'ScheduleManager.html')
Example #2
0
def viewSchedule(request):

    #gets the schedule from the Schedules.db sends the records to the ViewSchedule page.
    db = ScheduleDBServices()
    db.open()
    l = db.get(EMPLOYEE_DATA.getUsername())
    EMPLOYEE_DATA.fillList(l)
    db.close()

    return render(request, 'ViewSchedule.html', {'list': l})
Example #3
0
def insertScheduleAction(request):

    schedule = Schedule()

    schedule.setUsername(request.GET['username'])
    schedule.setDay(request.GET['day'])
    schedule.setMonth(request.GET['month'])
    schedule.setTime(request.GET['time'])
    schedule.setDate(request.GET['date'])
    schedule.setId(request.GET['id'])

    db = ScheduleDBServices()
    db.open()
    db.insert(schedule, schedule.getUsername())
    db.close()

    return render(request, 'ScheduleManager.html')
Example #4
0
    def test_connect_to_schedule_database(self):
        dbservices = ScheduleDBServices()
        connected = False
        try:
            dbservices.openConnection()
            connected = True
        except Exception as ex:
            connected = False

        dbservices.close()

        self.assertTrue(connected)
Example #5
0
def sendEmailAction(request):
    username = request.GET['username']
    db = ScheduleDBServices()
    db.open()
    l = db.get(username)
    db.close()

    listStr = ""
    for i in l:
        listStr += str(i.getId()) + "\t"
        listStr += str(i.getDate()) + "\t"
        listStr += str(i.getDay()) + "\t"
        listStr += str(i.getTime()) + "\t"
        listStr += str(i.getMonth()) + "\n"

    email = SendEmail()
    email.sendEmail("*****@*****.**", listStr)

    return render(request, 'ManagerLogin.html')
Example #6
0
    def test_schedule_delete(self):
        dbservices = ScheduleDBServices()
        dbservices.openConnection()
        dbservices.createEmpSchedules()
        dbservices.insert(sch, "testuser")
        dbservices.delete("testuser", sch)

        newSch = dbservices.get("testuser")
        self.assertIsNull(newSch.getId())