Exemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <dbamet.Model.ActivityNotes> DataTableToList(DataTable dt)
        {
            List <dbamet.Model.ActivityNotes> modelList = new List <dbamet.Model.ActivityNotes>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                dbamet.Model.ActivityNotes model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new dbamet.Model.ActivityNotes();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["activityid"] != null && dt.Rows[n]["activityid"].ToString() != "")
                    {
                        model.activityid = dt.Rows[n]["activityid"].ToString();
                    }
                    if (dt.Rows[n]["title"] != null && dt.Rows[n]["title"].ToString() != "")
                    {
                        model.title = dt.Rows[n]["title"].ToString();
                    }
                    if (dt.Rows[n]["place"] != null && dt.Rows[n]["place"].ToString() != "")
                    {
                        model.place = dt.Rows[n]["place"].ToString();
                    }
                    if (dt.Rows[n]["leader"] != null && dt.Rows[n]["leader"].ToString() != "")
                    {
                        model.leader = dt.Rows[n]["leader"].ToString();
                    }
                    if (dt.Rows[n]["Content"] != null && dt.Rows[n]["Content"].ToString() != "")
                    {
                        model.Content = dt.Rows[n]["Content"].ToString();
                    }
                    if (dt.Rows[n]["openTime"] != null && dt.Rows[n]["openTime"].ToString() != "")
                    {
                        model.openTime = DateTime.Parse(dt.Rows[n]["openTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(dbamet.Model.ActivityNotes model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(dbamet.Model.ActivityNotes model)
 {
     return(dal.Add(model));
 }