| | |
| | | public static DictionaryDao getInstance() {
|
| | | return instance;
|
| | | }
|
| | | private static StringBuffer sb = new StringBuffer("select dict_id, name from dictionary ");
|
| | |
|
| | |
|
| | |
|
| | | private static List<Dictionary>load(String type){
|
| | | List<Dictionary> list = new ArrayList<Dictionary>();
|
| | | StringBuffer sb = new StringBuffer("select dict_id, name from dictionary ");
|
| | | try {
|
| | | sb.append("where 1 = 1 and type = ");
|
| | | sb.append("'");
|
| | | sb.append(type);
|
| | | sb.append("'");
|
| | | Dictionary aqi = null;
|
| | | Cursor c = MainActivity.getInstance().db.rawQuery(sb.toString(), new String[]{});
|
| | | while (c.moveToNext()) {
|
| | |
| | | return load(CommonVariables.DictionaryType.VISITOR_TYPE);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 加载考勤类型
|
| | | * @return
|
| | |
| | | return load(CommonVariables.DictionaryType.ATTENDER_TYPE);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public List<Dictionary> addDictionary(String type, String name) {
|
| | | List<Dictionary> list = new ArrayList<Dictionary>();
|
| | | try {
|
| | | StringBuilder sb = new StringBuilder(40);
|
| | |
|
| | | sb.append("insert into dictionary ( dict_id, name) values (")
|
| | | .append("'")
|
| | | .append(type)
|
| | | .append("'")
|
| | | .append(" , ")
|
| | | .append(")");
|
| | | MainActivity.getInstance().db.rawQuery(sb.toString(), new String[]{});
|
| | | Dictionary aqi = null;
|
| | | Cursor c = MainActivity.getInstance().db.rawQuery(sb.toString(), new String[]{});
|
| | | Cursor c = MainActivity.getInstance().db.rawQuery("select dict_id,name from dictionary", new String[]{});
|
| | | while (c.moveToNext()) {
|
| | | aqi = new Dictionary();
|
| | | aqi.setDictId(c.getString(c.getColumnIndex("dict_id")));
|