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')
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})
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')
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)
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')
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())