Index: controlies/trunk/applications/controlies/controllers/laptops.py
===================================================================
--- controlies/trunk/applications/controlies/controllers/laptops.py	(revision 348)
+++ controlies/trunk/applications/controlies/controllers/laptops.py	(revision 349)
@@ -1,6 +1,6 @@
 # coding: utf8
 from applications.controlies.modules.Laptops import Laptops
-from applications.controlies.modules.MySQLConnection import MySQLConnection
+from applications.controlies.modules.SQLiteConnection import SQLiteConnection
 from applications.controlies.modules.Utils import Utils
 
 def index():    
@@ -9,7 +9,7 @@
 @service.json
 @auth.requires_login()
 def list():    
-    my = MySQLConnection()
+    my = SQLiteConnection()
     l = Laptops(my,"","","")
     response = l.list(request.vars)
     return response
@@ -16,7 +16,7 @@
 
 @service.json
 def getLaptopData():
-    my = MySQLConnection()
+    my = SQLiteConnection()
     l = Laptops(my,request.vars['id_portatil'],"","")
     response = l.getLaptopData()
     return dict(response=response)
@@ -23,7 +23,7 @@
 
 @service.json
 def getAllLaptopTypes():
-    my = MySQLConnection()
+    my = SQLiteConnection()
     l = Laptops(my,"","","")
     response = l.getAllLaptopTypes()
     return dict(response=response)
@@ -31,7 +31,7 @@
 @service.json
 @auth.requires_login()       
 def delete():
-    my = MySQLConnection()
+    my = SQLiteConnection()
     l = Laptops(my,request.vars["id_portatil"],"","")
     response = l.delete()                         
     return dict(response=response)
@@ -39,7 +39,7 @@
 @service.json
 @auth.requires_login()    
 def modify():
-    my = MySQLConnection()
+    my = SQLiteConnection()
     l = Laptops(my,request.vars["id_portatil"],request.vars["numero_serie"],request.vars["marca_modelo"])
     response = l.process(request.vars["action"])
     return dict(response = response)            
Index: controlies/trunk/applications/controlies/modules/MySQLConnection.py
===================================================================
--- controlies/trunk/applications/controlies/modules/MySQLConnection.py	(revision 348)
+++ controlies/trunk/applications/controlies/modules/MySQLConnection.py	(nonexistent)
@@ -1,44 +0,0 @@
-##############################################################################
-# -*- coding: utf-8 -*-
-# Project:     ControlIES
-# Module:    MySQLConnection.py
-# Purpose:     Connection with mysql-server
-# Language:    Python 2.5
-# Date:        23-May-2012.
-# Ver:        23-May-2012.
-# Authores:    Manuel Mora Gordillo
-#				Francisco Damian Mendez Palma
-# Copyright:    2012 - Manuel Mora Gordillo <manuito @no-spam@ gmail.com>
-#				2012 - Francisco Damian Mendez Palma <fmendezpalma @no-spam@ gmail.com>
-#
-# ControlIES is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# ControlIES is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with ControlAula. If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import MySQLdb 
-    
-class MySQLConnection(object):
-    
-    def __init__(self):
-        self.host = "172.23.36.3"
-        self.user = "controlies"
-        self.passwd = "controlies"
-        self.database = "controlies"
-
-    def execute(self,sql):
-        db = MySQLdb.connect(host=self.host,user=self.user, passwd=self.passwd,db=self.database)
-        cursor=db.cursor()
-        cursor.execute(sql)
-        result = cursor.fetchall()
-        cursor.close()
-        db.close()
-        return result
\ No newline at end of file

