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

            if (rowsCount > 0)
            {
                LFL.Favorite.Model.ThumbUrl model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LFL.Favorite.Model.ThumbUrl();
                    if (dt.Rows[n]["ThumbID"].ToString() != "")
                    {
                        model.ThumbID = int.Parse(dt.Rows[n]["ThumbID"].ToString());
                    }
                    if (dt.Rows[n]["FavID"].ToString() != "")
                    {
                        model.FavID = int.Parse(dt.Rows[n]["FavID"].ToString());
                    }
                    model.ThumbImage = dt.Rows[n]["ThumbImage"].ToString();
                    if (dt.Rows[n]["OffsetLeft"].ToString() != "")
                    {
                        model.OffsetLeft = decimal.Parse(dt.Rows[n]["OffsetLeft"].ToString());
                    }
                    if (dt.Rows[n]["OffsetTop"].ToString() != "")
                    {
                        model.OffsetTop = decimal.Parse(dt.Rows[n]["OffsetTop"].ToString());
                    }
                    if (dt.Rows[n]["Width"].ToString() != "")
                    {
                        model.Width = decimal.Parse(dt.Rows[n]["Width"].ToString());
                    }
                    if (dt.Rows[n]["Height"].ToString() != "")
                    {
                        model.Height = decimal.Parse(dt.Rows[n]["Height"].ToString());
                    }
                    model.Target = dt.Rows[n]["Target"].ToString();
                    if (dt.Rows[n]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(dt.Rows[n]["Sort"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LFL.Favorite.Model.ThumbUrl model)
 {
     dal.Update(model);
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(LFL.Favorite.Model.ThumbUrl model)
 {
     dal.Add(model);
 }