protected void btnpublic_Click(object sender, EventArgs e) { string[] values = Request.Form.GetValues("cbxSelect"); if (values == null || values.Length < 1) { Tz888.Common.MessageBox.Show(this.Page, "请选择要静态化的资源!"); return; } int result = 0; for (int i = 0; i < values.Length; i++) { Tz888.Model.NewsTab newstab = newstabbll.GetNewsTabByNewId(Convert.ToInt32(values[i].Trim())); if (newstab.Audit == 1) { Tz888.BLL.news.PageStatic stat = new Tz888.BLL.news.PageStatic(); result = stat.StaticHtml(Convert.ToInt32(values[i].Trim())); } } Tz888.Common.MessageBox.Show(this.Page, "生成成功"); }
protected void btnSave_Click(object sender, EventArgs e) { Tz888.Model.NewsTab newstab = new NewsTab(); Tz888.Model.NewsTypeTab newstypetab = new NewsTypeTab(); Tz888.Model.NewsViewTab newsviewtab = new NewsViewTab(); if (txtnewsTitle.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入标题');", true); return; } if (txtzhaiyao.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入摘要');", true); return; } if (txttitle.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入页面标题');", true); return; } if (txtkeywords.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入关键字');", true); return; } if (txtdescript.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入描述');", true); return; } if (FreeTextBox1.Value.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入内容');", true); return; } if (txtform.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入来源');", true); return; } BasePage bp = new BasePage(); newstab.UserName = bp.LoginName; newstab.TypeID = Convert.ToInt32(this.ddrtype.SelectedValue); newstab.NTitle = txtnewsTitle.Text.Trim(); newstab.Audit = Convert.ToInt32(radiocaozuo.SelectedValue.Trim()); newstab.RecommendID = Convert.ToInt32(this.radiotuijian.SelectedValue.Trim()); newstab.Urlhtml = ""; newstab.Imagesurls = upperson; newstab.Createdate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString().Trim(); newstab.FromID = 1; newsviewtab.Title = txttitle.Text.Trim(); newsviewtab.Keywords = txtkeywords.Text.Trim(); newsviewtab.Description = txtdescript.Text.Trim(); newsviewtab.NewView = FreeTextBox1.Value.Trim(); newsviewtab.Formid = txtform.Text.Trim(); newsviewtab.Author = txtauthor.Text.Trim(); newsviewtab.Zhaiyao = txtzhaiyao.Text.Trim(); int result = newstabbll.InsertNewsTab(newstab, newstypetab, newsviewtab); string maxid = newstabbll.GetMaxNewsId(); int row = 0; if (result > 0) { if (Convert.ToInt32(this.radiocaozuo.SelectedValue) == 1) { string url = "news/" + DateTime.Now.ToString("yyyyMM") + "/news" + DateTime.Now.ToString("yyyyMMdd") + "_" + maxid + ".shtml"; int newsid = Convert.ToInt32(maxid); int rusult3 = newstabbll.UpdateNewsTabUrl(url, newsid); Tz888.BLL.news.PageStatic stat = new Tz888.BLL.news.PageStatic(); row = stat.StaticHtml(newsid); if (row > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "location.href='NewsTabManage.aspx';", true); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('录入失败,没有生成静态文件');location.href='NewsTabManage.aspx';", true); } } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "location.href='NewsTabManage.aspx';", true); } } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('录入失败');", true); } }
protected void btnSave_Click(object sender, EventArgs e) { if (txtnewsTitle.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入标题');", true); return; } if (txtzhaiyao.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入摘要');", true); return; } if (txttitle.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入页面标题');", true); return; } if (txtkeywords.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入关键字');", true); return; } if (txtdescript.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入描述');", true); return; } if (FreeTextBox1.Value.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入内容');", true); return; } if (txtform.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入来源');", true); return; } Tz888.Model.NewsTab newstab = new Tz888.Model.NewsTab(); Tz888.Model.NewsViewTab newsviewtab = new Tz888.Model.NewsViewTab(); newstab.NTitle = txtnewsTitle.Text.Trim(); newstab.RecommendID = Convert.ToInt32(this.radiotuijian.SelectedValue.Trim()); newstab.Reason = txtson.Text.Trim(); newsviewtab.Zhaiyao = txtzhaiyao.Text.Trim(); newsviewtab.Title = txttitle.Text.Trim(); newsviewtab.Keywords = txtkeywords.Text.Trim(); newsviewtab.Description = txtdescript.Text.Trim(); newstab.TypeID = Convert.ToInt32(this.ddrtype.SelectedValue.Trim()); newsviewtab.NewView = this.FreeTextBox1.Value.Trim(); newsviewtab.Author = txtauthor.Text.Trim(); newsviewtab.Formid = txtform.Text.Trim(); if (shen.Checked == true) { newstab.Audit = 0; newstab.Urlhtml = ""; } if (shens.Checked == true) { newstab.Audit = 1; string urladdress = newstabbll.GetNewsTabByNewId(NewsId).Urlhtml.Trim(); if (urladdress == "") { newstab.Urlhtml = "news/" + DateTime.Now.ToString("yyyyMM") + "/news" + DateTime.Now.ToString("yyyyMMdd") + "_" + NewsId + ".shtml"; } else { newstab.Urlhtml = urladdress; } } if (shensss.Checked == true) { newstab.Audit = 3; newstab.Urlhtml = ""; } if (shenssss.Checked == true) { newstab.Audit = 5; newstab.Urlhtml = ""; } //修改主表 int result1 = newstabbll.UpdateNewsTab(newstab, NewsId); //修改详细表 int result2 = newsviewtabbll.UpdateNewsViewTab(newsviewtab, NewsId); if (result1 > 0 && result2 > 0) { if (shens.Checked == true) { Tz888.BLL.news.PageStatic stat = new Tz888.BLL.news.PageStatic(); int row = stat.StaticHtml(NewsId); if (row > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "location.href='NewsTabManage.aspx';", true); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败,没有生成静态文件');location.href='NewsTabManage.aspx';", true); } } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核成功');location.href='NewsTabManage.aspx';", true); } } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true); } }