Мелкое
This commit is contained in:
@ -85,8 +85,11 @@ public class MySynchronizationOld
|
|||||||
|
|
||||||
public MyThread myThread = null;
|
public MyThread myThread = null;
|
||||||
|
|
||||||
|
|
||||||
private int rid_sendFrmLocust = -1; //Для отправки данных
|
private int rid_sendFrmLocust = -1; //Для отправки данных
|
||||||
private int rid_sendFrmLocustDel = -1; //Для отправки данных
|
private int rid_sendFrmLocustDel = -1; //Для отправки данных
|
||||||
|
private int rid_sendFrmLocustHealth = -1; //Для отправки данных
|
||||||
|
|
||||||
private int rid_frmlocust = -1; //Для запроса данных
|
private int rid_frmlocust = -1; //Для запроса данных
|
||||||
private int rid_frmlocustdel = -1; //Для запроса данных
|
private int rid_frmlocustdel = -1; //Для запроса данных
|
||||||
|
|
||||||
@ -175,60 +178,6 @@ public class MySynchronizationOld
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Отправить анкету для сохранения на сервер в виде JSON запроса
|
|
||||||
* @param uid Идентификатор записи
|
|
||||||
*/
|
|
||||||
public void sendFrmLocustHealth(String uid)
|
|
||||||
{
|
|
||||||
if(uid==null || uid.equals("")) return;
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
|
|
||||||
DbOpenHelper dboh = new DbOpenHelper(_context);
|
|
||||||
Cursor cursor = null;
|
|
||||||
cursor = dboh.getReadableDatabase().rawQuery("select * from frmlocusthealth where uid=?", new String[] { String.valueOf(uid) });
|
|
||||||
if(cursor.moveToFirst())
|
|
||||||
{
|
|
||||||
do{
|
|
||||||
//Если задано имя файла то добавляем его в очередь на отправку на сервер
|
|
||||||
String fname;
|
|
||||||
fname=cursor.getString(cursor.getColumnIndex("image_name1"));
|
|
||||||
if(fname!=null && !fname.equals(""))
|
|
||||||
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
|
||||||
fname = cursor.getString(cursor.getColumnIndex("image_name2"));
|
|
||||||
if(fname!=null && !fname.equals(""))
|
|
||||||
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
|
||||||
fname = cursor.getString(cursor.getColumnIndex("image_name3"));
|
|
||||||
if(fname!=null && !fname.equals(""))
|
|
||||||
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
|
||||||
fname = cursor.getString(cursor.getColumnIndex("image_name4"));
|
|
||||||
if(fname!=null && !fname.equals(""))
|
|
||||||
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
|
||||||
fname = cursor.getString(cursor.getColumnIndex("image_name5"));
|
|
||||||
if(fname!=null && !fname.equals(""))
|
|
||||||
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
|
||||||
|
|
||||||
|
|
||||||
for(int i=0;i<cursor.getColumnCount();i++)
|
|
||||||
{
|
|
||||||
String columnName = cursor.getColumnName(i);
|
|
||||||
String value = cursor.getString(i);
|
|
||||||
try {
|
|
||||||
jsonObject.put(columnName, value);
|
|
||||||
} catch (JSONException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rid_sendFrmLocust = myThread.addRequest(MySynchronizationOld.URL+"/asdc/FrmLocustHealth/", jsonObject.toString(), null);
|
|
||||||
|
|
||||||
}while (cursor.moveToNext());
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
dboh.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Отправить анкету саранчи на сервер по идентификатору либо по времени создания (время должно быть уникальным)
|
/** Отправить анкету саранчи на сервер по идентификатору либо по времени создания (время должно быть уникальным)
|
||||||
* */
|
* */
|
||||||
public void sendFrmLocust(String uid)
|
public void sendFrmLocust(String uid)
|
||||||
@ -361,6 +310,59 @@ public class MySynchronizationOld
|
|||||||
dboh.close();
|
dboh.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Отправить анкету для сохранения на сервер в виде JSON запроса
|
||||||
|
* @param uid Идентификатор записи
|
||||||
|
*/
|
||||||
|
public void sendFrmLocustHealth(String uid)
|
||||||
|
{
|
||||||
|
if(uid==null || uid.equals("")) return;
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
|
||||||
|
DbOpenHelper dboh = new DbOpenHelper(_context);
|
||||||
|
Cursor cursor = null;
|
||||||
|
cursor = dboh.getReadableDatabase().rawQuery("select * from frmlocusthealth where uid=?", new String[] { String.valueOf(uid) });
|
||||||
|
if(cursor.moveToFirst())
|
||||||
|
{
|
||||||
|
do{
|
||||||
|
//Если задано имя файла то добавляем его в очередь на отправку на сервер
|
||||||
|
String fname;
|
||||||
|
fname=cursor.getString(cursor.getColumnIndex("image_name1"));
|
||||||
|
if(fname!=null && !fname.equals(""))
|
||||||
|
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
||||||
|
fname = cursor.getString(cursor.getColumnIndex("image_name2"));
|
||||||
|
if(fname!=null && !fname.equals(""))
|
||||||
|
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
||||||
|
fname = cursor.getString(cursor.getColumnIndex("image_name3"));
|
||||||
|
if(fname!=null && !fname.equals(""))
|
||||||
|
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
||||||
|
fname = cursor.getString(cursor.getColumnIndex("image_name4"));
|
||||||
|
if(fname!=null && !fname.equals(""))
|
||||||
|
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
||||||
|
fname = cursor.getString(cursor.getColumnIndex("image_name5"));
|
||||||
|
if(fname!=null && !fname.equals(""))
|
||||||
|
myThread.addRequest(MySynchronizationOld.URL+"/get/?fn=6", null, Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Locust/" + fname);
|
||||||
|
|
||||||
|
|
||||||
|
for(int i=0;i<cursor.getColumnCount();i++)
|
||||||
|
{
|
||||||
|
String columnName = cursor.getColumnName(i);
|
||||||
|
String value = cursor.getString(i);
|
||||||
|
try {
|
||||||
|
jsonObject.put(columnName, value);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rid_sendFrmLocustHealth = myThread.addRequest(MySynchronizationOld.URL+"/asdc/FrmLocustHealth/", jsonObject.toString(), null);
|
||||||
|
|
||||||
|
}while (cursor.moveToNext());
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
dboh.close();
|
||||||
|
}
|
||||||
|
|
||||||
//Для обновления справочников и загрузки старых анкет уничножения саранчи
|
//Для обновления справочников и загрузки старых анкет уничножения саранчи
|
||||||
int makeRequest(String tableName,String days,String country_id)
|
int makeRequest(String tableName,String days,String country_id)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user