Esempio n. 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <MobileSoft.Model.Unified.Tb_Notice> DataTableToList(DataTable dt)
        {
            List <MobileSoft.Model.Unified.Tb_Notice> modelList = new List <MobileSoft.Model.Unified.Tb_Notice>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                MobileSoft.Model.Unified.Tb_Notice model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model        = new MobileSoft.Model.Unified.Tb_Notice();
                    model.Id     = dt.Rows[n]["Id"].ToString();
                    model.UserId = dt.Rows[n]["UserId"].ToString();
                    if (dt.Rows[n]["NoticeType"].ToString() != "")
                    {
                        model.NoticeType = int.Parse(dt.Rows[n]["NoticeType"].ToString());
                    }
                    model.Title   = dt.Rows[n]["Title"].ToString();
                    model.Content = dt.Rows[n]["Content"].ToString();
                    if (dt.Rows[n]["IssueDate"].ToString() != "")
                    {
                        model.IssueDate = DateTime.Parse(dt.Rows[n]["IssueDate"].ToString());
                    }
                    model.CommunityId = dt.Rows[n]["CommunityId"].ToString();
                    if (dt.Rows[n]["IsDelete"].ToString() != "")
                    {
                        model.IsDelete = int.Parse(dt.Rows[n]["IsDelete"].ToString());
                    }
                    model.ImageURL   = dt.Rows[n]["ImageURL"].ToString();
                    model.ContentURL = dt.Rows[n]["ContentURL"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(MobileSoft.Model.Unified.Tb_Notice model)
 {
     dal.Update(model);
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(MobileSoft.Model.Unified.Tb_Notice model)
 {
     dal.Add(model);
 }