/// <summary> /// 生成静态文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnStatic_Click(object sender, EventArgs e) { news.StaticWebService service = new news.StaticWebService(); string[] values = Request.Form.GetValues("cbxSelect"); if (values == null || values.Length < 1) { Tz888.Common.MessageBox.Show(this.Page, "请选择要静态化的资源!"); return; } StringBuilder sb = new StringBuilder(); foreach (string str in values) { cc = page.NewsIdAll(Convert.ToInt32(str.Trim())); if (cc.AuditingStatus != 1) { sb.Append("编号:" + str.Trim() + " 所对应的状态为:" + Verify(cc.AuditingStatus) + " ,生成静态化页面失败\\n"); } else { int num = service.ModifyHtmlFile(Convert.ToInt32(str.Trim())); if (num != 0) { string number = service.CreateHtml(Convert.ToInt32(str.Trim()), cc.Title, cc.PublishT.ToString(), cc.Content, cc.Hit, "tz888Admin", "mtvc2909"); if (number == "1") { Tz888.Common.MessageBox.Show(this.Page, "生成静态页面成功"); } else { Tz888.Common.MessageBox.Show(this.Page, "生成静态页面失败"); } } else { Tz888.Common.MessageBox.Show(this.Page, "生成静态页面失败"); } //page.NewsStaticHtml(Convert.ToInt32(str.Trim()), cc.Title, cc.PublishT.ToString(), cc.Content); //page.NewsModifyHtmlFile(Convert.ToInt32(str.Trim())); } } if (sb.ToString() != "") { Tz888.Common.MessageBox.Show(this.Page, sb.ToString()); } else { Tz888.Common.MessageBox.Show(this.Page, "生成静态页面成功"); } }
protected void btnType_Click(object sender, EventArgs e) { news.StaticWebService service = new news.StaticWebService(); string type = ddlTypea.SelectedValue.ToString().Trim(); StringBuilder sb = new StringBuilder(); string info = page.SetType(type); string[] name = info.Split(','); for (int i = 0; i < name.Length - 1; i++) { cc = page.NewsIdAll(Convert.ToInt32(name[i])); if (cc.AuditingStatus != 1) { sb.Append("编号:" + name[i] + " 所对应的状态为:" + Verify(cc.AuditingStatus) + " ,生成静态化页面失败\\n"); } else { int num = service.ModifyHtmlFile(Convert.ToInt32(name[i])); if (num != 0) { string number = service.CreateHtml(Convert.ToInt32(name[i]), cc.Title, cc.PublishT.ToString(), cc.Content, cc.Hit, "tz888Admin", "mtvc2909"); if (number == "1") { Tz888.Common.MessageBox.Show(this.Page, "生成静态页面成功"); } else { Tz888.Common.MessageBox.Show(this.Page, "生成静态页面失败"); } } } } if (sb.ToString() != "") { Tz888.Common.MessageBox.Show(this.Page, sb.ToString()); } else { Tz888.Common.MessageBox.Show(this.Page, "生成静态页面成功"); } }
string CasesTem = ConfigurationManager.AppSettings["NewsTem"].ToString(); //成功案例模版存放位置 /// <summary> /// 根据ID查询新闻资讯信息 /// </summary> public PageStatic NewsIdAll(int infoId) { PageStatic page = new PageStatic(); string sql = "select a.title,a.publishT,a.AuditingStatus, a.Hit,b.[Content] from MainInfoTab as a inner join NewsTab as b on a.InfoID=b.InfoID where a.InfoID=@infoId"; SqlParameter[] para = { new SqlParameter("@infoId", SqlDbType.Int, 8) }; para[0].Value = infoId; DataSet ds = Tz888.DBUtility.DbHelperSQL.Query(sql, para); if ((ds != null) && (ds.Tables[0].Rows.Count > 0)) { page.Title = ds.Tables[0].Rows[0]["title"].ToString(); page.PublishT = Convert.ToDateTime(ds.Tables[0].Rows[0]["publishT"].ToString()); page.Content = ds.Tables[0].Rows[0]["Content"].ToString(); page._auditingStatus = Convert.ToInt32(ds.Tables[0].Rows[0]["AuditingStatus"].ToString()); page.Hit = Convert.ToString(ds.Tables[0].Rows[0]["Hit"].ToString()); } return(page); }
protected void btnPublish_Click(object sender, EventArgs e) { string LogingName = bp.LoginName; long infoid = Convert.ToInt64(Request["infoID"].ToString()); string ResearchSpot = ""; Tz888.BLL.CasesInfoTabBLL state = new Tz888.BLL.CasesInfoTabBLL(); Tz888.Model.Info.MainInfoModel main = new Tz888.Model.Info.MainInfoModel(); //主表 Tz888.Model.zx.NewsTabModel NewsModel = new Tz888.Model.zx.NewsTabModel(); //新闻表 Tz888.Model.Info.ShortInfoModel shortInfoRule = new Tz888.Model.Info.ShortInfoModel(); //短消息表 //int Hit = 0; //Random rnd = new Random(); //Hit = rnd.Next(25) + 5; string NewsLblStatus = ""; main.publishT = Convert.ToDateTime(DateTime.Now); main.Hit = Convert.ToInt32(txtHit.Text.ToString().Trim()); main.InfoID = infoid; main.LoginName = LogingName; main.InfoOriginRoleName = "0"; //ddlNewsType = ddlNewsType.SelectedValue.Trim();//新闻类型 main.Title = txtTitle.Text.ToString().Trim(); //标题 main.KeyWord = txtKeyword.Text.ToString().Trim(); //关键字 main.Descript = txtDescript.Text.ToString().Trim(); //网页描述 main.DisplayTitle = txtDisplayTitle.Text.ToString().Trim(); //显示标题 main.ValidateStartTime = Convert.ToDateTime(txtValidateStartTime.Text.ToString().Trim()); //开始日期 main.TemplateID = txtTemplate.Text.ToString().Trim(); //模版号 main.ValidateTerm = Convert.ToInt32(ddlValiditeTerm.SelectedValue.ToString().Trim()); //有效期 main.publishT = Convert.ToDateTime(txtPublishT.Text.ToString().Trim()); //发布时间 main.FrontDisplayTime = Convert.ToDateTime(DateTime.Now); //前台显示日期 int Auditting = 0; Auditting = Convert.ToByte(this.rblAuditing.SelectedValue.Trim());//审核状态 main.AuditingStatus = Auditting; if (Auditting == 1) { main.HtmlFile = "News/" + DateTime.Now.ToString("yyyyMM") + "/News" + DateTime.Now.ToString("yyyyMMdd") + "_" + infoid + ".shtml"; } else { main.HtmlFile = ""; } main.GradeID = ddlSetGrade.SelectedValue.Trim(); main.FixPriceID = ddlFix.SelectedValue.Trim(); NewsModel.Summary = txtSummary.ToString().Trim(); //摘要 NewsModel.subTitle = txtKeyword.Text.ToString().Trim(); //短标题 NewsModel.NewsTypeID = ddlNewsType.SelectedValue.Trim(); //新闻类型 if (rdArea.Checked) //新闻标签 0区域,1行业 { if (ddlArea.SelectedValue.Trim() != "请选择地域性标签") { NewsLblStatus = rdArea.Value; NewsModel.AreaID = ddlArea.SelectedValue.Trim(); NewsModel.NewsIndustryID = ddlIndustry.Items[1].Value.ToString().Trim(); } else { Response.Write("<script>alert('请选择地域性标签');</script>"); return; } } if (rdIndustry.Checked) { if (ddlIndustry.SelectedValue.Trim() != "请选择行业性标签") { NewsLblStatus = rdIndustry.Value; NewsModel.NewsIndustryID = ddlIndustry.SelectedValue.Trim(); NewsModel.AreaID = ddlArea.Items[1].Value.ToString().Trim(); } else { Response.Write("<script>alert('请选择行业性标签');</script>"); return; } } NewsModel.NewsLblStatus = NewsLblStatus; NewsModel.Origin = txtOrigin.Text.ToString().Trim(); //资讯来源 NewsModel.Author = txtAuthor.Text.ToString().Trim(); //作者 NewsModel.Keyword = txtKeyword.ToString().Trim(); //关键字 NewsModel.RedirectUrl = txtRedirectUrl.Text.ToString().Trim(); //转向连接 NewsModel.IsRedirect = chkIsRedirect.Checked; //是否使用转向连接 NewsModel.Summary = txtSummary.Text.ToString().Trim(); //摘要 NewsModel.Content = FCKeditor.Value; NewsModel.Pic1 = Convert.ToString(ViewState["strSavePath"]); NewsModel.PicAbout = txtPicAbout.Value.ToString().Trim(); NewsModel.PageStatus = Convert.ToInt32(rblPageStatus.SelectedValue); //分页方法 0 不分页 1 手动分页 2 自动分页 NewsModel.PageCharCount = Convert.ToInt64(txtPageCharCount.Value.ToString().Trim()); //自动分页字符数 if (rbyjcg.Checked) //加入中国招商投资研究会 { ResearchSpot = "0"; } //0:研究成果 1:行业聚焦 2:风云人物 else if (rbhyjj.Checked) { ResearchSpot = "1"; } else if (rbfyrw.Checked) { ResearchSpot = "2"; } else { ResearchSpot = ""; } NewsModel.ResearchSpot = ResearchSpot; #region 短信息表 shortInfoRule.ShortTitle = txtShortTitle.Text.ToString().Trim(); //短标题 shortInfoRule.ShortContent = txtShortContent.Text.ToString().Trim(); //短内容 shortInfoRule.ShortInfoControlID = "NewsIndex1"; //信息容量 shortInfoRule.Remark = ""; shortInfoRule.ChangeTime = Convert.ToDateTime(DateTime.Now); //时间 shortInfoRule.ChangeBy = LogingName; //创建人 #endregion //插入数据 Tz888.BLL.zx.NewsTabManager bll = new Tz888.BLL.zx.NewsTabManager(); long InfoID = bll.Update(main, NewsModel, shortInfoRule); if (InfoID >= 0) { int num = serivice.ModifyHtmlFile(Convert.ToInt32(InfoID)); if (num >= 0) { cc = cc.NewsIdAll(Convert.ToInt32(InfoID)); serivice.CreateHtml(Convert.ToInt32(InfoID), cc.Title, cc.PublishT.ToString(), cc.Content, cc.Hit, "tz888Admin", "mtvc2909"); } else { Tz888.Common.MessageBox.Show(this.Page, "审核失败"); } Tz888.Common.MessageBox.Show(this.Page, "审核成功"); } else { Tz888.Common.MessageBox.Show(this.Page, "审核失败"); } if (InfoID <= 0) { Tz888.Common.MessageBox.Show(this.Page, "审核失败"); } }