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

            if (rowsCount > 0)
            {
                SmartTeaching.Entity.Base_News model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new SmartTeaching.Entity.Base_News();
                    if (dt.Rows[n]["NewsId"].ToString() != "")
                    {
                        model.NewsId = int.Parse(dt.Rows[n]["NewsId"].ToString());
                    }
                    if (dt.Rows[n]["NewsTypeId"].ToString() != "")
                    {
                        model.NewsTypeId = int.Parse(dt.Rows[n]["NewsTypeId"].ToString());
                    }
                    if (dt.Rows[n]["UserId"].ToString() != "")
                    {
                        model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString());
                    }
                    model.NewsTitle   = dt.Rows[n]["NewsTitle"].ToString();
                    model.NewsContent = dt.Rows[n]["NewsContent"].ToString();
                    if (dt.Rows[n]["CreateDate"].ToString() != "")
                    {
                        model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
                    }
                    model.Summary  = dt.Rows[n]["Summary"].ToString();
                    model.FileName = dt.Rows[n]["FileName"].ToString();
                    model.FilePath = dt.Rows[n]["FilePath"].ToString();
                    if (dt.Rows[n]["FileSize"].ToString() != "")
                    {
                        model.FileSize = int.Parse(dt.Rows[n]["FileSize"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    int id = Convert.ToInt32(Request.QueryString["id"]);
                    Entity.Base_News model = new Entity.Base_News();
                    model = bll.GetModel(id);

                    Page.Title          = model.NewsTitle;
                    litNewsContent.Text = model.NewsContent;
                    litNewsTitle.Text   = model.NewsTitle;
                    ltlCreateDate.Text  = model.CreateDate.ToString();
                    litSummary.Text     = model.Summary;
                }
                catch
                {
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(SmartTeaching.Entity.Base_News model)
 {
     return(dal.Update(model));
 }
Esempio n. 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(SmartTeaching.Entity.Base_News model)
 {
     return(dal.Add(model));
 }