Exemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LFL.Favorite.Model.Favorite> DataTableToList(DataTable dt)
        {
            List <LFL.Favorite.Model.Favorite> modelList = new List <LFL.Favorite.Model.Favorite>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LFL.Favorite.Model.Favorite model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LFL.Favorite.Model.Favorite();
                    if (dt.Rows[n]["FavID"].ToString() != "")
                    {
                        model.FavID = int.Parse(dt.Rows[n]["FavID"].ToString());
                    }
                    model.Title = dt.Rows[n]["Title"].ToString();
                    model.URL   = dt.Rows[n]["URL"].ToString();
                    if (dt.Rows[n]["FavCategoryID"].ToString() != "")
                    {
                        model.FavCategoryID = int.Parse(dt.Rows[n]["FavCategoryID"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LFL.Favorite.Model.Favorite model)
 {
     dal.Update(model);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(LFL.Favorite.Model.Favorite model)
 {
     dal.Add(model);
 }