Property changes on: controlies/trunk/applications/controlies/modules/MySQLConnection.py
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: controlies/trunk/applications/controlies/modules/SQLiteConnection.py
===================================================================
--- controlies/trunk/applications/controlies/modules/SQLiteConnection.py	(nonexistent)
+++ controlies/trunk/applications/controlies/modules/SQLiteConnection.py	(revision 349)
@@ -0,0 +1,85 @@
+##############################################################################
+# -*- coding: utf-8 -*-
+# Project:     ControlIES
+# Module:    SQLiteConnection.py
+# Purpose:     Connection with sqlite
+# Language:    Python 2.5
+# Date:        23-May-2012.
+# Ver:        23-May-2012.
+# Authores:    Manuel Mora Gordillo
+#				Francisco Damian Mendez Palma
+# Copyright:    2012 - Manuel Mora Gordillo <manuito @no-spam@ gmail.com>
+#				2012 - Francisco Damian Mendez Palma <fmendezpalma @no-spam@ gmail.com>
+#
+# ControlIES is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# ControlIES is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with ControlAula. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from gluon.sql import *
+
+class SQLiteConnection(object):
+    
+    def __init__(self):
+        self.db = DAL('sqlite://controlies.sqlite')
+        self.define_tables()
+
+    def define_tables(self):
+        self.db.define_table('laptops', 
+                        Field('id_laptop','integer'),
+                        Field('serial_number','string'),
+                        Field('id_trademark','integer'),
+                        primarykey=['id_laptop'])
+
+        self.db.define_table('laptops_trademarks', 
+                        Field('id_trademark','integer'),
+                        Field('trademark','string'),
+                        Field('model','string'),
+                        primarykey=['id_trademark'])
+
+        self.db.define_table('users_types', 
+                        Field('id_user_type','integer'),
+                        Field('user_type','string'),
+                        primarykey=['id_user_type'])
+
+        self.db.define_table('laptops_historical', 
+                        Field('id_historical','integer'),
+                        Field('id_laptop','integer'),                        
+                        Field('datetime','datetime'),
+                        Field('username','string'),
+                        Field('name','string'),
+                        Field('id_user_type','integer'),
+                        Field('comment','string'),
+                        Field('id_state','integer'),
+                        primarykey=['id_historical','id_laptop'])
+
+        self.db.define_table('states', 
+                        Field('id_state','integer'),
+                        Field('state','string'),                        
+                        primarykey=['id_state'])
+
+    def getDB(self):
+        return self.db
+
+    def select(self,table,data):
+        self.db.table.insert(data)
+
+    def insert(self,table,data):
+        self.db.table.insert(data)
+
+    def execute(self,sql):
+        """db = MySQLdb.connect(host=self.host,user=self.user, passwd=self.passwd,db=self.database)
+        cursor=db.cursor()
+        cursor.execute(sql)
+        result = cursor.fetchall()
+        cursor.close()
+        db.close()
+        return result"""
\ No newline at end of file

Property changes on: controlies/trunk/applications/controlies/modules/SQLiteConnection.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: controlies/trunk/applications/controlies/modules/Laptops.py
===================================================================
--- controlies/trunk/applications/controlies/modules/Laptops.py	(revision 348)
+++ controlies/trunk/applications/controlies/modules/Laptops.py	(revision 349)
@@ -29,8 +29,8 @@
     def __init__(self):
         pass
     
-    def __init__(self,MySQL,id_portatil,numero_serie,id_marca_modelo):
-        self.MySQL = MySQL
+    def __init__(self,SQLite,id_portatil,numero_serie,id_marca_modelo):
+        self.SQLite = SQLite
         self.id_portatil = id_portatil        
         self.numero_serie = numero_serie
         self.id_marca_modelo = id_marca_modelo        
@@ -133,18 +133,19 @@
         return { "page":page, "total":totalPages, "records":len(rows), "rows":rows[start:finish] }
 
 
-    def add(self):        
-        sql = "INSERT INTO portatiles (id_portatil, numero_serie, id_marca_modelo) "
+    def add(self):
+        """sql = "INSERT INTO portatiles (id_portatil, numero_serie, id_marca_modelo) "
         sql = sql + "VALUES(null,'"+self.numero_serie+"','"+self.id_marca_modelo+"')"
-        result = self.MySQL.execute(sql)
-                        
+        result = self.MySQL.execute(sql)"""
+        data = { 'id_laptop':'1', 'serial_number':self.numero_serie, 'id_trademark':self.id_marca_modelo }
+        self.SQLite.insert(laptops,data)
         return "OK"
             
             
-    def modify(self):
+    """def modify(self):
         sql = "UPDATE portatiles SET numero_serie='"+self.numero_serie+"', id_marca_modelo='"+self.id_marca_modelo+"' "
         sql = sql + "WHERE id_portatil='"+str(self.id_portatil)+"'"
-        result = self.MySQL.execute(sql)
+        result = self.SQLite.execute(sql)
                     
         return "OK"
 
@@ -151,7 +152,7 @@
 
     def delete(self):
         sql = "DELETE FROM portatiles WHERE id_portatil='"+str(self.id_portatil)+"'"
-        result = self.MySQL.execute(sql)
+        result = self.SQLite.execute(sql)
             
         return "OK"
 
@@ -186,4 +187,4 @@
                 "marca_modelo":r[1]+" / "+r[2]
             }
             data.append(dataType)
-        return data
\ No newline at end of file
+        return data"""
\ No newline at end of file
