private void ShowNews() { if (_aid<=0) { return; } Mxm.Model.article mo = new Mxm.Model.article(); mo = artMgr.GetModel(_aid); if (mo != null) { lbl_title.Text = mo.title; lbl_time.Text = mo.update_time.ToString(); if (!string.IsNullOrEmpty(mo.Editor)) { lbl_editor.Text = " <strong>新闻编辑:</strong>" + mo.Editor; } tdContent.InnerHtml = mo.content; } }
protected void btnSubmit_OnClick(object sender, EventArgs e) { Mxm.Model.article mo = new Mxm.Model.article(); mo.author = txtAuthor.Text; mo.content = txtContent.Value; mo.create_time = DateTime.Now; mo.title = txtTitle.Text; mo.update_time = DateTime.Now; if(Request.Form["ddlType"]!=null) { mo.Type_id = int.Parse(Request.Form["ddlType"].ToString()); } if (fileUp1.HasFile) { string tmp = DateTime.Now.Ticks.ToString(); string path = Server.MapPath( ConfigurationManager.AppSettings["imgPath"].ToString()) + tmp + fileUp1.FileName; fileUp1.SaveAs(path); if (CheckImg.CheckImgSize(path, _picSize, _picSize)) { mo.Picture_small = tmp + fileUp1.FileName; } else { System.IO.File.Delete(path); Mxm.Common.MessageBox.Show(this, "上传图片不符合规格,请重新选择"); return; } } try { Mxm.DAL.article mgr = new Mxm.DAL.article(); mgr.Add(mo); Mxm.Common.MessageBox.Show(this, "提交完成"); } catch (Exception ex) { throw ex; } }