Esempio n. 1
0
        public static IList <Comments> FindAll(string sql = "")
        {
            sql = string.IsNullOrEmpty(sql) ? "select * from Comments" : sql;
            IList <Comments> list = new List <Comments>();

            using (DataTable dt = OleDbHelper.GetDataSet(sql))
            {
                foreach (DataRow r in dt.Rows)
                {
                    list.Add(Read(r));
                }
            }
            return(list);
        }
Esempio n. 2
0
        public static IList <Category> FindByParent(int parentId)
        {
            string           sql  = string.Format("select * from category where parentId = {0}", parentId);
            IList <Category> list = new List <Category>();

            using (DataTable dt = OleDbHelper.GetDataSet(sql))
            {
                foreach (DataRow r in dt.Rows)
                {
                    list.Add(Read(r));
                }
            }

            return(list);
        }
Esempio n. 3
0
        public static Category GetById(int id)
        {
            string   sql  = string.Format("select * from category where id = {0}", id);
            Category inst = null;

            using (DataTable dt = OleDbHelper.GetDataSet(sql))
            {
                foreach (DataRow r in dt.Rows)
                {
                    inst = Read(r);
                }
            }

            return(inst);
        }