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 (FreeTextBox1.Value.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入内容');", true); return; } if (txtauthor.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入作者');", true); return; } if (txtform.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入来源');", true); return; } newstab.UserName = Page.User.Identity.Name; newstab.TypeID = Convert.ToInt32(this.ddrtype.SelectedValue); newstab.NTitle = txtnewsTitle.Text.Trim(); newstab.Audit = 0; newstab.Urlhtml = ""; newstab.RecommendID = 0; newstab.Createdate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString().Trim(); newstab.FromID = 2; newsviewtab.Title = ""; newsviewtab.Keywords = ""; newsviewtab.Description = ""; newsviewtab.NewView = FreeTextBox1.Value.Trim(); newsviewtab.Formid = txtform.Text.Trim(); newsviewtab.Author = txtauthor.Text.Trim(); newsviewtab.Zhaiyao = ""; int result = newstabbll.InsertNewsTab(newstab, newstypetab, newsviewtab); ScriptManager.RegisterStartupScript(this, this.GetType(), "提示f:", "s();", true); if (result > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "location.href='NewMange.aspx';", true); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('录入失败');", true); } }
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 (txtauthor.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入作者');", true); return; } if (txtform.Text.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('请输入来源');", true); return; } newstab.UserName = "******"; newstab.TypeID = Convert.ToInt32(this.ddrtype.SelectedValue); newstab.NTitle = txtnewsTitle.Text.Trim(); newstab.Audit = 0; newstab.Urlhtml = ""; newstab.RecommendID = Convert.ToInt32(this.radiotui.SelectedValue.Trim()); newstab.Createdate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString().Trim(); newstab.FromID = 2; 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(); for (int t = 0; t < 8; t++) { int result = newstabbll.InsertNewsTab(newstab, newstypetab, newsviewtab); this.ClientScript.RegisterStartupScript(this.GetType(), "", "location.href='NewsTabManage.aspx';", true); } }
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); } }