示例#1
0
        public List <Question> getAllQuestions()
        {
            List <Question> quesList = new List <Question>();
            // Select All Query
            string selectQuery = "SELECT  * FROM " + TABLE_QUEST;

            dbase = this.ReadableDatabase;
            Cursor cursor = dbase.RawQuery(selectQuery, null);

            // looping through all rows and adding to list
            if (cursor.MoveToFirst())
            {
                do
                {
                    Question quest = new Question();
                    quest.setID(cursor.GetInt(0));
                    quest.setQUESTION(cursor.GetString(1));
                    quest.setANSWER(cursor.GetString(2));
                    quest.setOPTA(cursor.GetString(3));
                    quest.setOPTB(cursor.GetString(4));
                    quest.setOPTC(cursor.GetString(5));
                    quesList.Add(quest);
                } while (cursor.MoveToNext());
            }
            // return quest list
            return(quesList);
        }
        public List <EntCallLog> getCallLog(string queryFilter, string querySorter)
        {
            //string queryFilter = System.String.Format("{0}={1}", log.Calls.Date, dt.Ticks);
            // string querySorter = System.String.Format("{0} desc limit 100 ", log.Calls.Date);
            Android.Database.ICursor queryData      = Application.Context.ContentResolver.Query(log.Calls.ContentUri, null, queryFilter, null, querySorter);
            List <EntCallLog>        lstRecentCalls = new List <EntCallLog>();

            while (queryData.MoveToNext())
            {
                EntCallLog ent = new EntCallLog();
                ent.numero   = queryData.GetString(queryData.GetColumnIndex(log.Calls.Number));
                ent.tipo     = (Android.Provider.CallType)queryData.GetInt(queryData.GetColumnIndex(log.Calls.Type));
                ent.nombre   = queryData.GetString(queryData.GetColumnIndex(log.Calls.CachedName));
                ent.duracion = queryData.GetInt(queryData.GetColumnIndex(log.Calls.Duration));
                ent.fecha    = DateTime.Parse(new Java.Sql.Date(queryData.GetLong(queryData.GetColumnIndex(log.Calls.Date))).ToString());
                ent.imageUri = queryData.GetString(queryData.GetColumnIndex(log.Calls.CachedPhotoUri));
                lstRecentCalls.Add(ent);
            }
            return(lstRecentCalls);
        }