Revisión 393
Añadido por Manu Mora Gordillo hace más de 12 años
controlies/trunk/applications/controlies/modules/LaptopsHistory.py | ||
---|---|---|
|
||
def add(self):
|
||
now = datetime.datetime.now()
|
||
#sql = "INSERT INTO laptops_historical (id_historical,id_laptop,datetime,username,name,id_user_type,nif,comment,id_state) "
|
||
self.DB.laptops_historical.insert (id_laptop=self.id_laptop, datetime=now.strftime('%Y-%m-%d %H:%M:%S'), username=self.username, name = self.name, id_user_type=self.id_user_type,nif=self.nif,comment=self.comment, id_state=self.id_state)
|
||
self.DB.commit()
|
||
sql = "INSERT INTO laptops_historical (id_historical,id_laptop,datetime,username,name,id_user_type,nif,comment,id_state) "
|
||
sql = sql+" VALUES (null,"+ str(self.id_laptop) +",'"+ now.strftime('%Y-%m-%d %H:%M:%S')+"','"+self.username+"','"+self.name+"',"+ str(self.id_user_type)+",'"+ self.nif+"','"+self.comment+"','"+ str(self.id_state)+"')"
|
||
result = self.DB.executesql(sql)
|
||
|
||
#self.DB.laptops_historical.insert (id_laptop=self.id_laptop, datetime=now.strftime('%Y-%m-%d %H:%M:%S'), username=self.username, name = self.name, id_user_type=self.id_user_type,nif=self.nif,comment=self.comment, id_state=self.id_state)
|
||
#self.DB.commit()
|
||
|
||
return "OK"
|
||
|
controlies/trunk/applications/controlies/modules/Laptops.py | ||
---|---|---|
|
||
|
||
def add(self):
|
||
id = int(self.id_trademark)
|
||
|
||
self.DB.laptops.insert(serial_number=self.serial_number,id_trademark=id)
|
||
self.DB.commit()
|
||
|
||
#max = self.getMaxId()
|
||
#lh = LaptopsHistory(self.DB,"",max,"1","0","","","","Nuevo en el sistema")
|
||
#lh.add()
|
||
#self.DB.laptops.insert(serial_number=self.serial_number,id_trademark=int(self.id_trademark))
|
||
#self.DB.commit()
|
||
|
||
sql = "INSERT INTO laptops VALUES (null,'"+self.serial_number+"',"+self.id_trademark+")"
|
||
result = self.DB.executesql(sql)
|
||
|
||
max = self.getMaxId()
|
||
lh = LaptopsHistory(self.DB,"",max,"1","0","","","","Nuevo en el sistema")
|
||
lh.add()
|
||
|
||
return "OK"
|
||
|
||
|
Exportar a: Unified diff
Vuelta al sql normal, DAL da errores