Exemplo n.º 1
0
        //select query for favrouites table
        public UserObject Favouriteselection(int user_id)
        {
            var        selectQuery = "SELECT * FROM " + TableFavourite + " WHERE " + ColumnId + " ='" + user_id + "'";
            ICursor    c           = dbWritablObject.RawQuery(selectQuery, null);
            UserObject user;

            while (c.MoveToNext())
            {
                var idInfo = c.GetInt(c.GetColumnIndexOrThrow(ColumnId));
                System.Console.WriteLine("Value of id : " + idInfo);


                var nameInfo = c.GetString(c.GetColumnIndexOrThrow(ColumnName));
                System.Console.WriteLine("Value of name : " + nameInfo);

                var addressInfo = c.GetString(c.GetColumnIndexOrThrow(ColumnAddress));
                System.Console.WriteLine("Value of address : " + addressInfo);

                var dayInfo = c.GetString(c.GetColumnIndexOrThrow(ColumnDay));
                System.Console.WriteLine("Value of day : " + dayInfo);

                var priceInfo = c.GetInt(c.GetColumnIndexOrThrow(ColumnPrice));
                System.Console.WriteLine("Value of price : " + priceInfo);

                var categoryInfo = c.GetString(c.GetColumnIndexOrThrow(ColumnCategory));
                System.Console.WriteLine("Value of category : " + categoryInfo);

                if (user_id.Equals(idInfo))
                {
                    user = new UserObject(idInfo, nameInfo, addressInfo, dayInfo, priceInfo, categoryInfo);
                    c.Close();
                    return(user);
                }
            }
            return(null);
        }