예제 #1
0
파일: Category.cs 프로젝트: junzheng/YF17A
        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;
        }