|
Server : Microsoft-IIS/10.0 System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586 User : jxgj ( 0) PHP Version : 7.0.33 Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server Directory : D:/tmp_aspnet/root/a99112df/ca2a8923/ |
?#pragma checksum "D:\wwwroot\ldxynb\wwwroot\Back\info\Info.aspx.cs" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "34F3927676362EFB44C079A12DBC5157"
#line 1 "D:\wwwroot\ldxynb\wwwroot\Back\info\Info.aspx.cs"
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.IO;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.OleDb;
using CoreClass;
public partial class Back_Info_Info : System.Web.UI.Page
{
#region 域界说
CoreClass.DBCommon dbc = new DBCommon();
CoreClass.PublicFunction pubfun = new PublicFunction();
Zhongbiao bs = new Zhongbiao();
public int adminid;
public int channelid;
public string col = "info";
#endregion
protected void Page_Load(object sender, EventArgs e)
{
this.channelid = Int32.Parse(Request.QueryString["ChannelId"].Trim());
this.LeadClass1.channelid = this.channelid;
//再次验证是否有权限 显示操作页面
//this.pubfun.checkAdminAccessRights(this.Page, "Info_" + this.channelid.ToString());
dgInfo.GoToPagerButton.Click += new EventHandler(GoToPagerButton_Click);
pubfun.RegisterAdminPageClientScriptBlock(Page);
col = pubfun.GetCol(this.channelid);
if (channelid == 15) AddInfo.Visible = true;
if (!IsPostBack)
{
this.InitPage();
}
}
private void InitPage()
{
//频路设置
OleDbDataReader dr = this.dbc.GetDataReaderBySql("select top 1 * from ClassChannel Where ChannelId=" + this.channelid.ToString());
if(!dr.Read())
{
this.Response.Write("<html><head><LINK href=\"../Back/back.css\" type=\"text/css\" rel=\"stylesheet\"></head><body>频路不存在!</body></html>");
dr.Close();
this.Response.End();
return;
}
this.LeadClass1.Visible = Convert.ToBoolean(dr["fenlei"]);
dgInfo.TableHeaderName = dr["Title"].ToString() + "治理";
dr.Close();
string sql = "Select infoid,Title,Inspect,Recommend,hot,addTime,Hits From " + col + " Where ChannelId=" + this.channelid.ToString();
int classid = pubfun.GetAjaxClassId(Request.Form["ddl1"], Request.Form["ddl2"], Request.Form["ddl3"], Request.Form["ddl4"], Request.Form["ddl5"]);
if (this.keyword.Text.Trim() != "")
{
this.keyword.Text = this.keyword.Text.Trim().Replace("'", "");
sql += " And title like '%" + this.keyword.Text + "%'";
}
sql += pubfun.GetClassSql(classid);
sql += " order by ordernum desc,addtime desc";
DataTable dt = this.dbc.GetDataTableBySql(sql);
dgInfo.DataSource = dt;
this.dgInfo.DataKeyField = "infoid";
dgInfo.DataBind();
dt.Dispose();
}
protected void dgInfo_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
OleDbDataReader dr = dbc.GetDataReaderBySql("select * from classchannel where channelid=" + this.channelid);
if (dr.Read())
{
e.Item.Cells[4].Visible = Convert.ToBoolean(dr["tuijian"]);
e.Item.Cells[5].Visible = Convert.ToBoolean(dr["redian"]);
e.Item.Cells[6].Visible = Convert.ToBoolean(dr["dianji"]);
}
dr.Close();
e.Item.Cells[1].Text = bt_jq( e.Item.Cells[1].Text.ToString(),28);
switch (e.Item.ItemType)
{
case ListItemType.AlternatingItem:
case ListItemType.Item:
LinkButton btndel = (LinkButton)e.Item.Cells[8].Controls[0];
btndel.Attributes.Add("onclick","javascript:return confirm('真的要删除本条信息吗?');");
break;
}
}
protected void dgInfo_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
switch (e.Item.ItemType)
{
case ListItemType.Pager:
e.Item.Cells[0].ColumnSpan = 6 ;
break;
}
}
protected void dgInfo_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
dgInfo.CurrentPageIndex = e.NewPageIndex;
InitPage();
}
protected void GoToPagerButton_Click(object sender, EventArgs e)
{
InitPage();
}
protected void dgInfo_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int id = Int32.Parse(this.dgInfo.DataKeys[e.Item.ItemIndex].ToString());
DataSet dt_zhiinfo = bs.chaxun("select top 1 * from " + col + " where infoid=" + id.ToString() );
if (dt_zhiinfo.Tables[0].Rows.Count > 0)
{
DataSet dt_channeid = bs.chaxun("select top 1 * from ClassChannel where ChannelId=" + dt_zhiinfo.Tables[0].Rows[0]["ChannelId"].ToString());
if (dt_channeid.Tables[0].Rows.Count > 0)
{
if (Session["AdminPassport"] != null && Session["AdminPassport"].ToString() != "")
{
bs.user("insert into rizhi(rz_bt,rz_nr,rz_czr,rz_time) values('删除信息','" + dt_channeid.Tables[0].Rows[0]["title"].ToString() + "--" + dt_zhiinfo.Tables[0].Rows[0]["title"].ToString() + "','" + Session["AdminPassport"].ToString() + "','" + System.DateTime.Now.ToString() + "' )");
}
}
}
this.dbc.ExcuteSql("delete from " + col + " Where infoid=" + id.ToString());
if(this.dgInfo.CurrentPageIndex>0&&this.dgInfo.Items.Count==1)this.dgInfo.CurrentPageIndex--;
this.InitPage();
return;
}
#region ItemCommand
protected void dgInfo_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
switch(e.Item.ItemType)
{
case ListItemType.AlternatingItem:
case ListItemType.Item:
int id = Int32.Parse(this.dgInfo.DataKeys[e.Item.ItemIndex].ToString());
switch(e.CommandName.ToLower().Trim())
{
case "pass:true":
this.dbc.ExcuteSql("update " + col + " set Inspect=1 where infoid=" + id.ToString());
break;
case "pass:false":
this.dbc.ExcuteSql("update " + col + " set Inspect=0 where infoid=" + id.ToString());
break;
case "re:true":
this.dbc.ExcuteSql("update " + col + " set recommend=1 where infoid=" + id.ToString());
break;
case "re:false":
this.dbc.ExcuteSql("update " + col + " set recommend=0 where infoid=" + id.ToString());
break;
case "ho:true":
this.dbc.ExcuteSql("update " + col + " set hot=1 where infoid=" + id.ToString());
break;
case "ho:false":
this.dbc.ExcuteSql("update " + col + " set hot=0 where infoid=" + id.ToString());
break;
}
this.InitPage();
break;
}
}
#endregion
protected void Button1_Click(object sender, System.EventArgs e)
{
this.dgInfo.CurrentPageIndex = 0;
this.InitPage();
return;
}
protected void btnOk_Click(object sender, EventArgs e)
{
StreamWriter sr = new StreamWriter(Server.MapPath("/swf/imgList.xml"), false, System.Text.Encoding.Default);
string xmldoc = "<?xml version='1.0' encoding='GB2312'?>\r\n";
xmldoc += "<imgList>\r\n";
xmldoc += "<pic>\r\n";
DataTable dt = this.dbc.GetDataTableBySql("Select infoid,Title,pic,url,mov From " + col + " Where Inspect=true and ChannelId=" + this.channelid.ToString() + " order by ordernum desc,addtime desc");
for (int i = 0; i < dt.Rows.Count; i++)
{
xmldoc += "<list path=\"" + dt.Rows[i]["mov"].ToString() + "\" smallpath=\"" + dt.Rows[i]["pic"].ToString() + "\" smallinfo=\"" + dt.Rows[i]["title"].ToString() + "\">" + dt.Rows[i]["url"].ToString() + "</list>\r\n";
}
xmldoc += "</pic>\r\n";
xmldoc += "<rollTime fade_in=\"10\">4</rollTime>\r\n";
xmldoc += "<text font=\"黑体\" size=\"12\" bold=\"true\" color=\"0xfffffff\"></text>\r\n";
xmldoc += "</imgList>\r\n";
try
{
sr.Write(xmldoc);
sr.Close();
pubfun.RegisterStartupScript(Page, "PAGE", "window.location.href='" + Request.Url.AbsoluteUri + "';");
}
catch
{
pubfun.Alert(Page,"操作失败!");;
return;
}
return;
}
//截取字符串 显示新闻标题前30字
public string bt_jq(string strss, int id)
{
if (strss.IndexOf("|") > -1)
{
string[] stsszu = strss.Split('|');
strss = stsszu[0].ToString();
}
if (strss.Length > id)
{
strss = strss.Substring(0, id);
}
return strss;
}
}
#line default
#line hidden