Esempio n. 1
0
 def clockin(self, name, studentid, room):
     """
     Clocks a student into a room, calls checkroom, to check the room, and checks inputs
     for student id and name. All inputs must come back valid to proceed.
     Gathers time and date
     :param name: Name of Student to Clock in
     :param studentid: Id of student that needs to clock in
     :param room: Room of Student to clockin
     :return:
     """
     booleanreturn, stringreturn = self.validinput(name, studentid)
     if booleanreturn is True:  # Room and inputs OK
         if room == 0:
             self.controller.sysprint("ERROR! Room 0!")
             mypopup = Popups("ERROR!", "Bad Input Choose  room!")
             mypopup.mainloop()
         else:
             clockindate = str(datetime.now().date())  # format: 2015-12-31
             clockintime = str(datetime.now().time().hour) + ":" + str(datetime.now().time().minute)
             mystudentlogin = Student(studentid, name, clockindate, room, clockintime)  # no clockin as None
             mydatabaseinterface = DataBaseInterface()  # default file location
             mydatabaseinterface.clockin(mystudentlogin)
             self.clearinputs()
             self.controller.sysprint(">DEBUG: Clockedin Student")
             mypopup = Popups("Clock In", "Clocked in " + str(name) + " at " + str(clockintime))
             mypopup.mainloop()
             self.controller.updateflag = True  # dangerous is it not?
             self.changeframe("PrimaryPage")
     else:
         self.controller.sysprint(">ERROR! Bad Input: " + stringreturn)
         mypopup = Popups("Error!", "Bad Input " + stringreturn)
         mypopup.mainloop()
Esempio n. 2
0
 def clockout(self, buttonnumber):
     """
     Reads the Contents of the choosen info, IE Button1 = info1
     Change the Student Clockout time from None to time right now
     :param buttonnumber: 1-5 number
     :return:
     """
     self.clockoutinforows[buttonnumber].stringvar.set("-------------------------")  # clears out
     clockouttime = str(datetime.now().time().hour) + ":" + str(datetime.now().time().minute)
     try:
         self.mystudentcollection.listofstudents[buttonnumber].clockouttime = clockouttime
         self.controller.sysprint(">DEBUG: ClockoutMethod trying.." +
                                  str(self.mystudentcollection.listofstudents[buttonnumber].name) +
                                  " at " + clockouttime)
         self.mydatabaseinterface.clockout(self.mystudentcollection.listofstudents[buttonnumber])
         logoutstring = ("Logout of " + str(self.mystudentcollection.listofstudents[buttonnumber].name) + " At " +
                         clockouttime)
         self.controller.updateflag = True  # dangerous is it not?
         self.changeframe("PrimaryPage")
         mypopup = Popups("Logout Successful", logoutstring, "Ok")
         mypopup.mainloop()
     except:  # meh to broad?
         self.controller.sysprint(">ERROR!: Bad Clockout")
         pass