|
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\Class\Class.aspx.cs" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "89C2B10317E7A30956918B9528175DD7"
#line 1 "D:\wwwroot\ldxynb\wwwroot\back\Class\Class.aspx.cs"
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
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_Class_Class : System.Web.UI.Page
{
protected CoreClass.DBCommon dbc = new DBCommon();
protected CoreClass.PublicFunction pubfun = new PublicFunction();
DataTable dt = new DataTable();
public int ChannelId = 0;
public int ChannelLeval = 0;
public int list = 0;
public string strclass = "class2";
protected void Page_Load(object sender, System.EventArgs e)
{
pubfun.RegisterAdminPageClientScriptBlock(Page);
if (this.Request.QueryString["ChannelId"] == null || this.Request.QueryString["ChannelId"].Trim() == "")
{
this.ChannelId = 1;
}
else
{
this.ChannelId = Int32.Parse(this.Request.QueryString["ChannelId"].Trim());
}
//再次验证是否有权限 显示操作页面
//this.pubfun.checkAdminAccessRights(this.Page, "Class" + this.ChannelId.ToString());
if (pubfun.IsNumeric(this.Request.QueryString["list"]) == true)
{
this.list = Int32.Parse(this.Request.QueryString["list"].Trim());
}
if (this.list > 0) this.strclass = "Class2list";
//频路设置
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.ChannelLeval = Int32.Parse(dr["MaxLevel"].ToString());
dl.TableHeaderName = dr["Title"].ToString() + "分类治理";
dr.Close();
if (this.ChannelLeval < 1)
{
this.Response.Write("<html><head><LINK href=\"../Back/back.css\" type=\"text/css\" rel=\"stylesheet\"></head><body>频路配置谬误!</body></html>");
this.Response.End();
}
if (ChannelId == 2) info1.Visible = false;
if (!IsPostBack)
{
this.InitPage();
}
}
protected void InitPage()
{
this.dt = this.dbc.GetDataTableBySql("Select * From Class Where ChannelId=" + this.ChannelId.ToString() + " and tid=0 Order By OrderNum");
this.dl.DataSource = this.dt;
this.dl.DataBind();
dt.Dispose();
}
protected void dl_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
OleDbDataReader dr;
int id, aimId, aimOdr;
TextBox tb;
OleDbCommand cmd;
switch (e.CommandName)
{
case "mdy":
this.dl.EditItemIndex = e.Item.ItemIndex;
this.InitPage();
break;
case "cancel":
this.dl.EditItemIndex = -1;
this.InitPage();
break;
case "up":
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
aimOdr = 0;
aimId = 0;
dr = this.dbc.GetDataReaderBySql("select top 1 classid,OrderNum From Class Where OrderNum<(Select OrderNum From Class Where classid=" + id.ToString() + " and tid=0 And ChannelId=" + this.ChannelId.ToString() + ") And ChannelId=" + this.ChannelId.ToString() + " and tid=0 Order By OrderNum DESC");
if (dr.Read())
{
aimOdr = Int32.Parse(dr["OrderNum"].ToString());
aimId = Int32.Parse(dr["classid"].ToString());
}
else
{
Page.RegisterStartupScript("js", "<script>alert(\"当前分类已经分列在第一位!\");</script>");
return;
}
dr.Close();
if (aimId > 0)
{
this.dbc.ExcuteSql("Update Class Set OrderNum=" + pubfun.GetValue("Class", "OrderNum", "classid=" + id.ToString() + " and tid=0") + " Where tid=0 and classid = " + aimId.ToString());
}
this.dbc.ExcuteSql("Update Class Set OrderNum = " + aimOdr.ToString() + " Where classid = " + id.ToString());
this.dl.EditItemIndex = -1;
this.InitPage();
break;
case "down":
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
aimOdr = 0;
aimId = 0;
dr = this.dbc.GetDataReaderBySql("select top 1 classid,OrderNum From Class Where OrderNum>(Select OrderNum From Class Where classid=" + id.ToString() + " and tid=0 And ChannelId=" + this.ChannelId.ToString() + ") And ChannelId=" + this.ChannelId.ToString() + " and tid=0 Order By OrderNum ASC");
if (dr.Read())
{
aimOdr = Int32.Parse(dr["OrderNum"].ToString());
aimId = Int32.Parse(dr["classid"].ToString());
}
else
{
Page.RegisterStartupScript("js", "<script>alert(\"当前分类已经分列在最后一位!\");</script>");
return;
}
dr.Close();
if (aimId > 0)
{
this.dbc.ExcuteSql("Update Class Set OrderNum=" + pubfun.GetValue("Class", "OrderNum", "classid=" + id.ToString()) + " Where classid = " + aimId.ToString() + " and tid=0");
}
this.dbc.ExcuteSql("Update Class Set OrderNum = " + aimOdr.ToString() + " Where classid = " + id.ToString() + " and tid=0");
this.dl.EditItemIndex = -1;
this.InitPage();
break;
case "ok":
tb = (TextBox)e.Item.FindControl("iptMdy");
if (tb.Text.Trim() == "")
{
pubfun.Alert("分类名称不能为空!", -1);
return;
}
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
cmd = this.dbc.GetCommandBySql("Update Class Set ClassName = @cn1 Where classid=" + id.ToString());
cmd.Parameters.Add("@cn1", OleDbType.VarChar, 50).Value = this.pubfun.SubStringByByte(tb.Text.Trim(), 50);
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
cmd.Connection.Dispose();
cmd.Dispose();
this.dl.EditItemIndex = -1;
this.InitPage();
break;
case "del":
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
if (!Convert.ToBoolean(pubfun.GetValue("Class", "AllowDel", "classid=" + id.ToString())))
{
pubfun.Alert(Page, "该分类不能删除!",-1);
return;
}
this.dbc.ExcuteSql("Delete From Class Where classid=" + id.ToString());
this.dl.EditItemIndex = -1;
this.InitPage();
break;
case "re:true":
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
this.dbc.ExcuteSql("update Class set recommend=1 where Classid=" + id.ToString());
this.dl.EditItemIndex = -1;
this.InitPage();
break;
case "re:false":
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
this.dbc.ExcuteSql("update Class set recommend=0 where Classid=" + id.ToString());
this.dl.EditItemIndex = -1;
this.InitPage();
break;
case "list:true":
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
this.dbc.ExcuteSql("update Class set islist=1 Where Classid=" + id.ToString());
this.InitPage();
break;
case "list:false":
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
this.dbc.ExcuteSql("update Class set islist=0 Where Classid=" + id.ToString());
this.InitPage();
break;
case "pic:true":
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
this.dbc.ExcuteSql("update Class set ispic=1 Where Classid=" + id.ToString());
this.InitPage();
break;
case "pic:false":
id = Int32.Parse(this.dl.DataKeys[e.Item.ItemIndex].ToString());
this.dbc.ExcuteSql("update Class set ispic=0 Where Classid=" + id.ToString());
this.InitPage();
break;
}
}
protected void dl_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (!Convert.ToBoolean(pubfun.GetValue("classChannel", "HaveRe", "ChannelId=" + this.ChannelId)))
{
e.Item.Cells[4].Visible = false;
}
if (!Convert.ToBoolean(pubfun.GetValue("classChannel", "ListOrPic", "ChannelId=" + this.ChannelId)))
{
e.Item.Cells[3].Visible = false;
}
if (this.ChannelLeval < 2) e.Item.Cells[2].Visible = false;
switch (e.Item.ItemType)
{
case ListItemType.AlternatingItem:
case ListItemType.Item:
LinkButton btnDel = (LinkButton)e.Item.FindControl("btnDel");
LinkButton btnMdy = (LinkButton)e.Item.FindControl("btnMdy");
DataRowView drv = (DataRowView)e.Item.DataItem;
if (Boolean.Parse(drv["stop"].ToString()))
{
btnDel.Visible = false;
btnMdy.Visible = false;
}
else
{
btnDel.Visible = true;
btnMdy.Visible = true;
btnDel.Attributes.Add("onclick", "javascript:return confirm('真的要删除吗?');");
}
HyperLink link = (HyperLink)e.Item.FindControl("linkAdd");
LinkButton btnlist1 = (LinkButton)e.Item.FindControl("btnlist1");
LinkButton btnlist2 = (LinkButton)e.Item.FindControl("btnlist2");
if (Boolean.Parse(drv["islist"].ToString())) btnlist2.Visible = false;
else btnlist1.Visible = false;
LinkButton btnpic1 = (LinkButton)e.Item.FindControl("btnpic1");
LinkButton btnpic2 = (LinkButton)e.Item.FindControl("btnpic2");
if (Boolean.Parse(drv["ispic"].ToString())) btnpic2.Visible = false;
else btnpic1.Visible = false;
PlaceHolder PlacePic = (PlaceHolder)e.Item.FindControl("PlacePic");
if (ChannelId == 1) PlacePic.Visible = true;
break;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
InitPage();
if (iptNew.Text.Trim() == "")
{
pubfun.Alert(Page, "请填写要增长的分类名称!");
iptNew.Focus();
return;
}
int curOrder = 0;
OleDbDataReader dr = this.dbc.GetDataReaderBySql("select top 1 OrderNum From Class Where tid=0 Order By OrderNum DESC");
if (dr.Read())
{
curOrder = Int32.Parse(dr["OrderNum"].ToString()) + 1;
}
dr.Close();
OleDbCommand cmd = this.dbc.GetCommandBySql("Insert Into Class(ChannelId,ClassName,OrderNum,stop) values(@channel,@cn1,@odr,0)");
cmd.Parameters.Add("@channel", OleDbType.VarChar, 5).Value = this.ChannelId;
cmd.Parameters.Add("@cn1", OleDbType.VarChar, 50).Value = this.pubfun.SubStringByByte(iptNew.Text.Trim(), 50);
cmd.Parameters.Add("@odr", OleDbType.VarChar, 5).Value = curOrder;
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
cmd.Connection.Dispose();
cmd.Dispose();
pubfun.RegisterStartupScript(Page, "PAGE", "window.location.href='"+Request.Url.AbsoluteUri+"';");
}
}
#line default
#line hidden