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

            if (rowsCount > 0)
            {
                Tz888.Model.Recomm.recommResourceM model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Tz888.Model.Recomm.recommResourceM();
                    if (dt.Rows[n]["RecommID"].ToString() != "")
                    {
                        model.RecommID = int.Parse(dt.Rows[n]["RecommID"].ToString());
                    }
                    if (dt.Rows[n]["ResourceId"].ToString() != "")
                    {
                        model.ResourceId = long.Parse(dt.Rows[n]["ResourceId"].ToString());
                    }
                    model.ResourceTitle = dt.Rows[n]["ResourceTitle"].ToString();
                    if (dt.Rows[n]["ResourceTypeId"].ToString() != "")
                    {
                        model.ResourceTypeId = int.Parse(dt.Rows[n]["ResourceTypeId"].ToString());
                    }
                    model.ResourceUrl  = dt.Rows[n]["ResourceUrl"].ToString();
                    model.RecommName   = dt.Rows[n]["RecommName"].ToString();
                    model.RecommToUser = dt.Rows[n]["RecommToUser"].ToString();
                    if (dt.Rows[n]["RecommDate"].ToString() != "")
                    {
                        model.RecommDate = DateTime.Parse(dt.Rows[n]["RecommDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Tz888.Model.Recomm.recommResourceM model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tz888.Model.Recomm.recommResourceM model)
 {
     return(dal.Add(model));
 }