示例#1
0
        public static List<Category> GetCategories(String filter)
        {
            string sql = @"SELECT [id],[description] FROM [category] where table='" + filter + "'";

            ContentProvider provider = ContentProvider.getInstance();
            DataTable dt = provider.query(sql);

            List<Category> cats = new List<Category>();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow row = dt.Rows[i];
                Category cat = new Category();
                cat.id = int.Parse(row["id"].ToString());
                cat.description =row["description"].ToString();
                cats.Add(cat);
            }

            return cats;
        }
示例#2
0
文件: User.cs 项目: junzheng/YF17A
        public List<Category> getUserRoleList()
        {
            string sql = @"SELECT id,description FROM [category] where table='user'";

            ContentProvider provider = ContentProvider.getInstance();
            DataTable dt = provider.query(sql);

            List<Category> userroles = new List<Category>();
            for(int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow row = dt.Rows[i];

                Category role = new Category();
                role.id = int.Parse(row["id"].ToString());
                role.description = row["description"].ToString();
                userroles.Add(role);
            }

            return userroles;
        }