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

            if (rowsCount > 0)
            {
                Maticsoft.Model.SuccessInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Maticsoft.Model.SuccessInfo();
                    if (dt.Rows[n]["SuccessID"].ToString() != "")
                    {
                        model.SuccessID = int.Parse(dt.Rows[n]["SuccessID"].ToString());
                    }
                    model.SuccessTitle = dt.Rows[n]["SuccessTitle"].ToString();
                    if (dt.Rows[n]["Fatime"].ToString() != "")
                    {
                        model.Fatime = DateTime.Parse(dt.Rows[n]["Fatime"].ToString());
                    }
                    model.Write    = dt.Rows[n]["Write"].ToString();
                    model.ImageURL = dt.Rows[n]["ImageURL"].ToString();
                    if (dt.Rows[n]["HitNum"].ToString() != "")
                    {
                        model.HitNum = int.Parse(dt.Rows[n]["HitNum"].ToString());
                    }
                    model.SuccessContent = dt.Rows[n]["SuccessContent"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.SuccessInfo model)
 {
     return(dal.Update(model));
 }
Exemple #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Maticsoft.Model.SuccessInfo model)
 {
     return(dal.Add(model));
 }