raiseDatabaseExecption("Something went worng with Databes: {}".format(err))
defsetJobKind(self,name,workgroup_id):
try:
cursor=self.db.connection.cursor()
cursor.execute("insert into job_kind (name, workgroup) values ('{}', {})".format(name,workgroup_idifworkgroup_id!=Noneelse'NULL'))
self.db.connection.commit()
returnself.getJobKind(name)
exceptExceptionaserr:
traceback.print_exc()
self.db.connection.rollback()
raiseDatabaseExecption("Something went worng with Databes: {}".format(err))
defupdateJobKind(self,jobkind):
try:
cursor=self.db.connection.cursor()
cursor.execute("update job_kind set name='{}', workgroup={} where id={}".format(jobkind['name'],jobkind['workgroup']['id']ifjobkind['workgroup']!=Noneelse'NULL',jobkind['id']))
self.db.connection.commit()
returnself.getJobKind(jobkind['id'])
exceptExceptionaserr:
traceback.print_exc()
self.db.connection.rollback()
raiseDatabaseExecption("Something went worng with Databes: {}".format(err))
defdeleteJobKind(self,jobkind):
try:
cursor=self.db.connection.cursor()
cursor.execute("delete from job_kind where id={}".format(jobkind['id']))
self.db.connection.commit()
exceptExceptionaserr:
traceback.print_exc()
self.db.connection.rollback()
raiseDatabaseExecption("Something went worng with Databes: {}".format(err))
defsetJobKindDates(self,date,jobkind,maxpersons):
try:
cursor=self.db.connection.cursor()
cursor.execute("insert into job_kind_dates (daydate, job_kind, maxpersons) values ('{}', {}, {})".format(date,jobkind['id']ifjobkind!=Noneelse'NULL',maxpersons))
self.db.connection.commit()
exceptExceptionaserr:
traceback.print_exc()
self.db.connection.rollback()
raiseDatabaseExecption("Something went worng with Databes: {}".format(err))
defupdateJobKindDates(self,jobkindDate):
try:
cursor=self.db.connection.cursor()
cursor.execute("update job_kind_dates set job_kind={}, maxpersons='{}' where id={}".format(jobkindDate['job_kind']['id']ifjobkindDate['job_kind']!=Noneelse'NULL',jobkindDate['maxpersons'],jobkindDate['id']))
self.db.connection.commit()
exceptExceptionaserr:
traceback.print_exc()
self.db.connection.rollback()
raiseDatabaseExecption("Something went wrong with Database: {}".format(err))
defgetJobKindDates(self,date):
try:
cursor=self.db.connection.cursor()
cursor.execute("select * from job_kind_dates where daydate='{}'".format(date))