示例#1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <TFXK.Model.Pictures> DataTableToList(DataTable dt)
        {
            List <TFXK.Model.Pictures> modelList = new List <TFXK.Model.Pictures>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                TFXK.Model.Pictures model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new TFXK.Model.Pictures();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["typeID"].ToString() != "")
                    {
                        model.typeID = int.Parse(dt.Rows[n]["typeID"].ToString());
                    }
                    if (dt.Rows[n]["parentID"].ToString() != "")
                    {
                        model.parentID = int.Parse(dt.Rows[n]["parentID"].ToString());
                    }
                    model.imgPath = dt.Rows[n]["imgPath"].ToString();
                    model.imgAlt  = dt.Rows[n]["imgAlt"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TFXK.Model.Pictures model)
 {
     dal.Update(model);
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TFXK.Model.Pictures model)
 {
     return(dal.Add(model));
 }