//保存 protected void btnSave_Click(object sender, EventArgs e) { DtCms.BLL.Article bll = new DtCms.BLL.Article(); DtCms.Model.Article model = bll.GetModel(this.Id); model.Title = txtTitle.Text.Trim(); model.Author = txtAuthor.Text.Trim(); model.Form = txtForm.Text.Trim(); model.Keyword = txtKeyword.Text.Trim(); model.Zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 250); model.Daodu = Utils.DropHTML(txtDaodu.Text, 250); model.ClassId = int.Parse(ddlClassId.SelectedValue); model.ImgUrl = txtImgUrl.Text.Trim(); model.Content = txtContent.Value; model.Click = int.Parse(txtClick.Text.Trim()); model.IsMsg = 0; model.IsTop = 0; model.IsRed = 0; model.IsHot = 0; model.IsSlide = 0; if (cblItem.Items[0].Selected == true) { model.IsMsg = 1; } if (cblItem.Items[1].Selected == true) { model.IsTop = 1; } if (cblItem.Items[2].Selected == true) { model.IsRed = 1; } if (cblItem.Items[3].Selected == true) { model.IsHot = 1; } if (cblItem.Items[4].Selected == true) { model.IsSlide = 1; } bll.Update(model); //保存日志 SaveLogs("[资讯模块]编辑文章:" + model.Title); JscriptPrint("文章编辑成功啦!", "List.aspx", "Success"); }
//保存 protected void btnSave_Click(object sender, EventArgs e) { try { DtCms.BLL.Article bll = new DtCms.BLL.Article(); DtCms.Model.Article model = bll.GetModel(this.Id); //保存用户头像 if (!string.IsNullOrEmpty(FileUpload1.FileName)) { if (FileUpload1.PostedFile.ContentLength / 1024 > 100) { JscriptPrint("上传的视频过大,视频文件要低于100MB!", "", ""); } else { string ext = FileUpload1.FileName.Substring(FileUpload1.FileName.LastIndexOf('.')); string spath = @"video/" + DateTime.Now.ToString("yyyyMMddhhmmss") + ext;//相对路径 if (ext.ToLower() == ".swf") { FileUpload1.SaveAs(Server.MapPath(spath)); model.ImgUrl = spath; } else { JscriptPrint("只支持swf视频文件!", "", ""); } } } model.Title = txtTitle.Text.Trim(); model.Author = txtAuthor.Text.Trim(); model.Form = txtForm.Text.Trim(); model.Keyword = txtKeyword.Text.Trim(); model.Zhaiyao = StringPlus.DropHTML(txtZhaiyao.Text, 250); model.Daodu = StringPlus.DropHTML(txtDaodu.Text, 250); model.ClassId = int.Parse(ddlClassId.SelectedValue); model.Content = FCKeditor.Value; model.Click = int.Parse(txtClick.Text.Trim()); model.IsMsg = 0; model.IsTop = 0; model.IsRed = 0; model.IsHot = 0; model.IsSlide = 0; if (cblItem.Items[0].Selected == true) { model.IsMsg = 1; } if (cblItem.Items[1].Selected == true) { model.IsTop = 1; } if (cblItem.Items[2].Selected == true) { model.IsRed = 1; } if (cblItem.Items[3].Selected == true) { model.IsHot = 1; } if (cblItem.Items[4].Selected == true) { model.IsSlide = 1; } bll.Update(model); JscriptPrint("编辑成功啦!", "List.aspx", "Success"); } catch (Exception) { JscriptPrint("视频文件过大!", "", ""); } }