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

            if (rowsCount > 0)
            {
                ROYcms.Community.Model.ROYcms_Community model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Community.Model.ROYcms_Community();
                    if (dt.Rows[n]["bh"].ToString() != "")
                    {
                        model.bh = int.Parse(dt.Rows[n]["bh"].ToString());
                    }
                    model.title   = dt.Rows[n]["title"].ToString();
                    model.content = dt.Rows[n]["content"].ToString();
                    model.tag     = dt.Rows[n]["tag"].ToString();
                    model.user_id = dt.Rows[n]["user_id"].ToString();
                    model.type_id = dt.Rows[n]["type_id"].ToString();
                    if (dt.Rows[n]["hits"].ToString() != "")
                    {
                        model.hits = int.Parse(dt.Rows[n]["hits"].ToString());
                    }
                    if (dt.Rows[n]["star_time"].ToString() != "")
                    {
                        model.star_time = DateTime.Parse(dt.Rows[n]["star_time"].ToString());
                    }
                    if (dt.Rows[n]["end_time"].ToString() != "")
                    {
                        model.end_time = DateTime.Parse(dt.Rows[n]["end_time"].ToString());
                    }
                    model.ip = dt.Rows[n]["ip"].ToString();
                    if (dt.Rows[n]["switchs"].ToString() != "")
                    {
                        model.switchs = int.Parse(dt.Rows[n]["switchs"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(ROYcms.Community.Model.ROYcms_Community model)
 {
     dal.Update(model);
 }
Exemple #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(ROYcms.Community.Model.ROYcms_Community model)
 {
     return(dal.Add(model));
 }