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

            if (rowsCount > 0)
            {
                NewXzc.Model.RED_RECOMMEND model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new NewXzc.Model.RED_RECOMMEND();
                    if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["PageId"] != null && dt.Rows[n]["PageId"].ToString() != "")
                    {
                        model.PageId = int.Parse(dt.Rows[n]["PageId"].ToString());
                    }
                    if (dt.Rows[n]["Cid"] != null && dt.Rows[n]["Cid"].ToString() != "")
                    {
                        model.Cid = int.Parse(dt.Rows[n]["Cid"].ToString());
                    }
                    if (dt.Rows[n]["Sort"] != null && dt.Rows[n]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(dt.Rows[n]["Sort"].ToString());
                    }
                    if (dt.Rows[n]["Url"] != null && dt.Rows[n]["Url"].ToString() != "")
                    {
                        model.Url = dt.Rows[n]["Url"].ToString();
                    }
                    if (dt.Rows[n]["V1"] != null && dt.Rows[n]["V1"].ToString() != "")
                    {
                        model.V1 = dt.Rows[n]["V1"].ToString();
                    }
                    if (dt.Rows[n]["V2"] != null && dt.Rows[n]["V2"].ToString() != "")
                    {
                        model.V2 = dt.Rows[n]["V2"].ToString();
                    }
                    if (dt.Rows[n]["V3"] != null && dt.Rows[n]["V3"].ToString() != "")
                    {
                        model.V3 = dt.Rows[n]["V3"].ToString();
                    }
                    if (dt.Rows[n]["v4"] != null && dt.Rows[n]["v4"].ToString() != "")
                    {
                        model.v4 = dt.Rows[n]["v4"].ToString();
                    }
                    if (dt.Rows[n]["AddTime"] != null && dt.Rows[n]["AddTime"].ToString() != "")
                    {
                        model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(NewXzc.Model.RED_RECOMMEND model)
 {
     return(dal.Update(model));
 }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(NewXzc.Model.RED_RECOMMEND model)
 {
     return(dal.Add(model));
 }