def select_item(self): # Recupera un sólo item id = (self.select_byid.get(),) employee = EmpleadoDao.recuperar(id) # Insertamos en los inputs un valor por default self.employee_name.insert(END, employee.get_nombre_empleado()) self.employee_tel.insert(END, employee.get_telefono_empleado()) self.employee_address.insert(END, employee.get_direccion_empleado())
def to_str(self): game_name = VideojuegoDao.buscar_nombre(self.__codigo_videojuego) employee_name = EmpleadoDao.buscar_nombre(self.__codigo_empleado) return (f" {self.__id_compra:03d}" + " " f"{game_name[0]:25.24}" f"{self.__estado_compra:11}" f"{employee_name[0]:24.23}" f"{self.__fecha_compra} " f"{self.__precio_compra:06.2f}")
def employee_index_window(self): employees_list = EmpleadoDao.seleccionar() self.employees_listbox = [] for employee in employees_list: logger.debug(employee) self.employees_listbox.append(employee) self.new_win = Toplevel(self.root) IndexWindow(self.new_win, "Lista de Empleados", "810x500", "listbox-employees.png", self.employees_listbox)
def update_employee(self): # Get input from fields using get method id_employee = self.select_byid.get() name = self.employee_name.get() address = self.employee_address.get() tel = self.employee_tel.get() # Create customer instance employee = Empleado(id_empleado=id_employee, nombre_empleado=name, telefono_empleado=tel, direccion_empleado=address) EmpleadoDao.actualizar(employee) confirm = messagebox.askyesno(parent=self.root, message='Empleado actualizado correctamente, ¿Desea modificar otro?', icon='question', title='Empleado actualizado') if (confirm == True): self.select_byid.delete(0, END) self.reset_form() else: self.cancel_to_main()
def add_employee(self): # Get input fields .get name = self.employee_name.get() address = self.employee_address.get() telephone = self.employee_tel.get() # Create Employee instance employee = Empleado(nombre_empleado=name, telefono_empleado=telephone, direccion_empleado=address) EmpleadoDao.insertar(employee) confirm = messagebox.askyesno( parent=self.root, message='Empleado agregado correctamente, ¿Desea agregado otro?', icon='question', title='Empleado agregado') if (confirm == True): self.reset_form() else: self.cancel_to_main()
def search_employee(self, search_term): employee_list = EmpleadoDao.buscar(search_term) return employee_list
def del_employee_by_id(self, id_employee): employee = Empleado(id_empleado=id_employee) EmpleadoDao.eliminar(employee)