|
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/04556082/ecc0c5af/ |
?#pragma checksum "d:\wwwroot\gzgunuo\wwwroot\qiao\GongList10.aspx.cs" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "CF8B3AC263F53F2F0BC7EF53E86E2281"
#line 1 "d:\wwwroot\gzgunuo\wwwroot\qiao\GongList10.aspx.cs"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using System.IO;
public partial class GongList : System.Web.UI.Page
{
private int pageSize = 15; //每頁大幼
private int pageCount = 0; //总頁数
private int Pages { get { int d; int.TryParse(Request.QueryString["page"], out d); return d > 0 ? d - 1 : 0; } }
private int CID { get { return Convert.ToInt32(Request.QueryString["c"]); } }
public string Name { get { return Convert.ToString(Request.QueryString["n"]); } }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (this.Name == null || this.Name == "")
return;
DataBinCF();
DataBin();
}
}
public void DataBinCF()
{
//this.DropDownList1.DataSource = SqlManager.GetCFList(this.Name, 0);
//this.DropDownList1.DataTextField = "Name";
//this.DropDownList1.DataValueField = "Id";
//this.DropDownList1.DataBind();
//DropDownList1.Items.Insert(0, new ListItem(" 全 部 ", "0"));
//起头迭代加载
MakeTr(0, 0);
DropDownList1.Items.Insert(0, new ListItem(" 全 部 ", "0"));
if (this.CID > 0)
this.DropDownList1.SelectedValue = this.CID.ToString();
}
/// <summary>
/// 装配每一行
/// </summary>
/// <param name="id">上级ID</param>
/// <param name="count">迭代次数</param>
private void MakeTr(int id, int count)
{
foreach (Classification cf in SqlManager.GetCFList(this.Name, id))
{
//形成下拉列表
ListItem li = new ListItem(StringHelper.MakeFelgefu(count) + cf.Name, cf.Id.ToString());
DropDownList1.Items.Add(li);
//再次遍历
MakeTr(cf.Id, count + 1);
}
}
private void DataBin()
{
string where = " where tableName='" + this.Name + "'";
if (this.CID > 0)
where += " and CID=" + this.CID;
this.Repeater1.DataSource = SqlManager.GetGong(this.Pages, this.pageSize, out this.pageCount, where);
this.Repeater1.DataBind();
////设置頁码
this.AspNetPager1.UrlPaging = true;
this.AspNetPager1.PageSize = this.pageSize;
this.AspNetPager1.RecordCount = this.pageCount;
}
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
//单个删除
if (e.CommandName == "Del")
{
int Id = Convert.ToInt32(e.CommandArgument);
Gong g = SqlManager.GetGong(Id);
if (SqlManager.DelGong(Id))
{
if (File.Exists(Server.MapPath("~/Images/" + g.tableName + "/" + g.Alt)))
File.Delete(Server.MapPath("~/Images/" + g.tableName + "/" + g.Alt));
if (File.Exists(Server.MapPath("~/Images/" + g.tableName + "/x_" + g.Alt)))
File.Delete(Server.MapPath("~/Images/" + g.tableName + "/x_" + g.Alt));
}
}
if (e.CommandName == "up")
{
string KindID = e.CommandArgument.ToString().Split(',')[0];
int itemIndex = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[1]);
TextBox TextBox1 = this.Repeater1.Items[itemIndex].FindControl("text") as TextBox;
if (TextBox1.Text.Trim() != "")
SqlManager.Get("update Gong set [Order]=" + TextBox1.Text + " where Id=" + KindID);
}
DataBin();
}
//多选删除
protected void Button1_Click(object sender, EventArgs e)
{
if (Request.Form["c1"] == null)
return;
string[] AllId = Request.Form["c1"].Split(',');
foreach (string item in AllId)
{
int Id = Convert.ToInt32(item);
Gong g = SqlManager.GetGong(Id);
if (SqlManager.DelGong(Id))
{
if (File.Exists(Server.MapPath("~/Images/" + g.tableName + "/" + g.Alt)))
File.Delete(Server.MapPath("~/Images/" + g.tableName + "/" + g.Alt));
if (File.Exists(Server.MapPath("~/Images/" + g.tableName + "/x_" + g.Alt)))
File.Delete(Server.MapPath("~/Images/" + g.tableName + "/x_" + g.Alt));
}
}
DataBin();
}
//返回分类名称
public string GetDF(int DID)
{
Classification cf = SqlManager.GetCF(DID);
if (cf != null)
return cf.Name;
else
return "";
}
//查问
protected void Button2_Click(object sender, EventArgs e)
{
this.Response.Redirect(string.Format("GongList10.aspx?n={0}&c={1}", this.Name, DropDownList1.SelectedValue));
}
}
#line default
#line hidden