|
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\GongList_jc.aspx.cs" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "769F11E29E2D42302023B3CB4E2171B7"
#line 1 "d:\wwwroot\gzgunuo\wwwroot\qiao\GongList_jc.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; //总頁数
//当前頁码,从QueryString读取
private int Pages
{
get
{
if (Request.QueryString["page"] == null)
{
return 0;
}
if (Convert.ToInt32(Request.QueryString["page"]) != 0)
{
return Convert.ToInt32(Request.QueryString["page"]);
}
else
{
return 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);
if (SqlManager.DelGong(Id))
{
List<Images> list = SqlManager.GetImagesList(this.Name, Id);
foreach (var img in list)
{
//删除图片
StringHelper.DelImgFile(Server.MapPath("~/Images/" + this.Name + @"\"), img.ImgUrl, this.Name);
}
if (list.Count > 0)
SqlManager.DelImages(this.Name, Id);
}
}
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);
if (SqlManager.DelGong(Id))
{
List<Images> list = SqlManager.GetImagesList(this.Name, Id);
foreach (var img in list)
{
//删除图片
StringHelper.DelImgFile(Server.MapPath("~/Images/" + this.Name + @"\"), img.ImgUrl, this.Name);
}
if (list.Count > 0)
SqlManager.DelImages(this.Name, Id);
}
}
DataBin();
}
//返回分类名称
public string GetDF(int DID)
{
Classification cf = SqlManager.GetCF(DID);
if (cf != null)
return cf.Name;
else
return "";
}
//返回封面图片
public string GetImgUrl(string tableName, int TID)
{
Images img = SqlManager.GetImages(tableName, TID);
if (img != null)
return "../Images/" + tableName + "/x_" + img.ImgUrl;
else
return "../Images/zwtp.png";
}
//查问
protected void Button2_Click(object sender, EventArgs e)
{
this.Response.Redirect(string.Format("GongList.aspx?n={0}&c={1}", this.Name, DropDownList1.SelectedValue));
}
}
#line default
#line hidden