следующие являются функцией создания таблицы
db.execSQL("create table "+TABLE1_NAME+"("
+ "Id INTEGER Primary key AUTOINCREMENT , "
+ "Location TEXT ,"
+ "Project_Discription TEXT,"
+ "Client_Name TEXT,"
+ "Date TEXT,"
+ "Supervisor_id INTEGER,"
+ "FOREIGN KEY (Supervisor_id) REFERENCES "+TABLE4_NAME+"(Id)"
+ ")");
db.execSQL("create table "+TABLE2_NAME+ "(" +
"Id INTEGER primary key AUTOINCREMENT,"
+ "Name TEXT,"
+ "CNIC INTEGER,"
+ "Contact_Num INTEGER,"
+ "Project_id INTEGER ,"
+ "Total_Salary REAL ,"
+ " Recive_Salary REAL ,"
+ "Remain_Salary REAL ,"
+ "FOREIGN KEY (Project_id) REFERENCES "+TABLE1_NAME+"(Id)"
+" )");
db.execSQL("create table "+TABLE3_NAME+ "("
+ "Id INTEGER primary key AUTOINCREMENT,"
+ "Name TEXT,"
+ "Type TEXT,"
+ "Status INTEGER,"
+ "Upload_Date TEXT ,"
+ "Completion_Date TEXT,"
+ "Project_id INTEGER,"
+ "Activity_coast REAL,"
+ "FOREIGN KEY (Project_id) REFERENCES "+TABLE1_NAME+"(Id)"
+" )");
db.execSQL("create table "+TABLE4_NAME+"("
+ "Id INTEGER primary key AUTOINCREMENT,"
+ " Username TEXT,"
+ "Password TEXT"
+
") ");
db.execSQL("create table "+TABLE5_NAME+"("
+"Name TEXT,"
+"Type TEXT,"
+"Coast REAL"
+ ")");
следующие являются функцией вставленных значений
public boolean InsertProject(String location,String client_name,String discription,int supervisor_id)
{
SQLiteDatabase db= this.getWritableDatabase();
ContentValues contentValues=new ContentValues();
contentValues.put("Location",location);
contentValues.put("Client_Name",client_name);
contentValues.put("Project_Discription",discription);
contentValues.put("Supervisor_ID",supervisor_id);
long success= db.insert(TABLE1_NAME,null,contentValues);
if (success==-1)
{
return false;
}
else
{
return true;
}
}
public boolean InsertLabour(String name,int CNIC, int C_number,int project_id)
{
SQLiteDatabase db=this.getWritableDatabase();
ContentValues contentValues=new ContentValues();
contentValues.put("Name",name);
contentValues.put("CNIC",CNIC);
contentValues.put("C_number",C_number);
contentValues.put("Project_id",project_id);
long success=db.insert(TABLE2_NAME,null,contentValues);
if(success==-1)
{
return false;
}
else
{
return true;
}
}
public boolean InsertSupervisor(String name, String password)
{
SQLiteDatabase db= this.getWritableDatabase();
ContentValues contentValues=new ContentValues();
contentValues.put("Username",name);
contentValues.put("Password",password);
long success= db.insert(TABLE4_NAME,null,contentValues);
if (success==-1)
{
return false;
}
else
{
return true;
}
}
public boolean InsertMaterial(String name, String type,float coast)
{
SQLiteDatabase db= this.getWritableDatabase();
ContentValues contentValues=new ContentValues();
contentValues.put("name",name);
contentValues.put("Type",type);
contentValues.put("Coast",coast);
long success= db.insert(TABLE5_NAME,null,contentValues);
if (success==-1)
{
return false;
}
else
{
return true;
}
}
// следующие операции вставки возвращают ложное значение publi c boolean InsertActivity (имя строки, тип строки, состояние int, строка U_date, строка C_date, int Project_id) {SQLiteDatabase db = this.getWritableDatabase (); ContentValues contentValues = new ContentValues (); contentValues.put («Имя», имя); contentValues.put ("Тип", тип); contentValues.put («статус», статус); contentValues.put ("U_date", U_date); contentValues.put ("C_date", C_date); contentValues.put ("Project_id", Project_id);
long success= db.insert(TABLE3_NAME,null,contentValues);
if (success==-1)
{
return false;
}
else
{
return true;
}
}