//保存 protected void btnSave_Click(object sender, EventArgs e) { model.Title = txtTitle.Text.Trim(); model.Author = txtAuthor.Text.Trim(); model.Form = txtForm.Text.Trim(); //自动提取关健字 if (txtKeyword.Text.Trim() != string.Empty) { model.Keyword = txtKeyword.Text.Trim(); } else { model.Keyword = txtTitle.Text.Trim(); } //自动提取摘要 if (txtZhaiyao.Text.Trim() != string.Empty) { model.Zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 250); } else { model.Zhaiyao = Utils.DropHTML(txtContent.Value, 250); } //自动提取导读 if (txtDaodu.Text.Trim() != string.Empty) { model.Daodu = Utils.DropHTML(txtDaodu.Text, 250); } else { model.Daodu = Utils.DropHTML(txtContent.Value, 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.Add(model); //保存日志 SaveLogs("[资讯模块]添加文章:" + model.Title); JscriptPrint("文章发布成功啦!", "Add.aspx?classId=" + ddlClassId.SelectedValue, "Success"); }
//保存 protected void btnSave_Click(object sender, EventArgs e) { try { //保存用户头像 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; model.Title = txtTitle.Text.Trim(); model.Author = txtAuthor.Text.Trim(); model.Form = txtForm.Text.Trim(); //自动提取关健字 if (txtKeyword.Text.Trim() != string.Empty) { model.Keyword = txtKeyword.Text.Trim(); } else { model.Keyword = txtTitle.Text.Trim(); } //自动提取摘要 if (txtZhaiyao.Text.Trim() != string.Empty) { model.Zhaiyao = StringPlus.DropHTML(txtZhaiyao.Text, 250); } else { model.Zhaiyao = StringPlus.DropHTML(FCKeditor.Value, 250); } //自动提取导读 if (txtDaodu.Text.Trim() != string.Empty) { model.Daodu = StringPlus.DropHTML(txtDaodu.Text, 250); } else { model.Daodu = StringPlus.DropHTML(FCKeditor.Value, 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.Add(model); JscriptPrint("发布成功啦!", "Add.aspx?classId=" + ddlClassId.SelectedValue, "Success"); } else { JscriptPrint("只支持swf视频文件!", "", ""); } } } else { JscriptPrint("请上传视频文件!", "", ""); } } catch (Exception) { JscriptPrint("视频文件过大!", "", ""); } }